Running defragfs

Hello Folks,

I’ve been trying to run defragfs with no success.

Basically, I downloaded it from sourceforge, unpacked it in filemanager, then copied defragfs to usr/bin in a terminal. When I try to run it (using sudo defragfs…) I get “command not found”. Ls shows that defragfs does exist in usr/bin, although it’s greyed out, so I’m assuming it’s not properly unpacked. I tried “make defragfs” in the terminal but got “make: Nothing to be done for ‘defragfs’”.

Any suggestions welcome. Thanks.

what’s the output from

ls -l /usr/bin/defragfs

Though you do realise Linux filesystems don’t really need defragmenting right ?
(caveat - at least they don’t normally fragment unless your disk gets full, as the file system always attempts to write files contiguously)


Something else to note - If you have an SSD, because of the way blocks are written/read, you never need to defragment even in Windows (in fact it would be a bad thing to do as it would have zero effect on read times but would shorten the life of the SSD).

Here it is Mark,

mike@xubuntu:/usr/bin$ ls -l /usr/bin/defragfs
-rw-r–r-- 1 root root 10091 Oct 13 23:09 /usr/bin/defragfs

I know Linux filesystems don’t usually need defragging, but this disk is nearly full and has been partitioned and dual-booted with Windows and chunters away at snail’s pace, so I thought it worth a go. And no, it’s not an SSD. in fact it’s an old IDE drive. I’m about to swap in an SSD and do a nice fresh install of Xubuntu. The defrag is just an experiment really, and what bugs me is not being able to get it to run!

from what I’m reading it defrags files … not so much the entire drive.

But anyway, if you wanna give it a shot, the reason it’s not working is the binary executable hasn’t been marked as executable … you can fix this by running:

sudo chmod +x /usr/bin/defragfs

Thanks Mark,

Defragfs runs now, but I’m getting the following…

mike@xubuntu:/$ defragfs /dev/sda5
defragfs 1.1.1, Released under GPLv3 by John Robson john.robson@usp.br, March 2011 (help: $ defragfs / -h)

You must specify a correct directory name!

So I tried this…

mike@xubuntu:/$ cd /dev
mike@xubuntu:/dev$ cd /sda5
bash: cd: /sda5: No such file or directory

fdisk shows the following…

mike@xubuntu:/$ sudo fdisk -l
[sudo] password for mike:
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x42414240

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 63 122093999 122093937 58.2G 7 HPFS/NTFS/exFAT
/dev/sda2 122095614 488396799 366301186 174.7G 5 Extended
/dev/sda5 122095616 297876865 175781250 83.8G 83 Linux
/dev/sda6 480014336 488396799 8382464 4G 82 Linux swap / Solaris
/dev/sda7 297877504 480006143 182128640 86.9G 83 Linux

Partition table entries are not in disk order.

So fdisk sees /dev/sda5, but cd and defragfs don’t. Duh? What am I missing?

Sorry Mike, but I’m not happy providing help with a command I don’t know much about that could potentially do damage.

OK Mark, that’s fair enough. Thank you.

It’s academic anyway, as I’ll be replacing the disk with an SSD shortly.

Thanks for your input, as always.

M

You’ll be glad you did … but there’s no going back to a spinner once you’ve tried an SSD :slight_smile: