LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-06-2023, 10:52 AM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Location: Iowa
Distribution: Debian distro family
Posts: 2,379

Rep: Reputation: Disabled
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.
 
Old 01-06-2023, 03:43 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,790

Rep: Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951
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

Last edited by michaelk; 01-06-2023 at 03:45 PM.
 
1 members found this post helpful.
Old 01-08-2023, 12:09 AM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by michaelk View Post
<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?
 
Old 01-08-2023, 01:19 AM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,881
Blog Entries: 1

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
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.
 
Old 01-08-2023, 03:51 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,058

Rep: Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349
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.
 
Old 01-08-2023, 01:23 PM   #6
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 498

Rep: Reputation: 182Reputation: 182
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.

Last edited by rclark; 01-08-2023 at 01:27 PM.
 
Old 01-08-2023, 02:04 PM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,365
Blog Entries: 3

Rep: Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767
Quote:
Originally Posted by rclark View Post
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.
 
Old 01-08-2023, 02:25 PM   #8
Debian6to11
Member
 
Registered: Jan 2022
Location: Limassol, Cyprus
Distribution: Debian
Posts: 382
Blog Entries: 1

Rep: Reputation: 71
DJ Ware has a nice video on YouTube of what rclark is promoting. The method is easy and quick but it is not recommended for newbies.

Though unless you are on a busy system that you have to keep it on all times, using a live distro makes it less of a hassle.
 
Old 01-08-2023, 07:39 PM   #9
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by mrmazda View Post
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.
 
Old 01-09-2023, 04:23 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,058

Rep: Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349Reputation: 7349
Quote:
Originally Posted by rclark View Post
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.
 
Old 01-09-2023, 04:42 PM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,693
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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 without downtime.

Last edited by sundialsvcs; 01-09-2023 at 04:44 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I replace /home on one drive with a different /home from another? Sol33t303 Linux - Newbie 3 10-04-2017 12:00 PM
Set home directory path different from LDAP's home sukitars Linux - Server 0 11-19-2014 10:46 PM
[SOLVED] how to create a single home from two different partitions on different drives? Monk Tea Slackware 7 09-14-2014 07:56 AM
Have /home on another partition. Want to use on Lenny JosephS Debian 5 01-31-2010 10:32 PM
mount / , /home , /home/usr on different partitions alekoos Slackware 14 05-03-2004 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration