Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Move /home partition

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
leonchik1976
Guru
Guru
Posts: 344
Joined: Sun Jan 24, 2010 1:28 pm

Move /home partition

  • Quote

Post by leonchik1976 » Sat Jan 23, 2021 1:21 pm

I don't have separate /home partition, and running out of space, so i want to move it to another drive, and make this /home partition.
Is enough to perform "mv -r * new partition", and then mount a new partition as /home, or it's a more than this?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56084
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Jan 23, 2021 2:28 pm

leonchik1976,

It takes a bit of care because /home must not be in use. Any open files will not be copied correctly.
To make sure home is not in use log in as root directly. Logging in as a normal user requires /home to be in use.

To be safe issue the sync command then remount /home as read only. If that fails, there are files open on home.
Mount the replacement home somewhere, say /mnt/newhome
cp -a the old to the new.

You can't use mv with /home being ro.
To keep your sanity,

Code: Select all

touch /mnt/newhome/newhome
so you can tell the two different /homes apart.

unmount /mnt/newhome anh mount it over the top of the existing home.
Log is as a normal user and you should have a /home/newhome file.
If everything works, update /etc/fstab then reboot to test. /home/newhome should still be there.

Run like that for a few days, then you can delete the content of the old /home.
Before you issue the rm command do check that newhome is missing.

If you use mv directly and it fails for any reason, it leaves you in a mess.
The above process is safer because its non destructive until the result is tested.
You have backups anyway, don't you?
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
leonchik1976
Guru
Guru
Posts: 344
Joined: Sun Jan 24, 2010 1:28 pm

  • Quote

Post by leonchik1976 » Sat Jan 23, 2021 3:28 pm

NeddySeagoon wrote:leonchik1976,

It takes a bit of care because /home must not be in use. Any open files will not be copied correctly.
To make sure home is not in use log in as root directly. Logging in as a normal user requires /home to be in use.

To be safe issue the sync command then remount /home as read only. If that fails, there are files open on home.
Mount the replacement home somewhere, say /mnt/newhome
cp -a the old to the new.

You can't use mv with /home being ro.
To keep your sanity,

Code: Select all

touch /mnt/newhome/newhome
so you can tell the two different /homes apart.

unmount /mnt/newhome anh mount it over the top of the existing home.
Log is as a normal user and you should have a /home/newhome file.
If everything works, update /etc/fstab then reboot to test. /home/newhome should still be there.

Run like that for a few days, then you can delete the content of the old /home.
Before you issue the rm command do check that newhome is missing.

If you use mv directly and it fails for any reason, it leaves you in a mess.
The above process is safer because its non destructive until the result is tested.
You have backups anyway, don't you?
yes, will try it, thanks
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Sun Jan 24, 2021 4:07 am

Just restore /home from a fresh backup to the new partition. Then, when not logged in as a user, rename your existing /home and mount your new /home. Don't actually delete your old home until you are happy with your new home.

If you don't have a fresh backup of /home, you are living too dangerously and also unwisely.

Alternatively, analyze what in your /home directory is taking up too much space. Leave the home directory intact, and just move the Photos, Movies, Audio, your Wife, other Users etc to an alternate partition and create a symlink or symlinks from the /home directory location to the new alternate location.

For example, I keep about half of my personal /home directory files in alternate directories in /scratch/. For my convenience, these are symlinked from my real /home directories. Best example is /scratch/Downloads is the real directory and the symlink is /home/USERNAME/Downloads. Adjust to suit your needs and situation.

At home and on supported remote systems, all user's home directories are backed up automatically, overnight, weekly, and monthly, in rotating files to both secondary hard drives and those backups are further copied to a server from which off-site copies are made weekly. Not perfect, but better than most. Business critical files are backed up off-site nightly.
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
Post Reply

4 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic