How to Use LUKS to Encrypt a Disk Partition

install software
Ubuntu
apt-get install cryptsetup
aptitude install cryptsetup
Centos
yum install cryptsetup-luks

1. use device or create file

2. Encrypt the partition or file:

3. Map a logical partition:

This will create a device mapper:

4. Format the encrypted partition:

5. Mount the encrypted partition:

6. When done unmount the logical partition and close (unlock) the encrypted partition