试过给磁盘加密后,今晚试了下给U盘加密,步骤如下:
1. 创建cryptsetup_LUKS类型分区.
cadenwu@cadenwu-laptop:~$ sudo fdisk -l
Disk /dev/sdc: 8024 MB, 8024752128 bytes
247 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 15314 * 512 = 7840768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xad7cc6ed
Device Boot Start End Blocks Id System
/dev/sdc1 1 1023 7833080 7 HPFS/NTFS
|
以上的是我8G的金士顿U盘,/dev/sdc1只有一个分区,文件系统为NTFS。
cadenwu@cadenwu-laptop:~$ lsmod |grep crypt
cryptd 8116 0
dm_crypt 13043 1
|
检查是否将必需的模块加载进来,如果没有先加载。
sudo modprobe cryptoloop
sudo modprobe dm_crypt
|
创建加密分区类型
cadenwu@cadenwu-laptop:~$ sudo cryptsetup luksFormat /dev/sdc1
========
This will overwrite data on /dev/sdc1 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
|
2. 创建文件系统
cadenwu@cadenwu-laptop:~$ sudo mkfs.ext4 /dev/sdc1
|
3. 打开加密分区和关闭加密分区
打开加密分区
cadenwu@cadenwu-laptop:~$ sudo mkdir /mnt/usb
cadenwu@cadenwu-laptop:~$ sudo mount /dev/mapper/lusk /mnt/usb/
cadenwu@cadenwu-laptop:~$ sudo chown cadenwu:cadenwu /mnt/usb/
|
关闭加密分区
cadenwu@cadenwu-laptop:~$ sudo umount /mnt/usb/
cadenwu@cadenwu-laptop:~$ sudo cryptsetup luksClose /dev/mapper/lusk
|
(注意:目前在Windows下是认不出这个加密分区的,不要将U盘给全格了 :) )
阅读(1495) | 评论(0) | 转发(0) |