Gentoo Archives: gentoo-user

From: Wols Lists <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] resizing and moving home directory to new partition on save drive
Date: Mon, 11 Jan 2021 01:17:46
Message-Id: 5FFBB074.9010902@youngman.org.uk
In Reply to: Re: [gentoo-user] resizing and moving home directory to new partition on save drive by thelma@sys-concept.com
1 On 11/01/21 00:31, thelma@×××××××××××.com wrote:
2 > On 1/10/21 3:46 PM, antlists wrote:
3 >> On 10/01/2021 21:42, thelma@×××××××××××.com wrote:
4 >>> I want to move /home directory to a new partition (save drive).
5 >>>
6 >>> I have 1-SSD drive:
7 >>> Filesystem Size Used Avail Use%
8 >>> /dev/sda4 916G 405G 464G 47% /
9 >>>
10 >>>
11 >>> Home directory is on it taking about 360GB
12 >>>
13 >>> I was planning doing it in stages.
14 >>>
15 >>> Stage-1
16 >>> Using Gparted to resize "/" portion shirk it to about 450GB
17 >>> create new ext4 partition for /home /dev/sda5
18 >>>
19 >>> Boot-strap the PC with live-gentoo
20 >>> mv /home /home.org
21 >>> mkdir /home
22 >>> mount ext4 /dev/sda5 /home/
23 >>>
24 >>> cp -rp /home.org/* /home/
25 >>>
26 >>> edit fstab:
27 >>> /dev/sda5 /home ext4 default 0 0
28 >>> reboot and test home
29 >>>
30 >>> Am I missing something?
31 >>
32 >> Couple of things.
33 >>
34 >> Firstly, why use a gentoo live disk? Just log in as root.
35 >>
36 >> Secondly, why rename home? Just mount sda5 on /mnt to do the move, then add it to fstab to mount on /home.
37 >>
38 >> And a little bit you might have missed - DON'T put root's home on a mounted disk - if it's currently in /home, move it to /. Don't forget to edit /etc/passwd if you have to move it.
39 >
40 > Can you elaborate pls.?
41 > My current "home" is in "/"; so why move it there, it is already there.
42 > I don't have extra disk around, but I could copy /home over network to another PC.
43
44 Are you logging in as root?! THAT'S DANGEROUS!
45
46 Probably not, you are probably misunderstanding me.
47
48 I've just checked, on my system, root's home is /root, which is as it
49 should be. Is your home /home/username, or is it /username? You make it
50 sound like it's /username, which I don't think is what you mean ...
51 >
52 > I was planning to move "home" to another partition as I plan to wipe old installation (it is impossible for me to upgrade); it will be easier to reinstall.
53 > My old installation is:
54 > Portage 2.3.24 (python 3.5.4-final-0, default/linux/amd64/17.0/desktop, gcc-6.4.0, glibc-2.25-r10, 4.9.72-gentoo x86_64)
55 >
56 > Since, old installation has home or "/" (root) partition, if I wipe the root, home will be gone as well. So I was planning on moving "home" to another partition, this way all data will be there.
57 > So, after moving "home" to another partition "sda5" I can wipe the "sda4" and re-install gentoo. "home" data would not be touched by upgrade.
58 >
59 >
60 Ahh ... you didn't say that! That changes everything!
61
62 Okay. I would look to free about 380GB (just enough) at the end of the
63 disk to create sda5 which will be (at least temporarily) your new /home.
64 LOGGED IN AS ROOT just mount that on /mnt, and copy the contents of
65 /home into it.
66
67 Now using your gentoo install disk delete sda4 and split it into two -
68 your new sda4 for your new gentoo, and a new sda5 (AT LEAST as big as
69 one you created in the last step), which will shunt the partition you
70 just created into sda6. Install your new gentoo.
71
72 Now you've got sda4 (/), sda5 (which will be /home), and sda6 (where
73 you've just copied your old /home). Mount sda6 on /mnt again, and copy
74 it to /home (sda5).
75
76 Finally, delete sda6, extend sda5 to use the space you've just freed,
77 and expand the filesystem on /home to use the full size of the extended
78 partition.
79
80 That'll probably leave you with a 150GB /root, but that'll be plenty I
81 expect (and a 760GB /home).
82
83 Cheers,
84 Wol

Replies