You are not logged in.

#26 2013-10-10 12:35:52

MilenKid
Member
Registered: 2013-04-21
Posts: 86

Re: Defragment a NTFS partition from LINUX

Wat? They guy asks how to defrag NTFS and your answers are all over the place (why you need it, use ext4, use CIFS, use live USB).

Then I say buy an external SSD. Or a new car.

That's why we can't have nice things.

IMHO (I'm not in the same situation because I use Linux everywhere I can and for inter-compatibility I have a second 2TB NTFS HDD) I wouldn't defrag NTFS outside windows, how I wouldn't defrag BTRFS outside Linux.

on-topic contribution:
You could test Ultradefrag with MD5 checksums, but that could take a while. Anyway, I would do that to be sure. Or you could make some /dev/urandom files on a NTFS looback drive, checksum them and defrag several times comparing hashes after each run.

Last edited by MilenKid (2013-10-10 12:36:22)

Offline

#27 2013-10-10 12:51:22

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,784
Website

Re: Defragment a NTFS partition from LINUX

If it's nearly full, then just move all the files off the partition, then move them back. That should defrag it.

Trying to defrag a nearly full NTFS partition will either fail, or thrash the disk excessively.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#28 2013-10-10 21:31:29

SysGhost
Member
From: Stockholm
Registered: 2012-11-09
Posts: 59

Re: Defragment a NTFS partition from LINUX

MilenKid wrote:

Wat? They guy asks how to defrag NTFS and your answers are all over the place (why you need it, use ext4, use CIFS, use live USB).

Then I say buy an external SSD. Or a new car.

That's why we can't have nice things.

IMHO (I'm not in the same situation because I use Linux everywhere I can and for inter-compatibility I have a second 2TB NTFS HDD) I wouldn't defrag NTFS outside windows, how I wouldn't defrag BTRFS outside Linux.

on-topic contribution:
You could test Ultradefrag with MD5 checksums, but that could take a while. Anyway, I would do that to be sure. Or you could make some /dev/urandom files on a NTFS looback drive, checksum them and defrag several times comparing hashes after each run.

Not sure if your answer was meant for the thread owner, or me. But I'll answer: (EDIT: My post is "agreeing with you", not against you as it might appear to be, at a first glance. When I write "you" I mean everyone.)
If you did read about my situation? NTFS is pretty much my only option.
Trying to force family and friends using another operating system and different solutions just because I "want" to use a *nix filesystem is not a good solution.

Using FTP, CIFS, NFS or whatever transfer methods over the internet is NOT a solution. Transferring several Terabytes over a poor internet connection back and forth several times a day? ... really? ... seriously?

I'll repeat myself yet another time:

SysGhost wrote:

If I haven't been clear enough, Here's the situation:
I have a bunch of portable drives. They're used between many different systems, some of them I cannot control what OS they run. (Friends and family)
In order to keep the portable drives compatible with a wide range of different systems, and yet use a filesystem good enough for huge drives, the only choice is NTFS.
FAT32 won't do as it is a deprecated fs.
exFAT might just work, but have the same problems as NTFS do: utilities under Linux is lacking. Besidens not a good fs fora terabyte-sized drive.
*nix filesystems only work with *nix systems. That will keep a majority of my friends and family out, as they cannot read these filesystems without ugly hacks and/or poor third party softwares.
NTFS is the only choice left.

If anyone have suggestion on a FS that can be maintained under Linux, work with a wide range of systems including Mac OS X and Windows and work well on multi terabyte -sized block devices... I'm all over it.

Besides. I already found a solution that works surprisingly well, if you read my later post about "Ultradefrag for Linux beta".
I have already run a tests with a "filled to the brim" drive. It works. Sure it takes time, but once done, the drive is fully defragmented. Data on it is intact. (Yes, I did MD5-Sum it all), and the NTFS filesystem is healthy.
So far, so good.

I did notice however: If the NTFS filesystem is "dirty" (Either has the dirty flag set, and/or contain actual errors) udefrag won't start. It silently quits. It took me a few minutes to figure out that it was the dirty NTFS filesystem that stopped udefrag in its tracks. But once fixed, it went on like a train.

Last edited by SysGhost (2013-10-10 22:02:08)

Offline

#29 2013-10-18 22:47:25

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Defragment a NTFS partition from LINUX

SysGhost wrote:

I've found a solution.
It seems there is a beta-version of Ultradefrag for Linux. It's utilizes NTFS-3g, so there are some risks to this. Never use this tool without having a backup.
It can be downloaded from: http://b.andre.pagesperso-orange.fr/adv … fs-3g.html
It's named "ultradefrag-5.0.0AB.7.zip"
Once unpacked, one should read "README.linux" before doing anything else. There is some important information one need to know BEFORE compiling.

The compilation might still fail, despite all corrections according to the README.linux, and I have found the culprit.
I have written a patch file to remedy one problem: https://dl.dropboxusercontent.com/u/147 … AB.7.patch

Here's the complete procedure:

wget http://b.andre.pagesperso-orange.fr/ultradefrag-5.0.0AB.7.zip
unzip ultradefrag-5.0.0AB.7.zip
cd ultradefrag-5.0.0AB.7
wget https://dl.dropboxusercontent.com/u/14775223/Various/ultradefrag-5.0.0AB.7.patch
patch -p1 ultradefrag-5.0.0AB.7.patch

Update src/Makefile as needed. One might need to check the LIB2 variable, and update the paths. While at it, correct the other variables if needed.
Then compile and copy the binary:

make
cp udefrag /usr/bin/

I will not take any whatsoever responsibility if anyone destroys anything with this.
Everything here is done at your own risk. Keep in mind: Ultradefrag for Linux is only beta, utilizing a prebundled ntfs-3g library.
I have tested a few runs on a few portable USB hard drives, and it seems to be doing a great job on the NTFS filesystems. I had no data loss nor corruption so far.
But: I STRONGLY advises against using this on a Windows partition and its boot partition. It will render Windows unbootable. It's not because of corruption. It's because "Ultradefrag for Linux" cannot update Windows boot records. (Well. One could do it, and then repair the boot records afterwards.)

You could put this into the AUR.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#30 2013-10-23 06:19:52

SysGhost
Member
From: Stockholm
Registered: 2012-11-09
Posts: 59

Re: Defragment a NTFS partition from LINUX

nomorewindows wrote:
SysGhost wrote:

I've found a solution.
It seems there is a beta-version of Ultradefrag for Linux. It's utilizes NTFS-3g, so there are some risks to this. Never use this tool without having a backup.
It can be downloaded from: http://b.andre.pagesperso-orange.fr/adv … fs-3g.html
It's named "ultradefrag-5.0.0AB.7.zip"
Once unpacked, one should read "README.linux" before doing anything else. There is some important information one need to know BEFORE compiling.

The compilation might still fail, despite all corrections according to the README.linux, and I have found the culprit.
I have written a patch file to remedy one problem: https://dl.dropboxusercontent.com/u/147 … AB.7.patch

Here's the complete procedure:

wget http://b.andre.pagesperso-orange.fr/ultradefrag-5.0.0AB.7.zip
unzip ultradefrag-5.0.0AB.7.zip
cd ultradefrag-5.0.0AB.7
wget https://dl.dropboxusercontent.com/u/14775223/Various/ultradefrag-5.0.0AB.7.patch
patch -p1 ultradefrag-5.0.0AB.7.patch

Update src/Makefile as needed. One might need to check the LIB2 variable, and update the paths. While at it, correct the other variables if needed.
Then compile and copy the binary:

make
cp udefrag /usr/bin/

I will not take any whatsoever responsibility if anyone destroys anything with this.
Everything here is done at your own risk. Keep in mind: Ultradefrag for Linux is only beta, utilizing a prebundled ntfs-3g library.
I have tested a few runs on a few portable USB hard drives, and it seems to be doing a great job on the NTFS filesystems. I had no data loss nor corruption so far.
But: I STRONGLY advises against using this on a Windows partition and its boot partition. It will render Windows unbootable. It's not because of corruption. It's because "Ultradefrag for Linux" cannot update Windows boot records. (Well. One could do it, and then repair the boot records afterwards.)

You could put this into the AUR.

I ran into some trouble trying to create a configure script for the source. It isn't as straight forward as it might appear to be. I guess the original author of the source haven't created a configure script for the same problems I ran into. Without the configure script, it'll be tricky to create an automatic configuration and compiling script, and with that somewhat troublesome creating a package/PKGBUILD for it.
If someone with more skills than me is willing to try, they're welcome.

Offline

#31 2013-10-24 06:22:28

scjet
Banned
Registered: 2011-07-23
Posts: 172

Re: Defragment a NTFS partition from LINUX

The supremely "safe" way to defrag NTFS is really only with Windows.

Just use this free tool "Windows7-USB-DVD-tool.exe", from here:
http://www.microsoftstore.com/store/msu … vd_dwnTool

to make a bootable usb-image of any one of these (30-day Legal trials) from here:
http://www.mytechguide.org/10042/window … gitalriver

...drop to a command shell and run "defrag.exe" ..., on any Volume/Drive that you need.
It's guarnteed to work everytime.
wink

Last edited by scjet (2013-10-24 06:25:46)


The "BSD" things in life are "Free", and "Open", and so is "Arch"

Offline

#32 2013-10-28 16:39:33

ezacaria
Member
Registered: 2007-12-10
Posts: 113

Re: Defragment a NTFS partition from LINUX

I would second the motion to move the files from the external drives, and then put them back. However, this probably will not defragment the MFT - in case it became fragmented at some point when the drive was nearly full. In that case the simplest may be evacuate the files, then do a quick format, then copy them back.

Another solution that comes to mind would be to use ultradefrag in a windows guest (e.g., in VirtualBox) and connect the drive over a USB2 port.

Anyways, if you are satisfied with the ultradefrag for Linux, then all is good smile

Offline

#33 2013-10-30 01:07:22

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Defragment a NTFS partition from LINUX

scjet wrote:

The supremely "safe" way to defrag NTFS is really only with Windows.

Just use this free tool "Windows7-USB-DVD-tool.exe", from here:
http://www.microsoftstore.com/store/msu … vd_dwnTool

to make a bootable usb-image of any one of these (30-day Legal trials) from here:
http://www.mytechguide.org/10042/window … gitalriver

...drop to a command shell and run "defrag.exe" ..., on any Volume/Drive that you need.
It's guarnteed to work everytime.
wink

What's the point if you already have a "working" installation of Windows?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#34 2013-10-30 01:37:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Defragment a NTFS partition from LINUX

scjet wrote:

It's guarnteed to work everytime.
wink

Yeah, right.

Regardless, this is a proprietary file system that does not have a publicly available specification.  I would not trust any tools not provided by the vendor.  I will not comment whether I trust those provided by the vendor.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#35 2013-10-30 18:49:46

BluMongoose
Member
From: 'Murica
Registered: 2012-04-24
Posts: 49

Re: Defragment a NTFS partition from LINUX

@SysGhost, Another option might be to nab a copy of Hiren's Boot CD. It has a mini xp image you can boot to and it also contains 2 different defragment tools. I haven't used those tools personally but it might be better than keeping a whole win install just for that purpose.


"Think for yourself and question authority." -T. Leary

Offline

#36 2013-10-31 23:31:27

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Defragment a NTFS partition from LINUX

BluMongoose wrote:

@SysGhost, Another option might be to nab a copy of Hiren's Boot CD. It has a mini xp image you can boot to and it also contains 2 different defragment tools. I haven't used those tools personally but it might be better than keeping a whole win install just for that purpose.

One of those CD's requires the Windows CD in order for it to produce I think.  But I maybe thinking of the other one.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#37 2014-05-20 23:55:09

jhparizona
Member
Registered: 2014-05-20
Posts: 1

Re: Defragment a NTFS partition from LINUX

Just a note for anyone reading this thread. Hiren's Boot CD (15.1 I think is the version I have) does have a bootable mini-xp system and DOES NOT require the user to have a windows license. It is a PE environment but does offer numerous tools to work on NTFS drives

Offline

Board footer

Powered by FluxBB