To prepare your external SSD for use in Linux, you can use the following tools:
- Use
lsblkorfdisk -lto identify your external SSD device. - Use
fdiskorpartedto create and manage partitions on the SSD. - Use
mkfs.ext4to format the created partitions with the ext4 filesystem. - For a graphical interface, consider using
gparted.
lsblk
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 1000G 0 part /media/<USER>/SP-Part1
├─sda2 8:2 0 700G 0 part /media/<USER>/SP-Part2
└─sda3 8:3 0 100G 0 part /media/<USER>/SP-Part3
# Install cryptosetup
sudo apt install cryptsetup# Unmound
sudo umount /dev/sda1
# Remove filesystem signatures
sudo wipefs -a /dev/sda1
# Encrypt the disk
sudo cryptsetup luksFormat /dev/sda1
# Open the encrypted volume
sudo cryptsetup open /dev/sda1 SP-Part1
# Format with ext4
sudo mkfs.ext4 /dev/mapper/SP-Part1
# Mount it (change <USER> with your username)
sudo mkdir -p /media/<USER>/SP-Part1
sudo mount /dev/mapper/SP-Part1 /media/<USER>/SP-Part1
# Unmound and lock (change <USER> with your username)
sudo umount /media/<USER>/SP-Part1
sudo cryptsetup close SP-Part1
# Backup the LUKS header
sudo cryptsetup luksHeaderBackup /dev/sda1 --header-backup-file ~/LUKS-SP-Part1-header-backup.binPlug out and plug in the SSD again. After unlocking the partition, If you see random alphanumeric name, you can change it to a more friendly name.
Find the mapped devices with:
ls /dev/mapper/You should see something like:
luks-753c957e-c028-4d50-b86c-0dca83314b67
Label the filesystem:
sudo e2label /dev/mapper/luks-753c957e-c028-4d50-b86c-0dca83314b67 SP-Part1sudo cryptsetup luksHeaderRestore /dev/sda1 --header-backup-file ~/LUKS-SP-Part1-header-backup.bin