Moving /home from current drive to new drive

I want to move my /home from a 256GB SSD to a NEW 1 TB SSD.

Am I asking for trouble?
Is it going to be a lot of work?

Just dd the entire disk, then expand your partition. Remember to update the partition UUIDs in the relevant places, such as your fstab.

That should be all there’s to it. I did something similar couple week ago without problems on a XFS partition and went from a 2tb nvme into a 4tb one.

2 Likes

dding the entire disk will lead you to duplicate UUIDs, you’ll also be copying unused space.

I don’t understand the advantage over the easier new partition table new file system and copying the files manually with tar / dump / zfs send. It’s very little work.

1 Like

Do you have an extra m.2 slot available?

If so, just install the new drive and put the old one in your extra slot. Boot the system, format the new drive as an ext4, and mount it on /mnt (or, if you want to be fancy, create a new directory like /mnt/homedrive). Then just run a regular copy archival command like so: cp -ra /home/* /mnt/homedrive

Finally, just edit fstab to direct /home to the new disk. Done.

There are GUI tools to create automatic mount tools too; if you run Gnome or something based on GTK, check out the Disks utility.

2 Likes

It should be fine.

If you do it from a live USB, or at very least, logged in to the computer with another account, then you should have no issues of files still open.

Please be aware there may be “hidden” files, like “dot” files, so copying the whole folder, instead of files inside, would be better.

Also, once copied, if you Rename the old folder, you can leave it in place just in case.

Member to populate the /etc/fstab with the new /home/georgezilla mount point.

If you copy as root, you may have to recursively chown the folder, and subfolders/files to your username, but that should be as easy as chown -r georgzilla:georgezilla /home/georgezilla

So, I like to reboot the computer, log in as root, format the new drive for my new /home/me, copy my folder across, chown me:me on new folder, rename my old folder, add new mounpoint to fstab, mount -a to check it’s mounted, then test with su me to ensure the correct ~/ is set, and a quick look at files, then if all good, reboot.

Old folder can be compressed for storage/backup/archive after reboot sucessful

What I did was did a fresh install and during partitioning and setup assigned home to the second drive.
works fine!

ok, I’ll do it and mention the noob way out that I would take.

Assuming Ubuntu based distro, “Deja Dup Backups” the home folder to two different places (i.e. two usbs or something) in case one fails. Blow away the distro and start fresh. Restore files. Done.

Please specify:

  • Are you moving everything to the 1TB disk, or is it going to be installed in addition to the 256GB disk?
  • What’s the file system on your current disk, and what plans do you have for a file system on the new one?

Either way, copying your /home folder to the new disk shouldn’t be difficult, it will just take some time. If you are currently using ZFS or btrfs, make a snapshot, and transfer that to the new disk using zfs send resp. btrfs send. You can continue using the computer as normal while this goes on. Otherwise, use sudo rsync -aAX /home/ /path/to/newhome/ to copy the lot, and preferably leave it alone while the copy is ongoing (to ensure integrity).

Once the copy is done, switching to the new /home is a matter of editing your /etc/fstab as root, adding/changing the entry for home. It should probably look something like this:

UUID=partition-or-filesystem-uuid /home filesystem rw,noatime 0 0

Here, partition-or-filesystem-uuid is the UUID of either the file system or the partition the new /home is on; use sudo blkid to find it; filesystem is the file system identifier (ext4, xfs, zfs, btrfs, or whatever); rw,noatime are standard options but you might want/need to add others; 0 0 means the file system will never be checked for integrity at boot but if you use ext4, you may want to use 2 2 instead, meaning that the file system will be checked after the system fs if needed (e.g. after a crash).

Lastly, reboot and enjoy the new /home folder!