prepare_luks.sh 349 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # Overwrite default variables from config file
  3. [ -f ./config.sh ] && source config.sh
  4. # Check if partition exists
  5. disk2=$disk"p3"
  6. if [ -b $disk2 ]
  7. then
  8. echo $disk2 does not exist!
  9. exit
  10. fi
  11. mkdir -p /srv/data
  12. cryptsetup luksFormat $disk2
  13. cryptsetup luksOpen $disk2 data
  14. mkfs.ext4 /dev/mapper/data
  15. mount /dev/mapper/data /srv/data