I am using CentOS 5.8 x64bit
I have all my users directories in the /home/ directory, the drive which CentOS is installed along with /home is on
/dev/mapper/VolGroup01-LogVol00
And its getting full I have 12% left. I predict that it will be full within 2 months. So what I was thinking was adding 1TB drive to the server and then remounting /home onto the new drive e.g
/dev/sdd1 917G 1G 916G 1% /home
But I'm running into a few snags here.
Do you think I will have to copy all the users folders onto the new drive before I edit the mount point in fstab
?
So the process might resemble this;
- Format/Partition New drive
- Mount drive under temp folder /tempfolder
- Copy contents of /home to /tempfolder
- Edit Mount to location of /home instead of /tempfolder
Yes, I would do this (rather like how you suggested):
/newhome
rsync -auvz --progress /home/ /newhome/
to copy the datarsync
to make sure any new data is also copiedIf you want to be extra save, mount
/home
read-only (mount -o remount,ro /home
) during the final copy, but this will render the home directories unwritable for a bit (which could be a while if the disk is large).One option you can use is LVM (as your /home seems to be already part of LVM volume). With it you just add the new physical disk to LVM volume group, expand the logical volume and finally expand the filesystem.
On the top of my head, something like
Replace
resize2fs
with the filesystem resizing tool you have, if using something else than ext3/4.This solution is bad in a way that if your original drive dies, there goes your data. But you have regular backups stored somewhere, right?
Yes, that is exactly what you'll have to do.
After copying data, rename the "/home" to "/oldhome" and create a new, empty "/home". If you don't do that, and just mount your new drive, your first drive will still be full, but you won't be able to access the drives in your old "/home", since there is a new drive mounted over it.
PS: while copying, do not forget about preserving permissions etc. I'd do a "rsync -a".