You are not logged in.

#1 2017-06-12 20:41:42

kinoe
Member
Registered: 2016-09-27
Posts: 25

[SOLVED] btrfs: how to move /home/user after install

Hi forum,

i'm an arch newbie, so thanks for being patient with me:-)

I installed KDE Plasma, btrfs on SSD (BIOS not uefi) and i would like to move my /home/user to ext4 HDD (/dev/sda2).
If i simply delete btrfs /home subvolume, create the new ext4 /home on the HDD and a mountpoint (such as /mnt/home) and adjust fstab, then what about

btrfs device add /dev/sda2 /mnt/user

does this add a btrfs device only? Would it be a better way to format the new home partition on HDD to btrfs also?
my fstab:

# /dev/sdb1 LABEL=archroot
UUID=23cef669-f46c-4f5b-8476-ba548256e754       /               btrfs           rw,noatime,compress=lzo,ssd,space_cache,subvolid=257,subvol=/@root,subvol=@root 0 0

# /dev/sdb1 LABEL=archroot
UUID=23cef669-f46c-4f5b-8476-ba548256e754       /home           btrfs           rw,noatime,compress=lzo,ssd,space_cache,subvolid=258,subvol=/@home,subvol=@home 0 0

# /dev/sdb1 LABEL=archroot
UUID=23cef669-f46c-4f5b-8476-ba548256e754       /.snapshots     btrfs           rw,noatime,compress=lzo,ssd,space_cache,subvolid=259,subvol=/@snapshots,subvol=@snapshots       0 0

Presupposed the new partition will be changed to btrfs too, could i just add the following entry to fstab as replacement of the old /home?:

UUID=7ad83a78-4e19-45df-9c6e-1d931a9f999c   /mnt/home             btrfs           rw,noatime,compress=lzo,space_cache,subvolid=258,subvol=/@home,subvol=@home 0 0

and the btrfs list:

#btrfs subvolume list -p /
ID 257 gen 1205 parent 5 top level 5 path @root
ID 258 gen 1205 parent 5 top level 5 path @home
ID 259 gen 10 parent 5 top level 5 path @snapshots
ID 261 gen 53 parent 257 top level 257 path var/lib/machines

Found this: https://unix.stackexchange.com/question … stallation
and https://www.reddit.com/r/archlinux/comm … partition/
but its not for btrfs, so what do i have to consider relating to btrfs?
I don't want to mess with my @subvolumes, so maybe i get some help here?

Last edited by kinoe (2017-06-22 16:22:41)


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#2 2017-06-13 12:56:44

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [SOLVED] btrfs: how to move /home/user after install

I don't understand exactly what you want to do. "device add" is to add a new hardware device to a raid array. It sounds to me like what you are doing would be creating a new btrfs filesystem on an HDD, in which case you would use mkfs.btrfs instead of device add.

Once you have your filesystem created and handle mounting it, there are any number of ways to migrate your home directory to it. The simplest way would just be a "cp -ar" command.

Tim

Offline

#3 2017-06-13 13:22:07

kinoe
Member
Registered: 2016-09-27
Posts: 25

Re: [SOLVED] btrfs: how to move /home/user after install

@Tim
thanks for answering.
Looks like i got puzzled with create subvolumes and add devices to a raid (which is not what i aim at)

My issue is: i actually have one device, with one partition and 3 subvolumes (/,/home and/.snapshots).

I want to separate /home to an other device/partition on a HDD, wether its ext4 or btrfs is not clear yet.
The procedure of copying is clear but what to consider when assigning the new /home partition to fstab:
mostly mount options and is there something that i forgot to mention yet since its btrfs?

Peter

Last edited by kinoe (2017-06-13 13:33:48)


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#4 2017-06-13 13:34:45

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [SOLVED] btrfs: how to move /home/user after install

You don't need to do that (IMO). In fact, I used to have my / and /home on separate partitions and, a few months ago, I undertook a huge project to combine them to separate subvolumes on the same partition. See this article:

https://btrfs.wiki.kernel.org/index.php … ide#Layout

The recommended layout is the "flat" layout.

Tim

Offline

#5 2017-06-13 13:42:46

kinoe
Member
Registered: 2016-09-27
Posts: 25

Re: [SOLVED] btrfs: how to move /home/user after install

Well i 'd love to leave things as they are, but my SSD is only 110 GB in size.
So rather move /home to the bigger HDD.
Is it possible to combine them as separate subvolumes on separate partitions (even separate devices) but as children of the top level subvolume (ID 5)????

By the way i love to learn that stuff. wink

Last edited by kinoe (2017-06-13 13:53:53)


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#6 2017-06-13 14:19:53

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [SOLVED] btrfs: how to move /home/user after install

Ok, you are still confusing me. In your last post, you seemed to say you only had one device.

So, make a partition on the separate HDD, do mkfs.btrfs on that partition, set it up to be mounted, and copy (again, there are many ways to do that) your old /home contents to the new /home. That's all there is to it.

As root, mv /home /oldhome. Establish (per the above) /home on the new HDD filesystem. "cp -ar /oldhome/* /home".

Reboot, and ensure the new /home works as intended. As long as it does, delete /oldhome. Done.

Tim

Offline

#7 2017-06-13 14:32:40

kinoe
Member
Registered: 2016-09-27
Posts: 25

Re: [SOLVED] btrfs: how to move /home/user after install

Yes you're right i said "actually i have one device", what i meant was "at the moment i use one device"....

Thanks for your advices.
As far as i know fstab needs to be adjusted and the new /home assigned to it after the copy process or am i wrong?


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#8 2017-06-13 20:08:08

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [SOLVED] btrfs: how to move /home/user after install

kinoe wrote:

As far as i know fstab needs to be adjusted and the new /home assigned to it after the copy process or am i wrong?

Yes, that is correct. You will add an entry for /home on your new partition on the HDD.

Tim

Offline

#9 2017-06-13 20:20:26

kinoe
Member
Registered: 2016-09-27
Posts: 25

Re: [SOLVED] btrfs: how to move /home/user after install

Maybe i made myself more clear here:
https://unix.stackexchange.com/question … stallation

Last edited by kinoe (2017-06-15 15:45:31)


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#10 2017-06-15 15:47:50

kinoe
Member
Registered: 2016-09-27
Posts: 25

Re: [SOLVED] btrfs: how to move /home/user after install

I created a new subvolume 'home' in the new /home on /dev/sda2. Copied the data old/home to new/home and then i adjusted fstab to:

# /dev/sdb1 LABEL=archroot
UUID=23cef669-f46c-4f5b-8476-ba548256e754	/         	btrfs     	rw,noatime,compress=lzo,ssd,subvolid=257,subvol=/@root,subvol=@root	 0 0

# /dev/sdb1 LABEL=archroot   OLD/HOME on SSD  ID 258 gen 3060 top level 5 path @home
# UUID=23cef669-f46c-4f5b-8476-ba548256e754	/home     	btrfs     	rw,noatime,compress=lzo,ssd,subvolid=258,subvol=/@home,subvol=@home	 0 0

# /dev/sdb1 LABEL=archroot
UUID=23cef669-f46c-4f5b-8476-ba548256e754	/.snapshots	btrfs     	rw,noatime,compress=lzo,ssd,subvolid=259,subvol=/@snapshots,subvol=@snapshots	0 0

# /dev/sda2 LABEL=archhome   NEW/HOME on HDD  ID 260 gen 30 parent 5 top level 5 path home
UUID=7ad83a78-4e19-45df-9c6e-1d931a9f999c       /home           btrfs           rw,noatime,compress=lzo,space_cache,subvolid=260,subvol=home 0 0

Works like a charm.
Did i forget something? Any hints?
I hope to be able of making snapshots from this new /home too.

Last edited by kinoe (2017-06-15 15:51:53)


Windows assumes the user is an idiot.
Linux demands proof.

Offline

#11 2017-06-15 17:54:30

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [SOLVED] btrfs: how to move /home/user after install

That's pretty much it. You did good.

Tim

Offline

Board footer

Powered by FluxBB