You are not logged in.

#1 2020-10-27 16:52:45

860lacov
Member
Registered: 2020-05-02
Posts: 497

[SOLVED] How to move data from two btrfs drives to one drive?

I have two SSD disks.
sda with @ - root subvolume
sdb with @home and @cache subvolume (cache is for /var/cache)

I could probably use send and receive but I don't understand it yet.

Could I do something like this:
format new drive as btrfs
create on it 3 subvolumes:
@, @home, @cache
rsync -aAXv data from current subvolumes to new ones.

edit my fstab

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda1 LABEL=arch
UUID=dea507c7-9c16-4bc7-bc1a-a0c6f2a1b805	/         	btrfs     	rw,noatime,compress=zstd:2,ssd,space_cache,commit=120,subvol=@	0 0

# /dev/sda1 LABEL=arch
UUID=dea507c7-9c16-4bc7-bc1a-a0c6f2a1b805	/var/cache	btrfs     	rw,noatime,compress=zstd:3,ssd,space_cache,commit=120,subvol=@cache	0 0

# /dev/sdb1 LABEL=home
UUID=15605bb0-6b86-4c9f-911b-95b83abc3551	/home     	btrfs     	rw,noatime,compress=zstd:3,ssd,space_cache,commit=120,subvol=@home	0 0

And change UUID of sdb mounts to new drive UUID

And at the end chroot into copied files and do a grub reinstall.

Will that work?

Last edited by 860lacov (2020-10-29 08:05:47)

Offline

#2 2020-10-28 23:11:38

860lacov
Member
Registered: 2020-05-02
Posts: 497

Re: [SOLVED] How to move data from two btrfs drives to one drive?

I wanted to test possibilities of moving whole system to new drive without reinstallation, so I did something like this:

Hardware:
ssd1, btrfs, / in @ subvolume
ssd1, btrfs, /var/cache in @cache subvolume
ssd2, btrfs, /home in @home subvolume

ssd3 clean disk
1. format ssd3 (in USB case) - mkfs.btrfs -d single -m single [I had to specify d and m because mkfs.btrfs didn't recognize ssd disk
2. I did read-only snapshots of @, @home, @cache subvolumes
3. I did btrfs send subvolume | btrfs recieve <mountopint of ssd3>
4. I did new writable snapshots of received read-only snapshots
5. Shutdown, disks change, power on
6. With arch latest iso I did steps from Arch installation guide - generate fstab, chroot -> grub installation and generation of grub.cfg

After reboot system works.

I've found one flaw - during send receive process my Virtualbox folder lost its no COW attribute

Could you please tell me if I did everything right? Hope that I didn't miss anything important.

Last edited by 860lacov (2020-10-29 07:44:10)

Offline

Board footer

Powered by FluxBB