#cryptsetup luksFormat /dev/sdb6 (以luks方式加密)vim
#cryptsetup luksOpen /dev/sdb6 redhat (開啓luks,並映射到redhat)app
#mkfs.ext4 /dev/mapper/redhatide
#mount /dev/mapper/redhat /luks (用設備映射來掛載)加密
#umount /luksspa
#cryptsetup luksClose redhat (關閉luks)orm
#vim /etc/fstab
(在fstab文件中.設定開機自動啓動)
/dev/mapper/redhat /luks ext4 defaults 0 0
#vim /etc/crypttab
(在crypttab文件中指定,開機時,自動驗證luks,同時設備映射)
redhat /dev/sdb6 /root/key luks
#cryptsetup luksAddKey /dev/sdb6 /root/key (加入一個密鑰)
#cryptsetup luksDump /dev/sdb6 查看luks頭部信息,以及加密信息.
#cryptsetup luksDelKey /dev/sdb6 2 (刪除2號密鑰)