Linux Practicum: Adding a Second Storage Drive on CentOS 7 with BtrFS
scottalanmiller last edited by
In this example I will walk through the creation of a new 1TB filesystem on CentOS 7 Linux using the BtrFS filesystem. BtrFS has both the filesystem and the logical volume manager built into a single package so we will not be using LVM here.
In my example platform, I am working from a KVM based Scale HC3 cluster. This allows me to make a VIRTIO paravirtualized block device which will show up as a /dev/vd* device in my operating system.
We can look up our available disk devices using the lsblk command:
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 603M 0 rom vda 252:0 0 14.9G 0 disk ├─vda1 252:1 0 500M 0 part /boot └─vda2 252:2 0 14.4G 0 part ├─centos_lab--lnx--centos-root 253:0 0 12.9G 0 lvm / └─centos_lab--lnx--centos-swap 253:1 0 1.5G 0 lvm [SWAP] vdb 252:16 0 931.3G 0 disk
We can see that /dev/vda is already in use and /dev/vdb is unused so we know that that is the new block device that we just added to our server.
# mkfs.btrfs /dev/vdb btrfs-progs v3.19.1 See http://btrfs.wiki.kernel.org for more information. Turning ON incompat feature 'extref': increased hardlink limit per file to 65536 Turning ON incompat feature 'skinny-metadata': reduced-size metadata extent refs fs created label (null) on /dev/vdb nodesize 16384 leafsize 16384 sectorsize 4096 size 931.32GiB
Mounting is now very easy:
# mkdir /var/log2 # echo '/dev/vdb /var/log2 btrfs defaults 0 0' >> /etc/fstab # mount /var/log2 # df -h /var/log2 Filesystem Size Used Avail Use% Mounted on /dev/vdb 932G 17M 930G 1% /var/log2
Part of a series on Linux Systems Administration by Scott Alan Miller