Moving /home to another HD: How to?

Hi all…

I’m very new to SUSE but have been using other Linux distros for a few years now. I generally try things out first and then ask questions later, but this time I think I’ll ask first.

I have an old 30 GB IDE drive with my / /swap and /home directories on it. I have another 500 GB SATA drive partitioned 411GB and 38GB. I’d like to move my /home to the 38GB partition and then create some more partitions on the old 30 GB drive to try out some other distros as well.

My df -h output looks like this:

david@linux-3wa0:/> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 11G 9.3G 669M 94% /
udev 2.0G 128K 2.0G 1% /dev
/dev/sda3 16G 2.1G 13G 15% /home
/dev/sdb3 411G 167G 228G 43% /mnt/samsung
/dev/sdb1 38G 176M 36G 1% /home2
/dev/sdc5 230G 20G 198G 10% /mnt/documents
/dev/sdc6 230G 97G 122G 45% /mnt/music
/dev/sdc7 230G 43G 175G 20% /mnt/photos
/dev/sdc8 230G 165G 53G 76% /mnt/videos

I know sda2 looks full, but this should be fixed next time I boot.

My question is: what do I have to do to go about successfully migrating my /home files to /home2? I’ve copied them all over using Krusader and created a lost+found file. My ls -al output for /home and /home2 are identical.

If it were just me, right now, I’d delete /home/ and then repartition sda3; but I have a suspicion that I’m missing something. Am I? What’s the right way to go about trying this?

Any and all help appreciated. I’m very basic with bash but I can manage using the partitioner under YAST and editing my /etc/fstab.

Nothing so drastic. Just edit the line with /home in /etc/fstab to change the partition to that of /home2 and it will be mounted there next time. And remove the current line specifying /home2 of course, or you will be trying to mount that partition at two places. You can then do what you want with the old home at your leisure.

fstab is the key here
just edit accordingly
you might also want to include whatever you do with the old /home

notice how suse id’s drives in fstab now…
but you can still add a drive the old way
ie: sda?..

1. There’s no need to create a lost+found directory, it’s created automatically on Ext3 filesystems.
2. I don’t think copying with Krusader (whatever that is) is a good idea. Probably it has reset all the file ownerships to the user you were logged in as when you did the copy. This will be a problem if there are multiple users having their home directory in /home.

If you are the only user it may be ok, but I would do the copy with something like tar (as root): tar cDf /home - .|tar xDf /home2 -

Pax or cpio also preserve file ownerships like tar. Or there are some options for cp to do this too (cp -p?)

I have done this a number of times in the past. I alway do the following:

  1. Create directory /tmp/newhome
  2. Mount the new HD in that directory
  3. As root I do:
    3.1 I execute: cp -apR /home/. /tmp/newhome
  4. Go in single mode, just in case. (init 1)
  5. Unmount the old /home (umount /home)
  6. Edit the fstab in order to mount the new HD.
  7. Mount the new HD in /home
  8. Create a directory under /mnt as /mnt/oldhome (just in case of problems)
  9. Mount the old HD in /mtn/oldhome
  10. init 5;exit and the new HD is now my new /home.