Hi all, I have a makeshift server that I have been using for awhile now. I’ve run out of space on the current drives, and need to change one of the drives out. The partition layout is:
64 Gb SSD:
/
/swap
1 Tb drive:
/home
2 Tb drive:
/media/data1
2 Tb drive:
/media/data2
Is there a straight forward way to change out the 1 Tb drive and replace with a 3 Tb drive and copy over the data on the /home partition? I’m familiar with how to install and partition drives, but anticipate missing something when it comes to /home and having everything link up correctly. If a reinstall is the better avenue, then I can probably go that route as well. The server is running 12.1 right now since it has full support for cuda/opencl, but they may not see much if any use in the next few months as that project has been put on the back-burner (hence, I can move to 12.2). Finally, I have all my data (including /home) backed up on a separate machine in a separate building.
Thanks everyone for your help. Sorry if I’m asking rather basic questions, I just don’t want to do something stupid :).
No need to reinstall. Build in the 3TB drive, use Yast to partition and format it (if you want the full 3TB for /home just create one parition), don’t assign a mount point to it yet. Remeber it’s entry in /dev, i.e. /dev/sdX# where X is an alphabetic, # a numeric char.
Now logout, hit Ctrl-Alt-F7 to go to the console, login as root ( yes, this is an exception), and do
su -
mount /dev/sdX# /mnt
cp -r -v -p /home/* /mnt
this will in a verbose way copy all data on the old partition mounted on /home to the new one, preserving user permissions etc.
Now we unmount the new one
umount /mnt
yast
Use Yast - System - Partitioner to remove the old /home mountpoint, or (temporarily) mount it on /oldhome, and to change the empty mountpoint for the new location to /home. Done.
Note that the above is the general process for swapping out /home on any Linux distro, not just openSUSE. Of course on the others you don’t have YaST, but you can just do those operations on the command line. The idea is the same:
Log out all users, switch to a TTY, and log in as root
Mount the new drive somewhere in the filesystem, doesn’t matter where
Sync the old /home to the new drive. cp works, I typically use rsync -a since it preserves links, end result is usually the same
Unmount the old /home (if it was already on a separate partition, otherwise just rename it)
Unmount the new drive and remount it at /home
Log in as a regular user and make sure all is good
Update /etc/fstab to remove the old /home mount (if necessary) and add the new one
Reboot and make sure all is good
Most of my systems have / on an SSD and /home on a RAID. The installation procedure is to install everything on / initially, then once the OS is up I set up the RAID and follow the above steps to migrate /home onto it. It’s easy and always works well on any Linux distro.