Results 1 to 4 of 4

Thread: Replacing /Home partition and drive...

  1. #1

    Default Replacing /Home partition and drive...

    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 .

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,763
    Blog Entries
    14

    Default Re: Replacing /Home partition and drive...

    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
    Code:
    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
    Code:
    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.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: Replacing /Home partition and drive...

    Thank you Knurpht, that worked perfectly for me.

  4. #4

    Default Re: Replacing /Home partition and drive...

    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:

    1) Log out all users, switch to a TTY, and log in as root
    2) Mount the new drive somewhere in the filesystem, doesn't matter where
    3) 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
    4) Unmount the old /home (if it was already on a separate partition, otherwise just rename it)
    5) Unmount the new drive and remount it at /home
    6) Log in as a regular user and make sure all is good
    7) Update /etc/fstab to remove the old /home mount (if necessary) and add the new one
    8) 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •