You are on page 1of 8

LUKS

 Step #1: Install cryptsetup utility

 # apt-get install cryptsetup


 Step #2: Configure LUKS partition
warning !The following command will remove all data on the
partition that you are encrypting. You WILL lose all your
information! So make sure you backup your data to an external
source such as NAS or hard disk before typing any one of the
following command.

# cryptsetup -y -v luksFormat /dev/xvdc

# cryptsetup luksOpen /dev/xvdc backup2 (to initialize and set


passphrase)

# cryptsetup -v status backup2 (to see status for the mapping )


 # cryptsetup luksDump /dev/xvdc ( to dump LUKS header)

 Step #3: Format LUKS partition

# dd if=/dev/zero of=/dev/mapper/backup2

# pv -tpreb /dev/zero | dd of=/dev/mapper/backup2


bs=128M ( PV command to monitor the progress )

# mkfs.ext4 /dev/mapper/backup2 ( create a file system )


To mount the new filesystem

 # mkdir /backup2
# mount /dev/mapper/backup2 /backup2
# df -H
# cd /backup2
# ls –l

 HOW TO UNMOUNT AND SECURE DATA :-

# umount /backup2
# cryptsetup luksClose backup2
 HOW DO I MOUNT OR REMOUNT ENCRYPTED PARTITION :-

# cryptsetup luksOpen /dev/xvdc backup2


# mount /dev/mapper/backup2 /backup2
# df -H
# mount

How CAN I RUN FSCK ON LUKS BASED PARTITION :-

# umount /backup2
# fsck -vy /dev/mapper/backup2
# mount /dev/mapper/backup2 /backu2
 CHANGE PASSPHRASE

# cryptsetup luksDump /dev/xvdc


# cryptsetup luksAddKey /dev/xvdc

REMOVE OR DELETE PASSWORD :-


cryptsetup luksRemoveKey /dev/xvdc

You might also like