14

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?

1 Answer 1

16

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
4
  • 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
    Commented Apr 19, 2018 at 21:24
  • @vrms sorry for that... but you only ask for the filesystem on /dev/sdc ;-) Commented Apr 20, 2018 at 6:37
  • 1
    it's fine. I have recovered from the shock :-)
    – vrms
    Commented Apr 26, 2018 at 9:12
  • 2
    just a note: the balance step can take time if the first unit is already filled with data, since the files will be mirrored Commented Dec 22, 2022 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .