BARREL(8)
β¨ NAME β¨
barrel β command-line program for storage management. Thatβs the whole vibe, bestie: section 8βs storage-management main character. π
πΈ SYNOPSIS πΈ
barrel [--global-opts] command [--command-opts] [block-devices]
barrel [--global-opts]
π DESCRIPTION π
Okay so barrel is the command-line program for storage management, and itβs lowkey a multi-tool for file systems, LUKS, RAIDs and LVM. The main feature? It combines the various tools youβd need to manage all those different storage systems into one tool. Like β with a single barrel command, you can create partitions on several disks, create a RAID from those partitions, and create a file system on the RAID. Iconic. β¨
barrel probes the complete storage system at startup and does not save the state between invocations. That means you can mix barrel with other storage tools β although, fr fr, not concurrently in general. π«Ά
π¦ CONCEPTS π¦
π Script and Interactive Mode π
barrel can run in either script or interactive mode. In script mode the command must be provided on the command line. If no command is provided on the command line, interactive mode starts and a prompt asks for the commands. Cute, right? π
π Pool π
Pools are a set of devices and let barrel find suitable disk space on its own. For example, when the system has several SSDs and the user wants to create a file system on some SSD, barrel can pick an SSD with enough space automatically. Slay. So far, devices in a pool must have a partition table to be usable. No table, no entry, iykyk. π
π§ Stack π§
barrel has a stack that allows commands to be chained. For example, creating a RAID places the resulting RAID on the stack. A consecutive command to create a file system can then pick the RAID from the stack. Using the stack means the user does not have to deal with the name of the newly created RAID, and thus the two commands can be provided on the command line. Obsessed. π
The stack can hold different objects: storage objects (e.g. block devices, LVM volume groups or file systems), a mark, and arrays. Arrays are constructed using the [ and ] commands. π¦
β Devicegraph β
barrel saves all information about storage devices and file systems, together with their relations, in a devicegraph. At startup the system is probed and the state is saved in the probed and the staging devicegraphs. All commands, except the commit command, only modify the staging devicegraph. Main character energy for staging, honestly.
barrel makes a backup of the staging devicegraph whenever it is modified. The last backup can be restored with the command undo. π
During commit, barrel runs actions to make the system match the staging devicegraph. In script mode a commit is done automatically if needed. No cap.
π Modi Operandi of Commands π
Many commands operate significantly differently based on the provided options. Itβs giving βsame command, different era.β
For example, when creating a file system using create xfs /dev/sdb1, the XFS is created on the partition /dev/sdb1. On the other hand, the command create xfs /dev/sdb --size 10G will create a 10 GiB partition on /dev/sdb and the XFS on the new partition. And the command create xfs will take a device from the stack and create the XFS on that device. Periodt. π₯
π GLOBAL OPTIONS π
-q,--quietβ suppress normal output. Error messages will still be printed, though. π«Ά-v,--verboseβ increase verbosity. Tell me more, bestie. β¨-t,--table-style styleβ specifies table style. Table style is identified by an integer number. π--colorβ use colors in output. π--no-colorβ do not use colors in output. π--dry-runβ do not commit anything to disk. The ultimate βlook, donβt touch.β π--rootprefix pathβ prepend various path (mount points and files in/etc) with a rootprefix. Useful when running in an installation or rescue system. π§-a,--activateβ activate storage systems at startup. Useful when running in an installation or rescue system. β--yesβ do not prompt for confirmation but assume the answer yes. Use with extreme caution. π Dramatic but true.-h,--help formatβ print help and exit. π¦--versionβ print version and exit. π
π COMMANDS π
barrel provides a number of commands. Many commands have specific options, which are listed in this section. These command-specific options must be specified after the name of the command. For several commands some options are mandatory. So yes, order matters, bestie. π
[
Starts an array construction by pushing a mark on the stack. π
]
Ends an array construction by creating a new array from the objects on the stack upto the next mark, removing the objects and the mark from the stack, and finally pushing the new array onto the stack. π¦
clear
Clears the stack. π§Ή
commit
Commits changes to disk and quits. πΎ
create encryption [device]
Creates a new encryption device. π
-t,--type typeβ set encryption type. Possible values areluks1andluks2.-n,--name nameβ name of device-mapper device.--label labelβ label of device-mapper device. Only for LUKS2.--activate-by typeβ set the activate-by type used in/etc/crypttab. Possible values aredevice,path,id,uuidandlabel(only for LUKS2). The default is usuallyuuid. If the selected type is not available the fallback isdevice.--activate-options optionsβ options in/etc/crypttabfor the encryption.--pool-name nameβ name of pool from which to take underlying device.-s,--size sizeβ approximate size of resulting encryption device.--key-fileβ set a key file. The key file is used during commit and in/etc/crypttab. Also the key file must already exist.--key-sizeβ set the key size in bits. Must be at least a multiple of 8. Seecryptsetupfor more details.--cipherβ set the cipher. Seecryptsetupfor more details.--pbkdfβ set the PBKDF (Password-Based Key Derivation Function). Seecryptsetupfor more details.--no-crypttabβ do not add the encryption in/etc/crypttab.--forceβ force creation if block device is in use.
Possible Modi Operandi are:
- Pool β the encryption device is created on a new partition on a block device from the pool. The options
--pool-nameand--sizeare required. - Block Device β the encryption device is created directly on the provided block device. The option
--sizeis not allowed. - Partitionable β the encryption device is created on a new partition on the provided block device, which must be partitionable. The option
--sizeis required. - Block Device from Stack β the encryption device is created directly on the block device from the stack. The option
--sizeis not allowed. - Partitionable from Stack β the encryption device is created on a new partition on the block device from the stack, which must be partitionable. The option
--sizeis required.
create filesystem [device]
Creates a new file system. πΈ
-t,--type typeβ set file system type. Possible values arebcachefs,btrfs,exfat,ext2,ext3,ext4,f2fs,jfs,nilfs2,ntfs,reiserfs,swap,udf,vfat,xfs.
Not all file systems may be available on the system.
-l,--label labelβ set label of file system.-p,--path pathβ path to mount the file system.
For swap the path may be 'swap' or 'none'.
--mount-by typeβ set the mount-by type used in/etc/fstab. Possible values aredevice,path,id,uuidandlabel. The default is usuallyuuid. For some devices it is different, e.g. for LVM logical volumes it isdevicesince LVM has stable device names. If the selected type is not available the fallback isdevice.--mount-options optionsβ mount options for the file system.--mkfs-options optionsβ options formkfscommand. The options are injected as-is to the command so must be properly quoted.--tune-options optionsβ options for the file system tune command. The options are injected as-is to the command so must be properly quoted. Only supported forext2,ext3andext4.--pool-name optionsβ name of pool from which to take underlying device.-s,--size sizeβ approximate size of the block device or sum of the sizes of the block devices for the file system.
Due to file system metadata and for btrfs also data duplication the usable space of the resulting file system can be much smaller.
-d,--devices numberβ for btrfs the number of underlying devices for the file system. Default is 1. The special value of'max'uses all devices provided or all devices of the pool.--profile profileβ btrfs profiles for data and metadata. Either one profile can be provided for both data and metadata, or two profiles separated by comma, the first for data and the second for metadata.--no-fstabβ do not add the file system in/etc/fstab.--forceβ force creation if block device is in use.
Possible Modi Operandi are:
- Pool β the file system is created on a new partition on a block device from the pool. The options
--pool-nameand--sizeare required. - Block Device β the file system is created directly on the provided block device. The option
--sizeis not allowed. - Partitionable β the file system is created on a new partition on the provided block device, which must be partitionable. The option
--sizeis required. - Block Devices from Stack β the file system is created directly on block devices from the stack. The option
--sizeis not allowed. The top object on the stack must be a block device or an array of block devices. - Partitionables from Stack β the file system is created on new partitions on the block devices from the stack. The option
--sizeis required. The top object on the stack must be a partitionable block device or an array of partitionable block devices.
create lv
Creates a new LVM logical volume. π
-v,--vg-name vg-nameβ name of volume group to use.-n,--name nameβ name of new logical volume.-s,--size sizeβ approximate size of resulting logical volume.--stripes stripesβ number of stripes for the logical volume. Default is 1. The special value of'max'uses all underlying devices of the volume group.--stripe-sizestripe-size β the stripe size. yeah. that's her π
Possible Modi Operandi are:
- Volume Group β the logical volume gets created on the volume group you hand over.
--vg-nameis required here, no cap. - Volume Group from Stack β the logical volume gets created on the volume group that's chilling on top of the stack π₯
create partition-table [device]
Brand new partition table, fresh start, clean slate energy β¨
-t,--typetype β set the partition table type. The possible values aregptandms-dos.--forceβ force the creation even when the block device is in use. spicy πΆοΈ
Possible Modi Operandi are:
- Partitionable β the partition table is built on the block device you provided, and that device must be partitionable.
- Partitionable from Stack β the partition table is built on the block device from the stack, which must be partitionable.
create pool [devices]
Creates a shiny new pool stuffed with devices π«Ά
-n,--namename β the name of the pool.
create raid [devices]
Creates a RAID. iconic, honestly π₯
-l,--levellevel β set the RAID level. Possible values arelinear,0,stripe,1,mirror,4,5,6and10.-n,--namename β set the name of the RAID.--pool-namename β name of the pool to grab the underlying devices from.-s,--sizesize β approximate size of the resulting RAID.--metadatametadata β the RAID metadata version. Possible values are1.0,1.1and1.2, although other values might work too. If you don't pass the option, mdadm's default gets used (which is1.2at present).-d,--devicesnumber β number of RAID and spare devices. Possible formats are:rβ create a RAID with r RAID devices and zero spare devices.r+sβ create a RAID with r RAID devices and s spare devices.+sβ create a RAID with nβ*s* RAID devices and s spare devices.
The default is to use n. And n is the number of devices provided, or the devices of the pool.
--chunk-sizechunk-size β the chunk size.--forceβ force creation even if the block devices are in use.
Possible Modi Operandi are:
- Pool β the RAID is created on new partitions on block devices from the pool.
--pool-nameand--sizeare required. - Block Devices β the RAID is created directly on the block devices you provided.
--sizeis not allowed here π ββοΈ - Partitionables β the RAID is created on new partitions on the block devices you provided, which must be partitionable.
--sizeis required.
create vg [devices]
Creates a new LVM volume group. big girl moves π
-n,--namename β name of the new volume group.--pool-namename β name of the pool to take the underlying devices from.-s,--sizesize β approximate size of the resulting volume group.-d,--devicesnumber β number of underlying devices for the volume group. Default is1. The special value'max'uses all devices provided, or all devices of the pool.--extent-sizeextent-size β the extent size.--forceβ force creation even if the block devices are in use.
Possible Modi Operandi are:
- Pool β the volume group is created on new partitions on block devices from the pool.
--pool-nameand--sizeare required. - Block Devices β the volume group is created directly on the block devices you provided.
--sizeis not allowed. - Partitionables β the volume group is created on new partitions on the block devices you provided, which must be partitionable.
--sizeis required. - Block Devices from Stack β the volume group is created directly on the block devices from the stack.
--sizeis not allowed. The top object on the stack must be a block device or an array of block devices. - Partitionables from Stack β the volume group is created on new partitions on the block devices from the stack.
--sizeis required. The top object on the stack must be a partitionable block device or an array of partitionable block devices.
dup
Duplicates the top object of the stack. copy-paste but make it filesystem π
exch
Exchanges the two top objects of the stack. swap era πΈ
extend pool devices
Adds devices to a pool.
-n,--namename β name of the pool.
help [main-command [sub-command]]
Shows help. she's helpful like that π«Ά
load devicegraph
Loads the staging devicegraph from a file.
okay so this function is still in development β use with great care, bestie π
-n,--namename β name of the devicegraph file.-m,--mappingname β name of the mapping file.
load pools
Explicitly loads pools from /etc/barrel/pools.json. Lowkey you don't have to, because pools are automatically loaded at startup. convenient β¨
pop
Removes the top object from the stack. bye bestie π
quit
Quits barrel. dramatic exit encouraged π
reduce pool devices
Removes devices from a pool.
-n,--namename β name of the pool.
remove device devices
Removes a device and all the devices and file systems using it. scorched earth, but make it storage π₯
When you remove a RAID or encryption device, the underlying partitions are also removed. This isn't possible if it would cause used partitions to be renumbered β like logical partitions on an MS-DOS partition table, for example.
--keep-partitionsβ keep the underlying partitions.
remove pool devices
Removes a pool.
-n,--namename β name of the pool.
rename pool
Renames a pool. glow-up for a pool π¦
-o,--old-namename β old name of the pool.-n,--new-namename β new name of the pool.
save devicegraph
Saves the devicegraph to a file.
-n,--namename β name of the devicegraph file.--probedβ save the probed devicegraph instead of the staging one.
save pools
Explicitly saves pools in /etc/barrel/pools.json. Heads up: pools are also saved during commit if they were modified, so this is the manual override vibe.
show commit
Shows commit actions.
show dasds
Shows DASDs.
--probedβ show the DASDs of the probed devicegraph instead of the staging one.--no-partitionsβ don't show partitions on the DASDs.
show disks
Shows disks.
--probedβ show the disks of the probed devicegraph instead of the staging one.--no-partitionsβ don't show partitions on the disks.
show encryptions
Shows encryption devices.
--probedβ show the encryption devices of the probed devicegraph instead of the staging one.
show filesystems
Shows file systems.
--probedβ show the file systems of the probed devicegraph instead of the staging one.
show multipaths
Shows multipath devices.
--probedβ show the multipath devices of the probed devicegraph instead of the staging one.--no-partitionsβ don't show partitions on the multipath devices.
show pools
Shows pools.
--probedβ use the probed devicegraph instead of the staging one to find the devices of the pools.
Devices that aren't currently usable β because they don't have a partition table β get marked with an '!'. so watch for that π©
show raids
Shows RAIDs.
--probedβ show the RAIDs of the probed devicegraph instead of the staging one.--no-partitionsβ don't show partitions on the RAIDs.
show tree devices
Shows a tree of block devices for the devices you provide. cute little family tree π³
--upβ show the tree moving up from the devices.--downβ show the tree moving down from the devices.--probedβ show the tree of the probed devicegraph instead of the staging one.
show vgs
Shows LVM volume groups.
--probedβ show the volume groups of the probed devicegraph instead of the staging one.
stack
Prints the stack. peek at what's on top π₯
undo
Restores the staging devicegraph to the last backup. ctrl+z but make it enterprise π
β¨ EXAMPLES β¨
Real ones, ready to copy. go off bestie π
barrel create xfs /dev/sdb1 --path /test
Create an XFS on /dev/sdb1 and mount it at /test.
barrel create xfs /dev/sdb --size 10G --path /test
Create a 10 GiB partition on /dev/sdb with an XFS, and mount it at /test.
barrel create btrfs --size 1TiB --pool "SSDs (512 B)" --devices 2 --profiles raid0,raid1 --path /test
Create two 0.5 TiB partitions on two devices from the pool "SSDs (512 B)", create a btrfs with the raid0 profile for data and the raid1 profile for metadata on those partitions, and mount it at /test.
barrel create raid1 /dev/sd[bc]1 xfs --path /test
Create a RAID1 on /dev/sdb1 and /dev/sdc1 with an XFS, mounted at /test.
barrel create raid5 --size 1TiB --pool "HDDs (512 B)" --devices 3+1 xfs --path /test
Create a 1 TiB RAID5 with 3 devices and 1 spare from devices in the pool "HDDs (512 B)", plus an XFS on the RAID mounted at /test.
barrel create vg --name vg1 --size 1TiB /dev/sdb lv --name lv1 --size 100G xfs --path /test
Create a new 1 TiB partition on /dev/sdb, create a volume group named vg1 using that partition, create a logical volume named lv1 with size 100G inside the volume group, and finally create an XFS on the logical volume and mount it at /test. the full pipeline, she ate π
π FILES π
/etc/barrel/pools.jsonβ the JSON file defining pools./var/log/barrel.logβ the logfile. Please include this file in bug reports β it's literally the receipts π
π BUGS AND MISSING FEATURES π
not gonna lie, there's some stuff still cooking:
- Validation of input is unfinished.
- Missing tools are not installed on demand.
- Tools doing automounts β e.g. systemd and desktop environments β can cause race conditions. chaos, honestly.
- Incomplete support for multipath, BIOS RAIDS and DASDs.
- Tab completion in the interactive mode is not context aware.
π HOMEPAGE π
http://github.com/openSUSE/barrel/
π AUTHORS π
Arvin Schnell <aschnell@suse.com>
πΈ SEE ALSO πΈ
parted(8), mkfs(8), mount(8), mdadm(8), lvm(8), cryptsetup(8), fstab(5), crypttab(5), mdadm.conf(5)
that's the whole page, bestie β barrel 0.2.8, dated 2024-07-16. now go partition something responsibly π
π¦ where this page comes from
- opensuse-leap 16.0: barrel 0.2.8-bp160.1.13 Β· GPL-2.0-only
- opensuse-leap 16.0: barrel 0.2.8-bp160.1.13 Β· GPL-2.0-only
- opensuse-leap 16.0: barrel 0.2.8-bp160.1.13 Β· GPL-2.0-only
- opensuse-leap 16.0: barrel 0.2.8-bp160.1.13 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms