User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

How to defragment NTFS drive

Sat Feb 01, 2014 8:00 am

Hi,

I use my Raspberry Pi as XBMC and NAS. (I would not believe it is able to play HD movie and act as NAS in the same time :D That is why, I am very proud of this tiny computer.)
I have one question regarding my hard drive (http://www.amazon.com/Western-Digital-W ... B000VZCEUI) which is attached to my Raspberry Pi. It uses NTFS file format. How could I defragment it in Raspbian ? My Windows 7 machine refuses to defragment network drive.

talm
Posts: 22
Joined: Thu Jan 17, 2013 10:14 pm

Re: How to defragment NTFS drive

Sat Feb 01, 2014 10:31 am

Put the drive in a SATA docking station, which is connected to th W 7 system via USB.
Then the disk is regarded as a Local drive and can be defragged.

Torbjörn Alm

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: How to defragment NTFS drive

Sat Feb 01, 2014 10:41 am

You cannot defrag a network drive because the communication protocol doesn't permit direct disk access, defragging is only possible with local connection to your Windows machine.

Richard S.

User avatar
scruss
Posts: 2585
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: How to defragment NTFS drive

Sat Feb 01, 2014 2:37 pm

You don't really need to defrag drives any more. While NTFS isn't quite as clever as ext4 for keeping files together, it's still much better than FAT.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Sat Feb 01, 2014 5:08 pm

I appreciate your posts but my question remained unanswered. Is Raspbian able to defragment NTFS file system ? (Even if it may not be as important as I thought. :oops: )

forenbenutzer
Posts: 148
Joined: Thu Aug 02, 2012 7:08 pm

Re: How to defragment NTFS drive

Sat Feb 01, 2014 5:25 pm

http://ultradefrag.sourceforge.net/en/index.html

Don't know if it'll compile against the raspberry ARM architecture.
Pitendo - Case And Emulator Project - http://edv-huber.com/index.php/problemloesungen/12-pitendo

ghans
Posts: 7877
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: How to defragment NTFS drive

Sat Feb 01, 2014 5:53 pm

UltraDefrag is BETA for Linux. Why would you try to defrag a proprietary Windows filesystem on Linux ?
Sounds like guaranteered recipe for data loss. So far i know , Tuxera still recommends Windows chdsk if ntfs-3g encouters
problems , so i'm going to do the same : If you have problems with Microsoft products , use Microsoft tools to fix them.

http://technet.microsoft.com/en-us/sysi ... 97428.aspx

A GUI for former tool :
http://my.opera.com/rejzor/blog/power-d ... 0-released


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: How to defragment NTFS drive

Sat Feb 01, 2014 6:14 pm

It's worth noting that Microsoft had never released the specifications for NTFS so Linux support has been reverse engineered.
I'm sure defragging with Linux is possible but given it's current form I think you're better off sticking to Windows and playing it safe.

Richard S.
Last edited by redhawk on Sat Feb 01, 2014 7:28 pm, edited 1 time in total.

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Sat Feb 01, 2014 6:38 pm

ghans wrote:UltraDefrag is BETA for Linux. Why would you try to defrag a proprietary Windows filesystem on Linux ?
Sounds like guaranteered recipe for data loss. So far i know , Tuxera still recommends Windows chdsk if ntfs-3g encouters
problems , so i'm going to do the same : If you have problems with Microsoft products , use Microsoft tools to fix them.

http://technet.microsoft.com/en-us/sysi ... 97428.aspx

A GUI for former tool :
http://my.opera.com/rejzor/blog/power-d ... 0-released


ghans
Because I am too lazy to disconnect all wires and move with my heavy cabinet :-) (My Raspberry Pi is very well hidden under TV.) Thank you again for all given informations. I am going to leave my NAS without defragmentation.

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: How to defragment NTFS drive

Sun Feb 02, 2014 12:59 am

If you do not plan to move the drive between Linux and Windows, then it is probably best not to use NTFS at all. As well as being reverse engineered, the Open Source writeable implementation, ntfs-3g, works as a user-space driver via FUSE. Its performance may be significantly lower than a native filesystem such as ext4, especially on embedded CPUs like the Pi.

