Skip to content

Instantly share code, notes, and snippets.

@hoto
Created August 8, 2017 18:18
Show Gist options
  • Save hoto/0350245abfae14ad780c5999d64e615b to your computer and use it in GitHub Desktop.
Save hoto/0350245abfae14ad780c5999d64e615b to your computer and use it in GitHub Desktop.
# Be root.
cd /dev
su - # Or “sudo -s”.
# Make sure that the device is not mounted.
umount sdb*
# source: http://www.linuxquestions.org/questions/slackware-14/harddisk-shredding-uncredibly-slow-any-speed-up-possible-635202/
# Format the device for encryption.
cryptsetup luksFormat --cipher aes-xts-plain64 --hash sha512 --key-size 512 \
--use-random --verify-passphrase sdb
cryptsetup luksOpen sdb luks-sdb
shred -n 1 mapper/luks-sdb
# Create a file-system.
mkfs -t ext4 -L "FILE_SYSTEM_LABEL" mapper/luks-sdb # Linux Ext4, or
mkfs -t ntfs -L "FILE_SYSTEM_LABEL" mapper/luks-sdb # Windows NTFS.
# If using Ext4, make sure that you can write to it.
# Not needed for NTFS (unless you use NTFS-3G Windows–Linux user-mapping).
mount mapper/luks-sdb /mnt
chown your_user_name: /mnt
umount /mnt
# Clean up.
cryptsetup luksClose mapper/luks-sdb
sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment