public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] resizing and moving home directory to new partition on save drive
@ 2021-01-10 21:42 thelma
  2021-01-10 22:46 ` antlists
  0 siblings, 1 reply; 12+ messages in thread
From: thelma @ 2021-01-10 21:42 UTC (permalink / raw
  To: Gentoo mailing list

I want to move /home directory to a new partition (save drive). 

I have 1-SSD drive:
Filesystem      Size  Used Avail Use% 
/dev/sda4       916G  405G  464G  47% /  


Home directory is on it taking about 360GB

I was planning doing it in stages.

Stage-1
Using Gparted to resize "/" portion shirk it to about 450GB
create new ext4 partition  for /home /dev/sda5

Boot-strap the PC with live-gentoo 
mv /home /home.org
mkdir /home
mount ext4 /dev/sda5 /home/

cp -rp /home.org/*  /home/

edit fstab:
/dev/sda5	/home	ext4    default  0  0
reboot and test home

Am I missing something?
If everything works, remove /home.org

Stage-2:
With Gparted resize both root and home portion, giving root about 200GB and rest to /home (dev/sda5)



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on save drive
  2021-01-10 21:42 [gentoo-user] resizing and moving home directory to new partition on save drive thelma
@ 2021-01-10 22:46 ` antlists
  2021-01-11  0:31   ` thelma
  2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
  0 siblings, 2 replies; 12+ messages in thread
From: antlists @ 2021-01-10 22:46 UTC (permalink / raw
  To: gentoo-user

On 10/01/2021 21:42, thelma@sys-concept.com wrote:
> I want to move /home directory to a new partition (save drive).
> 
> I have 1-SSD drive:
> Filesystem      Size  Used Avail Use%
> /dev/sda4       916G  405G  464G  47% /
> 
> 
> Home directory is on it taking about 360GB
> 
> I was planning doing it in stages.
> 
> Stage-1
> Using Gparted to resize "/" portion shirk it to about 450GB
> create new ext4 partition  for /home /dev/sda5
> 
> Boot-strap the PC with live-gentoo
> mv /home /home.org
> mkdir /home
> mount ext4 /dev/sda5 /home/
> 
> cp -rp /home.org/*  /home/
> 
> edit fstab:
> /dev/sda5	/home	ext4    default  0  0
> reboot and test home
> 
> Am I missing something?

Couple of things.

Firstly, why use a gentoo live disk? Just log in as root.

Secondly, why rename home? Just mount sda5 on /mnt to do the move, then 
add it to fstab to mount on /home.

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.

> If everything works, remove /home.org
> 
> Stage-2:
> With Gparted resize both root and home portion, giving root about 200GB and rest to /home (dev/sda5)
> 
The other way to do it is if you've got a spare hard drive lying around. 
Just copy /home onto it (bearing in mind my comment about root's home), 
and then copy it back.

But what do you mean by "save drive"? Just splitting the drive into 2 
partitions won't do anything, will it? If you want to "save the drive" I 
think you need to move /home to spinning rust :-) Unless you're 
physically updating the hardware, I wouldn't bother.
> 
Cheers,
Wol


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on save drive
  2021-01-10 22:46 ` antlists
@ 2021-01-11  0:31   ` thelma
  2021-01-11  1:57     ` Wols Lists
  2021-01-11 13:51     ` Neil Bothwick
  2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
  1 sibling, 2 replies; 12+ messages in thread
From: thelma @ 2021-01-11  0:31 UTC (permalink / raw
  To: gentoo-user

On 1/10/21 3:46 PM, antlists wrote:
> On 10/01/2021 21:42, thelma@sys-concept.com wrote:
>> I want to move /home directory to a new partition (save drive).
>>
>> I have 1-SSD drive:
>> Filesystem      Size  Used Avail Use%
>> /dev/sda4       916G  405G  464G  47% /
>>
>>
>> Home directory is on it taking about 360GB
>>
>> I was planning doing it in stages.
>>
>> Stage-1
>> Using Gparted to resize "/" portion shirk it to about 450GB
>> create new ext4 partition  for /home /dev/sda5
>>
>> Boot-strap the PC with live-gentoo
>> mv /home /home.org
>> mkdir /home
>> mount ext4 /dev/sda5 /home/
>>
>> cp -rp /home.org/*  /home/
>>
>> edit fstab:
>> /dev/sda5    /home    ext4    default  0  0
>> reboot and test home
>>
>> Am I missing something?
> 
> Couple of things.
> 
> Firstly, why use a gentoo live disk? Just log in as root.
> 
> Secondly, why rename home? Just mount sda5 on /mnt to do the move, then add it to fstab to mount on /home.
> 
> 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.

Can you elaborate pls.?
My current "home" is in "/"; so why move it there, it is already there.  
I don't have extra disk around, but I could copy /home over network to another PC.

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.
My old installation is: 
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)

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.
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. 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on save drive
  2021-01-11  1:57     ` Wols Lists
@ 2021-01-11  1:33       ` thelma
  0 siblings, 0 replies; 12+ messages in thread
From: thelma @ 2021-01-11  1:33 UTC (permalink / raw
  To: gentoo-user

On 1/10/21 6:57 PM, Wols Lists wrote:
> On 11/01/21 00:31, thelma@sys-concept.com wrote:
>> On 1/10/21 3:46 PM, antlists wrote:
>>> On 10/01/2021 21:42, thelma@sys-concept.com wrote:
>>>> I want to move /home directory to a new partition (save drive).
>>>>
>>>> I have 1-SSD drive:
>>>> Filesystem      Size  Used Avail Use%
>>>> /dev/sda4       916G  405G  464G  47% /
>>>>
>>>>
>>>> Home directory is on it taking about 360GB
>>>>
>>>> I was planning doing it in stages.
>>>>
>>>> Stage-1
>>>> Using Gparted to resize "/" portion shirk it to about 450GB
>>>> create new ext4 partition  for /home /dev/sda5
>>>>
>>>> Boot-strap the PC with live-gentoo
>>>> mv /home /home.org
>>>> mkdir /home
>>>> mount ext4 /dev/sda5 /home/
>>>>
>>>> cp -rp /home.org/*  /home/
>>>>
>>>> edit fstab:
>>>> /dev/sda5    /home    ext4    default  0  0
>>>> reboot and test home
>>>>
>>>> Am I missing something?
>>>
>>> Couple of things.
>>>
>>> Firstly, why use a gentoo live disk? Just log in as root.
>>>
>>> Secondly, why rename home? Just mount sda5 on /mnt to do the move, then add it to fstab to mount on /home.
>>>
>>> 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.
>>
>> Can you elaborate pls.?
>> My current "home" is in "/"; so why move it there, it is already there.  
>> I don't have extra disk around, but I could copy /home over network to another PC.
> 
> Are you logging in as root?! THAT'S DANGEROUS!
> 
> Probably not, you are probably misunderstanding me.
> 
> I've just checked, on my system, root's home is /root, which is as it
> should be. Is your home /home/username, or is it /username? You make it
> sound like it's /username, which I don't think is what you mean ...
>>
>> 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.
>> My old installation is: 
>> 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)
>>
>> 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.
>> 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. 
>>
>>
> Ahh ... you didn't say that! That changes everything!
> 
> Okay. I would look to free about 380GB (just enough) at the end of the
> disk to create sda5 which will be (at least temporarily) your new /home.
> LOGGED IN AS ROOT just mount that on /mnt, and copy the contents of
> /home into it.
> 
> Now using your gentoo install disk delete sda4 and split it into two -
> your new sda4 for your new gentoo, and a new sda5 (AT LEAST as big as
> one you created in the last step), which will shunt the partition you
> just created into sda6. Install your new gentoo.
> 
> Now you've got sda4 (/), sda5 (which will be /home), and sda6 (where
> you've just copied your old /home). Mount sda6 on /mnt again, and copy
> it to /home (sda5).
> 
> Finally, delete sda6, extend sda5 to use the space you've just freed,
> and expand the filesystem on /home to use the full size of the extended
> partition.
> 
> That'll probably leave you with a 150GB /root, but that'll be plenty I
> expect (and a 760GB /home).
> 
> Cheers,
> Wol
> 

Thank you, that will work too!


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on save drive
  2021-01-11  0:31   ` thelma
@ 2021-01-11  1:57     ` Wols Lists
  2021-01-11  1:33       ` thelma
  2021-01-11 13:51     ` Neil Bothwick
  1 sibling, 1 reply; 12+ messages in thread
From: Wols Lists @ 2021-01-11  1:57 UTC (permalink / raw
  To: gentoo-user

On 11/01/21 00:31, thelma@sys-concept.com wrote:
> On 1/10/21 3:46 PM, antlists wrote:
>> On 10/01/2021 21:42, thelma@sys-concept.com wrote:
>>> I want to move /home directory to a new partition (save drive).
>>>
>>> I have 1-SSD drive:
>>> Filesystem      Size  Used Avail Use%
>>> /dev/sda4       916G  405G  464G  47% /
>>>
>>>
>>> Home directory is on it taking about 360GB
>>>
>>> I was planning doing it in stages.
>>>
>>> Stage-1
>>> Using Gparted to resize "/" portion shirk it to about 450GB
>>> create new ext4 partition  for /home /dev/sda5
>>>
>>> Boot-strap the PC with live-gentoo
>>> mv /home /home.org
>>> mkdir /home
>>> mount ext4 /dev/sda5 /home/
>>>
>>> cp -rp /home.org/*  /home/
>>>
>>> edit fstab:
>>> /dev/sda5    /home    ext4    default  0  0
>>> reboot and test home
>>>
>>> Am I missing something?
>>
>> Couple of things.
>>
>> Firstly, why use a gentoo live disk? Just log in as root.
>>
>> Secondly, why rename home? Just mount sda5 on /mnt to do the move, then add it to fstab to mount on /home.
>>
>> 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.
> 
> Can you elaborate pls.?
> My current "home" is in "/"; so why move it there, it is already there.  
> I don't have extra disk around, but I could copy /home over network to another PC.

Are you logging in as root?! THAT'S DANGEROUS!

Probably not, you are probably misunderstanding me.

I've just checked, on my system, root's home is /root, which is as it
should be. Is your home /home/username, or is it /username? You make it
sound like it's /username, which I don't think is what you mean ...
> 
> 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.
> My old installation is: 
> 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)
> 
> 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.
> 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. 
> 
> 
Ahh ... you didn't say that! That changes everything!

Okay. I would look to free about 380GB (just enough) at the end of the
disk to create sda5 which will be (at least temporarily) your new /home.
LOGGED IN AS ROOT just mount that on /mnt, and copy the contents of
/home into it.

Now using your gentoo install disk delete sda4 and split it into two -
your new sda4 for your new gentoo, and a new sda5 (AT LEAST as big as
one you created in the last step), which will shunt the partition you
just created into sda6. Install your new gentoo.

Now you've got sda4 (/), sda5 (which will be /home), and sda6 (where
you've just copied your old /home). Mount sda6 on /mnt again, and copy
it to /home (sda5).

Finally, delete sda6, extend sda5 to use the space you've just freed,
and expand the filesystem on /home to use the full size of the extended
partition.

That'll probably leave you with a 150GB /root, but that'll be plenty I
expect (and a 760GB /home).

Cheers,
Wol


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-10 22:46 ` antlists
  2021-01-11  0:31   ` thelma
@ 2021-01-11  4:06   ` thelma
  2021-01-11  4:26     ` Adam Carter
                       ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: thelma @ 2021-01-11  4:06 UTC (permalink / raw
  To: gentoo-user

On 1/10/21 3:46 PM, antlists wrote:
> 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.

Can I use "nano" to edit /etc/password file 
all I need to change is the 
user:x:1000:1000::/home/user:/bin/bash

to:
user:x:1000:1000::/mnt/home/user:/bin/bash

Or I need to use:  "vipw -s"


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
@ 2021-01-11  4:26     ` Adam Carter
  2021-01-11  5:13       ` thelma
  2021-01-11  7:58     ` Raffaele BELARDI
  2021-01-11 11:30     ` Wols Lists
  2 siblings, 1 reply; 12+ messages in thread
From: Adam Carter @ 2021-01-11  4:26 UTC (permalink / raw
  To: Gentoo User

[-- Attachment #1: Type: text/plain, Size: 98 bytes --]

>
> Can I use "nano" to edit /etc/password file
>

Yes, but it's generally safest to use usermod.

[-- Attachment #2: Type: text/html, Size: 353 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-11  4:26     ` Adam Carter
@ 2021-01-11  5:13       ` thelma
  2021-01-11  8:41         ` Adam Carter
  0 siblings, 1 reply; 12+ messages in thread
From: thelma @ 2021-01-11  5:13 UTC (permalink / raw
  To: gentoo-user

On 1/10/21 9:26 PM, Adam Carter wrote:
>>
>> Can I use "nano" to edit /etc/password file
>>
> 
> Yes, but it's generally safest to use usermod.

When I try to  use 
usermod -d /mnt/home/thelma -m thelma
I get:
usermod: user thelma is currently used by process 3037

Do I need to boot strap for this to work?


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
  2021-01-11  4:26     ` Adam Carter
@ 2021-01-11  7:58     ` Raffaele BELARDI
  2021-01-11 11:30     ` Wols Lists
  2 siblings, 0 replies; 12+ messages in thread
From: Raffaele BELARDI @ 2021-01-11  7:58 UTC (permalink / raw
  To: gentoo-user@lists.gentoo.org

> -----Original Message-----
> From: thelma@sys-concept.com <thelma@sys-concept.com>
> Sent: Monday, January 11, 2021 05:07
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] resizing and moving home directory to new
> partition on same drive
> 
> Can I use "nano" to edit /etc/password file all I need to change is the
> user:x:1000:1000::/home/user:/bin/bash
> 
> to:
> user:x:1000:1000::/mnt/home/user:/bin/bash
> 
> Or I need to use:  "vipw -s"

I've always used vi for those, but only because I did not know there was a dedicated command! Anyway, these look like wrappers that set a lock and then invoke your editor. I suppose that in a single user, single admin environment it does not make much difference using nano vs vipw. BTW I don't think you'd need -s with vipw, the shadow file only contains password-related info which you do not want to change.

raffaele

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-11  5:13       ` thelma
@ 2021-01-11  8:41         ` Adam Carter
  0 siblings, 0 replies; 12+ messages in thread
From: Adam Carter @ 2021-01-11  8:41 UTC (permalink / raw
  To: Gentoo User

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

>
> When I try to  use
> usermod -d /mnt/home/thelma -m thelma
> I get:
> usermod: user thelma is currently used by process 3037
>

Is 3037 an instance of bash running as thelma?

If so, try logging out that user then run the usermod command as root (not
thelma su'd to root)

[-- Attachment #2: Type: text/html, Size: 530 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on same drive
  2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
  2021-01-11  4:26     ` Adam Carter
  2021-01-11  7:58     ` Raffaele BELARDI
@ 2021-01-11 11:30     ` Wols Lists
  2 siblings, 0 replies; 12+ messages in thread
From: Wols Lists @ 2021-01-11 11:30 UTC (permalink / raw
  To: gentoo-user

On 11/01/21 04:06, thelma@sys-concept.com wrote:
> On 1/10/21 3:46 PM, antlists wrote:
>> 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.
> 
> Can I use "nano" to edit /etc/password file 
> all I need to change is the 
> user:x:1000:1000::/home/user:/bin/bash
> 
> to:
> user:x:1000:1000::/mnt/home/user:/bin/bash
> 
> Or I need to use:  "vipw -s"
> 
No - if you follow my suggestion you don't need to change anything. Just
make sure, before you wipe your old install you know which user numbers
are used for "user" - here it's 1000, and "thelma" if you've got a user
called thelma.

What I was worried about was you might have a line

0:x:0:0::/home/root:/bin/bash

What THAT line should be is

0:x:0:0::/root:/bin/bash

but it probably already is. You seem to be confusing the root user and
yourself - you need to get that straight in your head because if you
don't you're likely to give yourself some nasty shocks.

Cheers,
Wol


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] resizing and moving home directory to new partition on save drive
  2021-01-11  0:31   ` thelma
  2021-01-11  1:57     ` Wols Lists
@ 2021-01-11 13:51     ` Neil Bothwick
  1 sibling, 0 replies; 12+ messages in thread
From: Neil Bothwick @ 2021-01-11 13:51 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

On Sun, 10 Jan 2021 17:31:05 -0700, thelma@sys-concept.com wrote:

> 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. My old installation is: 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)
> 
> 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.

Or you could simply delete everything but home from /, then install to
that partition. While it is nice to have /home on a separate filesystem,
and it's generally how I do things on a desktop, moving it is a lot of
work just to reinstall.


-- 
Neil Bothwick

New Intel opcode #007 PUKE: Put unmeaningful keywords everywhere

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-01-11 13:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-10 21:42 [gentoo-user] resizing and moving home directory to new partition on save drive thelma
2021-01-10 22:46 ` antlists
2021-01-11  0:31   ` thelma
2021-01-11  1:57     ` Wols Lists
2021-01-11  1:33       ` thelma
2021-01-11 13:51     ` Neil Bothwick
2021-01-11  4:06   ` [gentoo-user] resizing and moving home directory to new partition on same drive thelma
2021-01-11  4:26     ` Adam Carter
2021-01-11  5:13       ` thelma
2021-01-11  8:41         ` Adam Carter
2021-01-11  7:58     ` Raffaele BELARDI
2021-01-11 11:30     ` Wols Lists

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox