Created
April 14, 2020 10:03
-
-
Save jmtsantos/7e755a1049ae59ba8badf9d91323c086 to your computer and use it in GitHub Desktop.
bcache + LUKS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Small guide to create a LUKS disk on top of a bcache device using an SSD and HDD | |
# Setup | |
# /dev/sda cache device (SSD) | |
# /dev/sdb backing device (HDD) | |
# Create the bcache | |
# --block should match the sector size of the backing device | |
# --bucket should match the cache size of the cache device | |
# You can ommit these two arguments and just use the default values | |
make-bcache -B /dev/sdb -C /dev/sda --block 4k --bucket 2M | |
# Change the cache mode to `writeback` this makes a slight dent on performance | |
# but it improves stability | |
echo writeback > /sys/block/bcache0/bcache/cache_mode | |
# Create the LUKS device on top of the newly created bcache device /dev/bcache0 | |
cryptsetup luksFormat /dev/bcache0 keyfile.bin | |
cryptsetup luksOpen --key-file keyfile.bin /dev/bcache0 storage | |
# Format it with your FS of choice | |
mkfs.btrfs /dev/mapper/storage | |
# Dont forge to update your /etc/crypttab and /etc/fstab to open the device on boot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment