5,337
edits
Line 10: | Line 10: | ||
===Encrypting a device=== | ===Encrypting a device=== | ||
<syntaxhighlight lang="bash"> | |||
# Examples | |||
DEVICE=/dev/sda | |||
NAME=arr1 | |||
# Setup encryption | |||
cryptsetup -v --type luks2 --cipher aes-xts-plain64 --key-size 512 --hash sha512 \ | cryptsetup -v --type luks2 --cipher aes-xts-plain64 --key-size 512 --hash sha512 \ | ||
--iter-time 5000 --use-urandom --verify-passphrase luksFormat "${DEVICE}" | --iter-time 5000 --use-urandom --verify-passphrase luksFormat "${DEVICE}" | ||
# Open encrypted drive to /dev/mapper/$NAME | |||
cryptsetup open "${DEVICE}" "${NAME}" | cryptsetup open "${DEVICE}" "${NAME}" | ||
# Create a partition | |||
mkfs.btrfs /dev/mapper/${NAME} | mkfs.btrfs /dev/mapper/${NAME} | ||
mount -t btrfs /dev/mapper/${NAME} /media/${NAME} | |||
# Fill the drive to overwrite any existing raw data (optional) | |||
dd if=/dev/zero of=/media/$NAME/file status=progress | |||
</syntaxhighlight> | |||
dd if=/dev/zero of= | |||
</ | |||
===Mounting=== | ===Mounting=== |