Encrypting your drives is becoming more and more mandatory especially for mobile devices and storage media such as USB-Sticks. Cryptsetup is 'an easy to use'-tool in Linux which can take care of encrypting storage devices.
First of all, initialize the partition using cryptsetup:
# cryptsetup luksFormat /dev/sda1
WARNING!
========
This will overwrite data on /dev/sda1 irrevocably.
Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/sda1:
Verify passphrase:
Now that the partition has been initialized, open if with an assigned device-mapper name 'tempusb':
# cryptsetup open /dev/sda1 tempusb
Enter passphrase for /dev/sda1:
Now that the partition is opened, you can create a filesystem on the partition:
# mkfs.xfs /dev/mapper/tempusb
Now that the filesystem is created, you can mount it and write to it. For the sake of an example, I'll copy the /home/ directory.
# mount /dev/mapper/tempusb /mnt
# rsync -vrlptgoDxhP /home/ /mnt/
Once everything is done copying, you can unmount and close the encrypted partition:
# umount /mnt
# sudo cryptsetup close tempusb
As you can see, getting started with encrypted drives is fairly simple with cryptsetup. When using encrypted drives, keep in mind that you'll have to open and close the devices before mounting / unmounting the filesystems.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment