不能让随便什么人都可以进入磁盘,不然很有可能会导致一些危险的事情发生,所以,我们要学会对磁盘进行加密保护。
一、加密保护
步骤:
[root@localhost ~]# fdisk /dev/vdb ##建一个id1
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00012042
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2050047 1024000 83 Linux
Command (m for help): wq
The partition table has been altered!
[root@localhost ~]# partprobe ##手动同步分区
Are you sure? (Type uppercase yes): YES ##必须大写
Enter passphrase:
Verify passphrase:
[root@localhost ~]# cryptsetup open /dev/vdb1 westos ##把这个打开 ##westos名字随便起
Enter passphrase for /dev/vdb1:
[root@localhost ~]# ls /dev/mapper/westos /mnt/
/dev/mapper/westos
/mnt/: