You are not logged in.

#1 2015-09-06 08:47:27

3p1k5auc3
Member
Registered: 2015-05-01
Posts: 30

[SOLVED]Move home to new partition

Hey, I have plans to install a couple other distros alongside my current Arch install. My current partition setup is as follows:
    sda1 -- boot  - 1mb
    sda2 -- swap - 4gb
    sda3 -- root   - 927gb
My problem is that I can't resize my home partition because my root folder is on it. I understand that I could resize it if I booted from a liveCD, but I would like to move it to its own partition just in case something goes wrong in the future. Can someone please explain how to do this?

Last edited by 3p1k5auc3 (2015-09-10 06:35:01)


Real programmers use a magnet and a steady hand.

Offline

#2 2015-09-06 10:26:30

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,872
Website

Re: [SOLVED]Move home to new partition

1MB for boot? Is that a typo? You won't even fit a kernel on that..

Personally, I think your thinking is backward here. Instead of thinking of it as though you have root on your home partition, you should be looking at it as though your home is on your root partition. Don't try to relocate root, move home. It's less hassle.

You are right in thinking that you will need to use a liveCD to resize the existing partition. Depending on your proficiency using CLI  partition manipulation tools, you may be better off using a liveCD with a graphical user interface+gparted, rather than an Arch liveCD.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-09-06 10:33:18

alex.theoto
Member
From: Athens Greece
Registered: 2014-11-30
Posts: 307

Re: [SOLVED]Move home to new partition

Maybe I'm wrong but keep in mind that if you resize or create new partiotions, the /dev/disk/by-uuid/... will change so you have to fix the /etc/fstab or grub.

Offline

#4 2015-09-06 11:12:31

3p1k5auc3
Member
Registered: 2015-05-01
Posts: 30

Re: [SOLVED]Move home to new partition

By boot I mean that is where Grub is installed. In GParted it says Name = boot and Label = boot; Flags are grub_bios. To move home, do I boot into a liveCD, resize the partition, and just cp /home over? Are there any other folders I should move? Thanks for your quck response.


Real programmers use a magnet and a steady hand.

Offline

#5 2015-09-06 11:22:50

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED]Move home to new partition

3p1k5auc3 wrote:

By boot I mean that is where Grub is installed. In GParted it says Name = boot and Label = boot; Flags are grub_bios.

That's a BIOS boot partition and only contains the GRUB binary (ie, it is not part of your filesystem) wink

3p1k5auc3 wrote:

To move home, do I boot into a liveCD, resize the partition, and just cp /home over?

I would recommend using `rsync -aAXv $SOURCE $TARGET` to preserve symbolic links, permissions and ownerships, modification times, ACLs and extended attributes.

You will also have to modify your fstab to reflect this change.

Last edited by Head_on_a_Stick (2015-09-06 11:23:16)

Offline

#6 2015-09-06 11:47:49

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED]Move home to new partition

+1 for rync from live media.  You can add a -P to that if you want to see progress.  Update fstab when finished and regenerate your grub.cfg with from a chroot with all relevant partitions mounted (ie /boot).

Last edited by graysky (2015-09-06 11:48:27)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2015-09-07 06:48:49

3p1k5auc3
Member
Registered: 2015-05-01
Posts: 30

Re: [SOLVED]Move home to new partition

So I have repartitioned my disk using the Gparted liveCD. My new partitions are as follows:

    /dev/sda1 -- BIOS boot -- 1mb
    /dev/sda2 -- Swap -- 4GB
    /dev/sda3 -- Everything else - 534 GB
    /dev/sda4 -- Partition I'm moving home to -- 50GB
    343 GB of empty space left

So if I'm going to be moving /home from /dev/sda3 to /sda4, would I just do `rsync -aAXv /home /dev/sda4`?

EDIT: Fixed typo

Last edited by 3p1k5auc3 (2015-09-07 06:49:16)


Real programmers use a magnet and a steady hand.

Offline