http://www.tuxera.com/products/tuxera-n ... rformance/

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Sun Feb 02, 2014 8:45 am

Nice link. Thank you.I use NTFS because the drive attached to my raspberry Pi act as file server for Windows machines. Is there any better multi platform file system ?

User avatar
rpdom
Posts: 15460
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to defragment NTFS drive

Sun Feb 02, 2014 9:10 am

The file system on the drive is unimportant when it comes to sharing. You are better off using ext4.

Windows sees the share as CIFS (or SMBFS), which is what it understands, no matter what it is formatted as.

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Sun Feb 02, 2014 11:05 am

It would mean to back up about 400Mb, format the drive to EXT4 and copy my data back. It sounds easy but it is quite time consuming operation with real throughput of the drive attched to Raspberry Pi approximately 2Mb/s... Is there any safe software solution for direct conversion NTFS to EXT4 ?

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to defragment NTFS drive

Sun Feb 02, 2014 4:28 pm

Liber wrote:It would mean to back up about 400Mb, format the drive to EXT4 and copy my data back. It sounds easy but it is quite time consuming operation with real throughput of the drive attched to Raspberry Pi approximately 2Mb/s... Is there any safe software solution for direct conversion NTFS to EXT4 ?
I don't think so, but even if there were a way you would want to make a backup first.
I would connect the drive to a Windows machine and copy off the files. You can format the drive as well on the Windows machine if you temporarily boot one of the Linux live images. You may be able to copy files back to the drive after format as well but haven't tried that.

Note that I am getting 8MB/s from my Win8.1 to a 2T ext3 formatted NAS drive attached to my RPi and 5MB/s reading from NAS to Win8.1.
(wired LAN connection)
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Sun Feb 02, 2014 7:12 pm

8 MB/s ? :shock: It seems to be the right reason to change file system asap :D Do you connect to your NAS via WiFi ? ( I use WiFi "n" to access my NAS.)

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to defragment NTFS drive

Mon Feb 03, 2014 2:53 am

Liber wrote:8 MB/s ? :shock: It seems to be the right reason to change file system asap :D Do you connect to your NAS via WiFi ? ( I use WiFi "n" to access my NAS.)
I am using wired network. When I get a chance I will try the same test over WIFI.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to defragment NTFS drive

Mon Feb 03, 2014 4:24 am

I changed to WIFI and got 2.4 MB/s to NAS and 3 MB/s from NAS. (750MB file)
Transfers were steady going all the way through. (Unlike transfers to the SD card on the same NAS which would frequently drop to 0 for several seconds at a time)
('n' type WIFI about 7.5m distance through 2 walls)
Dongle is the WIPI from Element14
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
Liber
Posts: 51
Joined: Sat Dec 01, 2012 12:31 pm
Location: Czech Republic
Contact: ICQ

Re: How to defragment NTFS drive

Mon Feb 03, 2014 6:53 am

Thank you for your tests. In my point of view, WiFi "n" is fast enough (http://en.wikipedia.org/wiki/IEEE_802.11n-2009). What could be reason of significant difference between throughput of WiFi (speed 2,4 MB/s) and cable (speed 8MB/s) ?
Last edited by Liber on Thu Feb 06, 2014 6:46 am, edited 1 time in total.

andrum99
Posts: 871
Joined: Fri Jul 20, 2012 2:41 pm

Re: How to defragment NTFS drive

Wed Feb 05, 2014 11:33 pm

NTFS access on the Raspberry Pi is rather slow, presumably due to the limited CPU power of the ARM. Defragmentation of NTFS, should you manage to find a way to do it, is going to be painfully slow. I strongly suggest you attached the drive directly to a Windows machine to do the defrag, then re-attach it to the Pi. Not ideal I know, but this is the easiest way to do it.

Because NTFS is so slow on the Raspberry Pi you should consider using a different file system, e.g. ext4. You can share any filesystem you like with a Windows machine from a Linux machine - it makes no difference to what gets sent over the network.

Return to “Networking and servers”