I've been trying to wrap my head around the btrfs replace command. My relevant drives are as follows:
root@GreyGeek:/# fdisk -l
The source drive:
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 860
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CF604933-F7D3-49B1-B0E3-BC7C564CEED9
Device Start End Sectors SizeType
/dev/sda1 2048 585727 583680 285M EFI System
/dev/sda2 585728 4491263 3905536 1.9G Linux swap
/dev/sda3 4491264 976771071 972279808 463.6G Linux filesystem
The target drive:
Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: SSD 870 EVO 1TB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 11A30D08-8E0C-204C-BFEA-B80B90C991FE
Device Start End Sectors SizeType
/dev/sdb1 2048 1953523711 1953521664 931.5G Linux filesystem
root@GreyGeek:/#
and my current btrfs partition on /dev/sda3 shows:
root@GreyGeek:/# btrfs fi show /
Label: none uuid: 8031d05e-03c9-4012-ab07-89ef71983232
Total devices 1 FS bytes used 132.04GiB
devid 1 size 463.62GiB used 142.07GiB path /dev/sda3
Notice that my source drive (/dev/sda) has three partitions and the btrfs partition is on sda3. As root I always mount it to take snapshots using:
mount /dev/disk/by-uuid/8031d05e-03c9-4012-ab07-89ef71983232 /mnt
Also, as you can see in the fdisk listing, I've prepared the new 1TB drive by creating a btrfs partition: /dev/sdb1. There are no other partitions on that SSD.
The command to replace /dev/sdb1 with the contents of /dev/sda3 would be:
btrfs replace start 1 /dev/sda3 /mnt/
I'm using the only guide I found on the web explaining how to use the btrfs replace command, which I found here. All other explanations I've found on the web merely reword the man pages but give no useful examples or poignant advice.
What I do not understand, nor find on the Internet, is how the sda1 and sda2 partitions get copied to sdb, because without them booting sdb would be impossible, and I'd be forced to simply replace my current SSD with the 1TB SSD and then format and install Bookworm on it in the regular manner. If I do that what's the point of btrfs replace?
Any suggestions?
root@GreyGeek:/# fdisk -l
The source drive:
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 860
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CF604933-F7D3-49B1-B0E3-BC7C564CEED9
Device Start End Sectors SizeType
/dev/sda1 2048 585727 583680 285M EFI System
/dev/sda2 585728 4491263 3905536 1.9G Linux swap
/dev/sda3 4491264 976771071 972279808 463.6G Linux filesystem
The target drive:
Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: SSD 870 EVO 1TB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 11A30D08-8E0C-204C-BFEA-B80B90C991FE
Device Start End Sectors SizeType
/dev/sdb1 2048 1953523711 1953521664 931.5G Linux filesystem
root@GreyGeek:/#
and my current btrfs partition on /dev/sda3 shows:
root@GreyGeek:/# btrfs fi show /
Label: none uuid: 8031d05e-03c9-4012-ab07-89ef71983232
Total devices 1 FS bytes used 132.04GiB
devid 1 size 463.62GiB used 142.07GiB path /dev/sda3
Notice that my source drive (/dev/sda) has three partitions and the btrfs partition is on sda3. As root I always mount it to take snapshots using:
mount /dev/disk/by-uuid/8031d05e-03c9-4012-ab07-89ef71983232 /mnt
Also, as you can see in the fdisk listing, I've prepared the new 1TB drive by creating a btrfs partition: /dev/sdb1. There are no other partitions on that SSD.
The command to replace /dev/sdb1 with the contents of /dev/sda3 would be:
btrfs replace start 1 /dev/sda3 /mnt/
I'm using the only guide I found on the web explaining how to use the btrfs replace command, which I found here. All other explanations I've found on the web merely reword the man pages but give no useful examples or poignant advice.
What I do not understand, nor find on the Internet, is how the sda1 and sda2 partitions get copied to sdb, because without them booting sdb would be impossible, and I'd be forced to simply replace my current SSD with the 1TB SSD and then format and install Bookworm on it in the regular manner. If I do that what's the point of btrfs replace?
Any suggestions?
Comment