1

I am running btrfs 4.15.1 on a fresh ubuntu 18.04 server. I have a small hardrive which for / and a large disk for documents served to my colleagues in our office via samba. That data drive is used entirely for this, has been created by mkfs.btrfs /deb/sdb/ and is mounted to /mnt/data/.

Further down the road I want to add a second harddisk and convert the singledrive data disk into a RAID1 (data & metadata I guess). Would the commands below achieve that goal?

btrfs device add /dev/sdc /mnt/data
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt

would I have to do a mkfs.btrfs /dev/sdc/ before adding the new harddrive to the system?

2

No, btrfs will create the filesystem for you. Before you add the device, it should look like this:

$ sudo btrfs filesystem show
  Label: none  uuid: 14736aed-faa3-4f03-819e-24369e9bb34f
           Total devices 1 FS bytes used 384.00KiB
           devid    1 size 20.00GiB used 2.02GiB path /dev/sdb

When adding the device (if there is a existing partition table you need the '-f' option, it will overwrite the partition table) it will look like this:

$ sudo btrfs device add -f /dev/sdc /mnt/data
  sudo btrfs filesystem show
  Label: none  uuid: 14736aed-faa3-4f03-819e-24369e9bb34f
          Total devices 2 FS bytes used 384.00KiB
          devid    1 size 20.00GiB used 2.02GiB path /dev/sdb
          devid    2 size 20.00GiB used 0.00B path /dev/sdc

Then start the balancing process:

$ sudo btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/data
  Done, had to relocate 4 out of 4 chunks
  • thanks, even though starting your response with a general no, ... while you confirm a large part of the method mentioned in the question has confused me a little on first sight though. - anyway thanks :-) – vrms Apr 19 '18 at 21:24
  • @vrms sorry for that... but you only ask for the filesystem on /dev/sdc ;-) – Simon Sudler Apr 20 '18 at 6:37
  • it's fine. I have recovered from the shock :-) – vrms Apr 26 '18 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.