Page 1 of 1

How to defragment NTFS drive

Posted: Sat Feb 01, 2014 8:00 am
by Liber
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.

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 10:31 am
by talm
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

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 10:41 am
by redhawk
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.

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 2:37 pm
by scruss
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.

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 5:08 pm
by Liber
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: )

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 5:25 pm
by forenbenutzer
http://ultradefrag.sourceforge.net/en/index.html

Don't know if it'll compile against the raspberry ARM architecture.

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 5:53 pm
by ghans
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

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 6:14 pm
by redhawk
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.

Re: How to defragment NTFS drive

Posted: Sat Feb 01, 2014 6:38 pm
by Liber
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.

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 12:59 am
by jojopi
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/

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 8:45 am
by Liber
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 ?

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 9:10 am
by rpdom
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.

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 11:05 am
by Liber
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 ?

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 4:28 pm
by klricks
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)

Re: How to defragment NTFS drive

Posted: Sun Feb 02, 2014 7:12 pm
by Liber
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.)

Re: How to defragment NTFS drive

Posted: Mon Feb 03, 2014 2:53 am
by klricks
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.

Re: How to defragment NTFS drive

Posted: Mon Feb 03, 2014 4:24 am
by klricks
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

Re: How to defragment NTFS drive

Posted: Mon Feb 03, 2014 6:53 am
by Liber
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) ?

Re: How to defragment NTFS drive

Posted: Wed Feb 05, 2014 11:33 pm
by andrum99
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.