#8 2015-09-07 06:54:47

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,872
Website

Re: [SOLVED]Move home to new partition

No, you need to mount /dev/sda4 somewhere, e.g. /mnt. If you're still in the LiveCD environment, you will also need to mount your root partition too -- you don't want to copy the liveCD's /home.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2015-09-07 07:10:28

3p1k5auc3
Member
Registered: 2015-05-01
Posts: 30

Re: [SOLVED]Move home to new partition

Alright, so assuming I'm in my Arch install and not in the liveCD I would, as an example, mount /dev/sda4 to /mnt, then do `rsync -aAXv /home /mnt`?
Also, a few more questions. Because I plan to install a few more distros on some other partitions, is there any reason to have a separate root partition for each, or would it be fine to have everything on one partition for the others because I have my Arch root on its own partition, and I understand that I need to regen my fstab and I have heard I need to regen GRUB too. I'm not sure how to regen GRUB, but for fstab would I just run genfstab?


Real programmers use a magnet and a steady hand.

Offline

#10 2015-09-07 07:17:11

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED]Move home to new partition

3p1k5auc3 wrote:

for fstab would I just run genfstab?

No, write the entry yourself -- read fstab(5) & mount(8)

For GRUB, use the same command you used when you installed Arch.

Offline

#11 2015-09-07 07:37:51

3p1k5auc3
Member
Registered: 2015-05-01
Posts: 30

Re: [SOLVED]Move home to new partition

My new fstab is as follows:

    /dev/sda3    /               ext4    rw,relatime,data=ordered    0 1
    /dev/sda4    /home     ext4    rw,relatime,data=ordered    0 0

and I ran mkinitcpio -p linux

Is there anything else I need to do, and after I'm done do I just delete my current /home?


Real programmers use a magnet and a steady hand.

Offline

#12 2015-09-07 20:27:06

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED]Move home to new partition

Test that it all works before deleting your old /home

Offline

#13 2015-09-07 22:04:03

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: [SOLVED]Move home to new partition

Also before deleting consider this:
A usual (everyday usable) installation requires at least 8gb and at max about 50gb as root (/) partition.
Every space spare should be spent on/for /home.

Consider this, you will not copy your 4k birthday video (80gb) on your root partition (eg: /tmp) but more likley within your homedir. ($HOME/Videos | $XDG_VIDEOS_DIR).
Thus you want more space in your home directory.

Even if you play games in WINE, it will store them in your $HOME dir, unless you tweak it (and other things) to make it work using a directory on the root partition.
Not sure about Steam.

Your setup:

    /dev/sda1 -- BIOS boot -- 1mb
    /dev/sda2 -- Swap -- 4GB
    /dev/sda3 -- Everything else - 534 GB
    /dev/sda4 -- Partition I'm moving home to -- 50GB
    343 GB of empty space left

My suggestion:

    /dev/sda1 -- BIOS boot -- 1mb
    /dev/sda2 -- Swap -- 4GB
    /dev/sda3 -- / -- 50GB
    /dev/sda4 -- /home -- 524GB
    343 GB of empty space left

So you're using:

su
mkdir /home.new
mount /dev/sda4 /home.new
rsync -aAXv /home /home.new

Then shrink /dev/sda3 to 50GB and increase the size of /dev/sda4. (havent done that wiht linux partitions yet)

Or you take the longer walk (copy) and use:

su
mkdir /root.new
mount /dev/sda4 /root.new
rsync -aAXv --exclude=/home / /root.new

Which would then turn out to be:

    /dev/sda1 -- BIOS boot -- 1mb
    /dev/sda2 -- Swap -- 4GB
    /dev/sda3 -- /home -- 534GB
    /dev/sda4 -- / -- 50GB
    343 GB of empty space left

However, you will then need to apply already mentioned changes to /dev/sda3 - your 'current' root to become a valid /home partition: '/' must then only the user name directories.

hth

Last edited by esa (2015-09-07 22:05:35)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

Board footer

Powered by FluxBB