what if I want to use different partition for /home?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
what if I want to use different partition for /home?
I installed a distro with only the root partition as/home, then later decided no, I want to use a separate partition like I usually do. Please review for me what I must do to set that up: anything besides editing fstab? If it's only that, no problem--I know how.
Oops, this was supposed to be a different thread. Will self-report myself for that purpose.
Last edited by newbiesforever; 01-06-2023 at 10:55 AM.
Thats about it. Might be easier from a live OS or boot to single user mode but basically,
Backup anything important
Create a partition and format
Mount it somewhere and move users directories from old home to new home. Same permissions...
Add fstab line to mount new partition to /home
Reboot
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818
Rep:
Quote:
Originally Posted by michaelk
<snip>
Create a partition and format
Mount it somewhere and move users directories from old home to new home. Same permissions...
Add fstab line to mount new partition to /home
Reboot
Is the reboot strictly necessary? I've done relocations like this and, so long as /etc/fstab has been updated correctly with the new partition info for the next reboot, a simple "mount -a" does the trick. Have I been overlooking something all this time?
Not all tools that read disk partitions will recognize a new partition until after a reboot. Partprobe seems to enable for many, maybe most, but not all.
Probably I'm paranoid, I would use another os (live cd?) to move the content from / (root) to another partition. I would rename the original /home to /home.removed (or something similar) and just copy the content to the new filesystem (and mount that). Finally, if everything is ok, you can really delete /home.removed (or restore if something went wrong).
I would not recommend to modify /home of the living system.
You are paranoid . It is as simple as above. Mount the drive (my preference) or a partition. As root, cp (or use rsync) over /home contents to mount location (say /mnt/adrive) . unmount that partition. setup fstab to point /home to new partition. reboot. If something bad happens you just revert fstab and back to way it was. It's very simple process.
Note, you don't have to remove the original /home. In fact I wouldn't. It is still there if you ever need to go back to it.
You are paranoid . It is as simple as above. Mount the drive (my preference) or a partition. As root, cp (or use rsync) over /home contents to mount location (say /mnt/adrive) . unmount that partition. setup fstab to point /home to new partition. reboot. If something bad happens you just revert fstab and back to way it was. It's very simple process.
Note, you don't have to remove the original /home. In fact I wouldn't. It is still there if you ever need to go back to it.
Yes, that's the process I have used from time to time. Though I'd say to use rsync only and say that it's helpful to log out of all desktop environments first. Perhaps root can be accessed via the console instead, say ctrl-alt-f1 or similar.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818
Rep:
Quote:
Originally Posted by mrmazda
Not all tools that read disk partitions will recognize a new partition until after a reboot. Partprobe seems to enable for many, maybe most, but not all.
Ah. Thanks. That's something that's never come up for me. I guess I rely on "df" and "mount" and have never had any problems seeing new/moved partitions before.
You are paranoid . It is as simple as above. Mount the drive (my preference) or a partition. As root, cp (or use rsync) over /home contents to mount location (say /mnt/adrive) . unmount that partition. setup fstab to point /home to new partition. reboot. If something bad happens you just revert fstab and back to way it was. It's very simple process.
Note, you don't have to remove the original /home. In fact I wouldn't. It is still there if you ever need to go back to it.
Keeping the original home may require a lot of space.
Moving /home while it is in use may cause problems, especially when a user is logged in and use it (even if you run the copy as root). Obviously reboot will [dis]gracefully hide it.
If your computer has LVN = Logical Volume Management installed, as it very likely does, then it is possible to relocate the so-called "storage pool" to which your /home "logical volume" has been assigned to another physical location.
Yes, this "cryptic comment" is intended only as a teaser, but LVM allows you to fundamentally separate the "logical" perspective, as seen by the operating system, from the "physical" one. A storage pool can be mapped to any physical partition or partitions.
LVM also has elegant solutions for other problems, such as: "a physical hard-drive has just begun to make ominous clicking noises." With appropriate preparations, you can actually de-commission the potentially-failing drive withoutdowntime.
Last edited by sundialsvcs; 01-09-2023 at 04:44 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.