Finished luks setup

This commit is contained in:
2020-05-20 12:47:30 +02:00
parent 76f1a35a46
commit a03a4adc96
4 changed files with 33 additions and 23 deletions

View File

@@ -4,8 +4,9 @@ echo "Mounts encrypted storages"
set_device_mount_and_mapper_paths
partition_path="$device_path""1"
info "Unlock partition..." &&
sudo cryptsetup luksOpen $device_path $mapper_name ||
sudo cryptsetup luksOpen $partition_path $mapper_name ||
error
info "Mount partition..." &&

View File

@@ -3,38 +3,43 @@ echo "Setups disk encryption"
set_device_mount_and_mapper_paths
info "Overwritting device \"$device_path\" with zeros..." &&
sudo dd if=/dev/zero of=$device_path bs=$OPTIMAL_BLOCKSIZE status=progress conv=fdatasync ||
error
overwritte_device_with_zeros
info "Creating new GPT partition table..."
( echo "g" # create a new empty GPT partition table
echo "w" # Write partition table
)| sudo fdisk "$device_path" || error
)| sudo fdisk --wipe always "$device_path" ||
error
info "Creating partition table..."
( echo "n" # Create GPT partition table
( echo "n" # Create new partition
echo "" # Accept default
echo "" # Accept default
echo "" # Accept default
echo "p" # Create GPT partition table
echo "w" # Write partition table
)| sudo fdisk "$device_path" || error
info "Show memory devices..." &&
sudo fdisk -l || error
)| sudo fdisk --wipe always "$device_path" ||
error
partition_path="$device_path""1"
info "Encrypt $device_path..." &&
sudo cryptsetup -v -y luksFormat $device_path
sudo cryptsetup -v -y luksFormat $partition_path ||
error
info "Unlock partition..." &&
sudo cryptsetup luksOpen $device_path $mapper_name
sudo cryptsetup luksOpen $partition_path $mapper_name ||
error
info "Create btrfs file system..." &&
sudo mkfs.btrfs $mapper_path || error
info "Creating mount folder unter \"$mount_path\"..." &&
mkdir -p $mount_path || error
sudo mkdir -p $mount_path || error
info "Mount partition..." &&
sudo mount $mapper_path $mount_path || error
sudo mount $mapper_path $mount_path ||
error
info "Own partition by user..." &&
sudo chown -R $USER:$USER $mount_path || error
sudo chown -R $USER:$USER $mount_path ||
error