I have a failing hard disk drive, which contains a partition forming part of my root filesystem:
matt@ryzen3950 ~> btrfs device stats /dev/dm-2
[/dev/mapper/cryptsda1].write_io_errs 0
[/dev/mapper/cryptsda1].read_io_errs 0
[/dev/mapper/cryptsda1].flush_io_errs 0
[/dev/mapper/cryptsda1].corruption_errs 12
[/dev/mapper/cryptsda1].generation_errs 0
I have another storage device that I'd like to replace this one with. To do this, I first partitioned and encrypted my new drive:
matt@ryzen3950 ~> sudo parted /dev/sdd
(parted) mklabel gpt
(parted) mkpart primary btrfs 1MiB 100%
(parted) quit
matt@ryzen3950 ~> sudo cryptsetup luksFormat /dev/sdd1
matt@ryzen3950 ~> sudo cryptsetup open --type luks /dev/sdd1 cryptsdd1
(I did not perform any mkfs
on this)
Then, I attempted to perform btrfs replace (note, this filesystem is currently live):
sudo btrfs replace start /dev/mapper/cryptsda1 /dev/mapper/cryptsdd1 /
However, I get the error:
/dev/mapper/cryptsdd1 appears to contain a partition table (atari).
ERROR: use the -f option to force overwrite of /dev/mapper/cryptsdd1
This makes it sound like I should not have partitioned the drive first. Should I have done the following instead?
sudo btrfs replace start /dev/sda /devsdd /
If not, what's the correct way to do this?
Finally, what is <path>
in btrfs replace? I believe it's the filesystem mount point (e.g., /
on a live root filesystem). Is this correct?
I read the full btrfs-replace manpage as well as the btrfs wiki, but was not able to find the answers to my questions.