Skip to content

Instantly share code, notes, and snippets.

@rumkin
Last active August 29, 2015 14:16
Show Gist options
  • Save rumkin/4d22178f4dee9a0ed971 to your computer and use it in GitHub Desktop.
Save rumkin/4d22178f4dee9a0ed971 to your computer and use it in GitHub Desktop.
Create btrfs partition from file
# Partition file
FILE=/tmp/drive
# Mount directory
MOUNT=/mnt/drive
# Allocate 10Gb empty file
fallocate -l 10G $FILE
# Mount file to loop back device
losetup /dev/loop0
# Create btrfs _without RAID_
mkfs.btrfs -m single /dev/loop0
# Create mount point
mkdir $MOUNT
# mount file to mount point
mount -t btrfs $MOUNT $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment