I have a dynamically expanding VDI file which is 14 GB big while the partition itself is only 2 GB.
The files are too spread out over the disk so zero-ing the free space and compacting the VDI didn't help, if I can get the files too be together on the disk like MyDefrag can do on Windows I can spare out 12 GB.
Steps taken so far:
- Made root partition as small as possible. (NCurses Disk Usage shows only 2 GB left)
zerofreeon the root partition.
- Used the VirtualBox tools to compact the VDI file. (It went from 16 GB -> 14 GB)
The file should be half the size of what it is now...
Info about the disk:
Disk /dev/sda: 536.9 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x837d7521 Device Boot Start End Blocks Id System /dev/sda1 1 5 40131 83 Linux /dev/sda2 6 71 530145 82 Linux swap / Solaris /dev/sda3 72 65270 523710967+ 83 Linux Model: ATA VBOX HARDDISK (scsi) Disk /dev/sda: 537GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 41.1MB 41.1MB primary ext2 2 41.1MB 584MB 543MB primary linux-swap(v1) 3 584MB 537GB 536GB primary ext3 Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 515492812 2443136 486864128 1% /
I'm currently trying to defragment it, then I'll do the zerofree and compact steps again.
This might work...
Total Files: 178174 Fragmented Files: 25881 File Fragmentation Rate: 14.5256883720408% Avg File Fragments(1 is best): 1.16055653462346
But does it?
Done! Now lets see the results... Statistics for / Total Files: 0 Fragmented Files: 0 Illegal division by zero at /usr/sbin/defragfs line 193.
Ouch, fail... It broke my install (kernel panic), I think I still have a back-up of a month ago.
Don't worry about it, I only have to
emerge --sync; emerge -Du world; svn up on the back-up...
I currently use it for native Linux developing only, that's why I need it to be 3 GB and not 14 GB.