Gentoo Archives: gentoo-user

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