[NTLUG:Discuss] moving /home to another disk

Greg Edwards greg at nas-inet.com
Fri Sep 23 20:50:06 CDT 2005


John Thomas wrote:
> I installed a second disk on my machine, and I'd like to put the /home 
> directory on it.
> I thought I could copy /home to the second disk and change fstab thusly:
> /dev/sdb1      /home     ....[other params]
> 
> This returns the message that /home doesn't exist.
> 
> Any suggestions would be appreciated.
> 
> __________________________________
> jathomas  at  tacni.net
> 

I might be late on the discussion.  Just mount the new drive and sym link 
/home to the new mount point.  Linux does not care where it is, just cares 
that it can be located.

example

In fstab

   /dev/sdb1 /opt/homes ext3 defaults 1 2

As root

   cd /home
   find . -print | cpio -pdvm /opt/homes
   cd /
   mv home home.tmp
   ln -s /opt/homes /home

To copy and mount on root, assuming that /home is not a mount point already.

Login as root with nobody else on the box.

In fstab

   /dev/sdb1 /newhome ext3 defaults 1 2

As root

   cd /
   mkdir newhome
   mount /newhome
   cd /home
   find . -print | cpio -pdvm /newhome
   cd /
   umount /newhome
   mv home home.tmp
   mkdir home

In fstab

   /dev/sdb1 /home ext3 defaults 1 2

As root

   mount /home

Now verify everything in the new /home and if all is well delete /home.tmp

Good luck
-- 
Greg Edwards
New Age Software, Inc. - Software Engineering Services
http://www.nas-inet.com




More information about the Discuss mailing list