So, XFS is officially the best file system around at the moment. Why do I say this?
1.) It’s fast, especially when I have around 50,000 3MB-4GB files being pulled by apache for a site almost constantly.
2.) It supports online defragmenting.
3.) When I know the drive is going to fail, backup/restore is a piece of cake.
#3 was the reason for this post.
I had to move a bunch of stuff from one drive to another. Normally this is easy, just move all the said shit.
This is not so easy when it’s / with linux installed on it.
Normally, I’d say fuck my life a lot and have to reinstall everything, since moving an OS is never an easy task. With windows, might as well forget about it. I tried that once, no go at all.
Linux theoretically doesn’t care, which is awesome. The problem I was stuck at was how to do this efficiently, with minimal downtime. This is on a production server after all.
Did some research, found out that normally this would involve firing up a live CD and using dd to mirror image the drive to another one, then adjust the partition size on the new drive since it’s bigger, then expand the file system size to match it. This would have meant close to a day of downtime. Not an option.
XFS saves the day. There’s a few awesome tools that come with it, but not by default, that make this job quick and easy.
How I saved the day with these great tools: xfsdump, xfsrestore, & a Debian Lenny live CD.
1.) Quickly rebooted to the live CD and ran xfsdump to copy the file system to an external.
2.) Quickly rebooted back to the installed version, with only 32 minutes downtime to copy the drive to the external.
3.) While everything was back up, used xfsrestore to put the image onto the hard drive that was getting swapped. Nice thing is, I was able to have the drive pre-partitioned and pre-formatted for this already.
4.) Once done, shutdown and drive swap, followed by another quick boot into the live CD to reinstall grub to the new drive.
5.) Reboot back to the installed version, and everything worked perfectly, with only another 10 minutes of downtime.
So, I replaced the OS drive in under 45 minutes of downtime. Beat that!
So, I was torrenting, and when I came home, Transmission had crashed. Tried to restart it, and it crashed again. Then it hit me…
jmoschetti45@server:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 17G 17G 0 100% /
jmoschetti45@server:~$ rm -rf /var/www/misc/porn
jmoschetti45@server:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 17G 7.6G 9.2G 46% /
It’s funny in a different way as well when you look where the deleted data was…