Btrfs with encription


Make sure btrfs support is installed in your kernel

File systems  --->
    <*> Btrfs filesystem

Install needed packages

emerge -av sys-fs/btrfs-progs sys-fs/cryptsetup

Make sure the following flags are enabled for sys-fs/cryptsetupgcrypt: nls python udev pwquality. dev-libs/libpwquality is used for password quality checking.

Prepare disk:

parted -a optimal /dev/sdX

(parted) help
(parted) print
(parted) mklabel gpt
(parted) mkpart primary btrfs 0% 100%
(parted) name 1 storage_XX
(parted) print
(parted) quit
create filesystem
mkfs.btrfs /dev/sdX1

Encrypt disk

cryptsetup luksFormat -v /dev/sdX

To open the disk use

cryptsetup luksOpen /dev/sdX DRIVE_name

To get automated mounting, first find UUID and then modify cryptab conf file.
Command blkid can be used to get the new UUID of the drive.
Modify /etc/crypttab with your desired drive name and the partitions UUID:

DRIVE_name    UUID=your_uuid   none    luks

Crypt details can be seen with

cryptsetup luksDump /dev/sdX

For more detail see archlinux.


Comments are closed.