If the btrfs-progs package is not already
installed on your system, use yum to
install it.
You can use the mkfs.btrfs command to create a btrfs file system that is laid out across one or more block devices. The default configuration is to stripe the file system data and to mirror the file system metadata across the devices. If you specify a single device, the metadata is duplicated on that device unless you specify that only one copy of the metadata is to be used. The devices can be simple disk partitions, loopback devices (that is, disk images in memory), multipath devices, or LUNs that implement RAID in hardware.
The following table illustrates how to use the mkfs.btrfs command to create various btrfs configurations.
Command | Description |
|---|---|
mkfs.btrfs
| Create a btrfs file system on a single device. For example: mkfs.btrfs /dev/sdb1 |
mkfs.btrfs -L
| Create a btrfs file system with a label that you can use when mounting the file system. For example: mkfs.btrfs -L myvolume /dev/sdb2 Note The device must correspond to a partition if you intend to mount it by specifying the name of its label. |
mkfs.btrfs -m single
| Create a btrfs file system on a single device, but do not duplicate the metadata on that device. For example: mkfs.btrfs -m single /dev/sdc |
mkfs.btrfs
| Stripe the file system data and mirror the file system metadata across several devices. For example: mkfs.btrfs /dev/sdd /dev/sde |
mkfs.btrfs -m raid0
| Stripe both the file system data and metadata across several devices. For example: mkfs.btrfs -m raid0 /dev/sdd /dev/sde |
mkfs.btrfs -d raid1
| Mirror both the file system data and metadata across several devices. For example: mkfs.btrfs -d raid1 /dev/sdd /dev/sde |
mkfs.btrfs -d raid10 -m raid10
| Stripe the file system data and metadata across several mirrored devices. You must specify an even number of devices, of which there must be at least four. For example: mkfs.btrfs -d raid10 -m raid10 /dev/sdf \ /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk |
When you want to mount the file system, you can specify it by any of its component devices, for example:
#mkfs.btrfs -d raid10 -m raid10 /dev/sd[fghijk]#mount /dev/sdf /raid10_mountpoint
To find out the RAID configuration of a mounted btrfs file system, use this command:
# btrfs filesystem df mountpoint