Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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;

  1. Format/Partition New drive
  2. Mount drive under temp folder /tempfolder
  3. Copy contents of /home to /tempfolder
  4. Edit Mount to location of /home instead of /tempfolder
share|improve this question
    
I hope you don't actually have just one hard drive that all those important files are on... I sure hope that one drive isn't a consumer grade 7200 RPM SATA disk that's estimated to be 10-100x more likely to die over the next several years... And that you're using a drive rated for running 24x7 as it will be in a server... Right? –  Chris S Jun 18 '12 at 12:40
    
... and that there are proper backups somewhere else, too ... –  Janne Pikkarainen Jun 18 '12 at 12:46
    
Don't worry this is not a production file server. :D But thanks. –  SamCulley Jun 18 '12 at 13:03

3 Answers 3

up vote 2 down vote accepted

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

pvcreate /dev/your_new_disk
vgextend VolGroup01 /dev/your_new_disk
lvextend -l+%100FREE VolGroup01/LogVol00
resize2fs /dev/mapper/VolGroup01-LogVol00 

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?

share|improve this answer
    
I think option might be more suitable, I will read more about LVM in CentOS thanks. Yes I have backups. :) –  SamCulley Jun 18 '12 at 13:08

Do you think I will have to copy all the users folders onto the new drive before I edit the mount point in fstab.

Yes, I would do this (rather like how you suggested):

  1. Mount the new 1TB disk on /newhome
  2. use rsync -auvz --progress /home/ /newhome/ to copy the data
  3. Swap the mountpoints
  4. Make a final rsync to make sure any new data is also copied

If 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).

share|improve this answer
    
+1 rsync for the "copy" mechanism. –  Chris S Jun 18 '12 at 12:39
    
Thanks for replying, Yes this is what I was planning on doing. Thanks for the tip on mounting as read-only for the final copy. –  SamCulley Jun 18 '12 at 13:03

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".

share|improve this answer
    
thanks for taking the time to read my post, I usually use rsync -avnz does the trick :D –  SamCulley Jun 18 '12 at 13:12
    
-z adds compression, which doesn't help in this case, but it still works :) –  mulaz Jun 18 '12 at 13:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.