Este contenido no está disponible en el idioma seleccionado.
6.4. Integrated Volume Management of Multiple Devices
6.4.1. Creating a File System with Multiple Devices
mkfs.btrfs
command, as detailed in Section 6.1, “Creating a btrfs File System”, accepts the options -d
for data, and -m
for metadata. Valid specifications are:
raid0
raid1
raid10
dup
single
-m single
option instructs that no duplication of metadata is done. This may be desired when using hardware raid.
Note
Example 6.1. Creating a RAID 10 btrfs File System
# mkfs.btrfs /dev/device1 /dev/device2 /dev/device3 /dev/device4
# mkfs.btrfs -m raid0 /dev/device1 /dev/device2
# mkfs.btrfs -m raid10 -d raid10 /dev/device1 /dev/device2 /dev/device3 /dev/device4
# mkfs.btrfs -m single /dev/device
single
option to use the full capacity of each drive when the drives are different sizes.
# mkfs.btrfs -d single /dev/device1 /dev/device2 /dev/device3
# btrfs device add /dev/device1 /mount-point
btrfs device scan
command to discover all multi-device file systems. See Section 6.4.2, “Scanning for btrfs Devices” for more information.
6.4.2. Scanning for btrfs Devices
btrfs device scan
to scan all block devices under /dev
and probe for btrfs volumes. This must be performed after loading the btrfs module if running with more than one device in a file system.
# btrfs device scan
# btrfs device scan /dev/device
6.4.3. Adding New Devices to a btrfs File System
btrfs filesystem show
command to list all the btrfs file systems and which devices they include.
btrfs device add
command is used to add new devices to a mounted file system.
btrfs filesystem balance
command balances (restripes) the allocated extents across all existing devices.
Example 6.2. Add a New Device to a btrfs File System
# mkfs.btrfs /dev/device1 # mount /dev/device1
# btrfs device add /dev/device2 /mount-point
/dev/device1
. It must now be balanced to spread across all devices.
# btrfs filesystem balance /mount-point
6.4.4. Converting a btrfs File System
Example 6.3. Converting a btrfs File System
/dev/sdb1
in this case, into a two device, raid1 system in order to protect against a single disk failure, use the following commands:
# mount /dev/sdb1 /mnt # btrfs device add /dev/sdc1 /mnt # btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt
Important
6.4.5. Removing btrfs Devices
btrfs device delete
command to remove an online device. It redistributes any extents in use to other devices in the file system in order to be safely removed.
Example 6.4. Removing a Device on a btrfs File System
# mkfs.btrfs /dev/sdb /dev/sdc /dev/sdd /dev/sde # mount /dev/sdb /mnt
# btrfs device delete /dev/sdc /mnt
6.4.6. Replacing Failed Devices on a btrfs File System
# mkfs.btrfs -m raid1 /dev/sdb /dev/sdc /dev/sdd /dev/sde ssd is destroyed or removed, use -o degraded to force the mount to ignore missing devices # mount -o degraded /dev/sdb /mnt 'missing' is a special device name # btrfs device delete missing /mnt
btrfs device delete missing
removes the first device that is described by the file system metadata but not present when the file system was mounted.
Important
- mount in degraded mode,
- add a new device,
- and, remove the missing device.
6.4.7. Registering a btrfs File System in /etc/fstab
initrd
or it does not perform a btrfs device scan, it is possible to mount a multi-volume btrfs
file system by passing all the devices in the file system explicitly to the mount
command.
Example 6.5. Example /etc/fstab
Entry
/etc/fstab
entry would be:
/dev/sdb /mnt btrfs device=/dev/sdb,device=/dev/sdc,device=/dev/sdd,device=/dev/sde 0