I am trying to move my /srv, /var/lib/mysql and /home directory to another drive ( a bigger one with RAID1). I did some research on how to go about doing this and I kind of did most of it. However, after all the content is copied over, I am unable to replace the new snapshot in new drive as the one to use by default. Can some kind soul please help point me to the correct direction? Note that step #5 is where I am stuck.
Preparation:
The fstab currently looks like this:
# grep srv /etc/fstab
UUID=0888211b-2636-4eb5-97da-52679d93a275 /srv btrfs subvol=/@/srv 0 0
The filesystem overall looks like the following. First drive is not raid. Second drive is RAID1
# btrfs filesystem show
Label: 'ROOT' uuid: 0888211b-2636-4eb5-97da-52679d93a275 <-- source drive
Total devices 1 FS bytes used 16.05GiB
devid 1 size 40.00GiB used 17.05GiB path /dev/sdd3
Label: none uuid: 273dbdbd-16d9-4ae4-bde7-d30a48474a44 <-- destination drive
Total devices 2 FS bytes used 799.20MiB
devid 1 size 7.28TiB used 2.01GiB path /dev/sda
devid 2 size 7.28TiB used 2.01GiB path /dev/sdc
And the subvolumes list because each drive already has subvolumes
# btrfs subvolume list / |grep srv
ID 260 gen 12751 top level 256 path @/srv
# btrfs subvolume list /data-1
ID 258 gen 226 top level 5 path subvol-1
ID 261 gen 225 top level 258 path .snapshots
So I did the following steps:
1 created a readonly snapshot of /srv
# btrfs subvolume snapshot -r /srv /srv_snap
Create a readonly snapshot of '/srv' in '//srv_snap'
# btrfs subvolume list / |grep srv
ID 260 gen 12784 top level 256 path @/srv
ID 526 gen 12784 top level 267 path srv_snap
# btrfs filesystem sync /
2 Send the readonly snapshot to new drive which is mounted as /data-1
# btrfs send /srv_snap | btrfs receive /data-1
At subvol /srv_snap
At subvol srv_snap
# btrfs subvolume list /data-1
ID 258 gen 226 top level 5 path subvol-1
ID 261 gen 225 top level 258 path .snapshots
ID 332 gen 227 top level 258 path srv_snap
3 Now renamed this readonly copy to desired name and made it read-write
# btrfs filesystem sync /data-1
# btrfs subvolume snapshot /data-1/srv_snap /data-1/@srv
Create a snapshot of '/data-1/srv_snap' in '/data-1/@srv'
# btrfs subvolume list /data-1 |grep srv
ID 333 gen 233 top level 258 path srv_snap
ID 334 gen 233 top level 258 path @srv
4 Removed unnecessary snapshots
# btrfs subvolume delete /data-1/srv_snap /srv_snap
Delete subvolume (no-commit): '/data-1/srv_snap'
Delete subvolume (no-commit): '//srv_snap'
5 Now I want to replace the /srv partition detail in fstab with the new one via btrfs way. This is where I am stuck
# btrfs replace start /dev/sdd3 /data-1 /srv
probe of /data-1 failed, cannot detect existing filesystem.
ERROR: use the -f option to force overwrite of /data-1
If it matters, relevant version numbers:
# btrfs version
btrfs-progs v5.7
#cat /etc/os-release
NAME="openSUSE Tumbleweed"
# VERSION="20200905"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20200905"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20200905"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
LOGO="distributor-logo"