Btrfs - Rename label

By xngo on February 2, 2020

I created a RAID1 mirror but I forgot to add the label. As a result, is it is showing Label: none.

$btrfs filesystem show
Label: none  uuid: f656414a-3e5c-4ae7-8987-db0eefb6a295
    Total devices 2 FS bytes used 128.00KiB
    devid    1 size 2.50GiB used 520.00MiB path /dev/sdg
    devid    2 size 2.50GiB used 520.00MiB path /dev/sdh

Now, to add label, I run the following command.

# btrfs filesystem label [<device>|<mount_point>] [<newlabel>]
    btrfs filesystem label /dev/sdh MyMirrorDisks

For the device, pick 1 of the devices.

The end results look like the followings.

$btrfs filesystem show
Label: 'MyMirrorDisks'  uuid: f656414a-3e5c-4ae7-8987-db0eefb6a295
    Total devices 2 FS bytes used 128.00KiB
    devid    1 size 2.50GiB used 520.00MiB path /dev/sdg
    devid    2 size 2.50GiB used 520.00MiB path /dev/sdh

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.