如上图,加了三个磁盘
现在,先开始做raid0
工具 mdadm
命令常用参数
-C或--creat | 建立一个新阵列 | -r | 移除设备 |
-A | **磁盘阵列 | -l 或--level= | 设定磁盘阵列的级别 |
-D或--detail | 打印阵列设备的详细信息 | -n或--raid-devices= | 指定阵列成员(分区/磁盘)的数量 |
-s或--scan | 扫描配置文件或/proc/mdstat得到阵列缺失信息 | -x或--spare-devicds= | 指定阵列中备用盘的数量 |
-f | 将设备状态定为故障 | -c或--chunk= | 设定阵列的块chunk大小 ,单位为KB |
-a或--add | 添加设备到阵列 | -G或--grow | 改变阵列大小或形态 |
-v | --verbose 显示详细信息 |
分好区
[[email protected] ~]# mdadm -C /dev/md11 -l 0 -n 3 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md11 started. [[email protected] ~]# mdadm -Ds ARRAY /dev/md11 metadata=1.2 name=duwen113.cn:11 UUID=6689430a:4d3a76e2:9a832442:bf61bdfa [[email protected]uwen113 ~]#
效果如下图
生成配置文件
[[email protected] ~]# fdisk /dev/md11
[[email protected] ~]# ls /dev/md* /dev/md11 /dev/md11p1 [[email protected] ~]#
开始加密
[[email protected] ~]# ls /dev/md* /dev/md11 /dev/md11p1 [[email protected] ~]# cryptsetup luksFormat /dev/md11p1 WARNING! ======== This will overwrite data on /dev/md11p1 irrevocably. Are you sure? (Type uppercase yes): YES Enter passphrase: //这里输入密码51cto.com Verify passphrase: //这里输入密码51cto.com [[email protected] ~]# cryptsetup luksOpen /dev/md11p1 ys_disk Enter passphrase for /dev/md11p1: [[email protected] ~]# mkdir /ys_disk [[email protected] ~]# mkfs.xfs /dev/mapper/ys_disk meta-data=/dev/mapper/ys_disk isize=256 agcount=16, agsize=191872 blks = sectsz=4096 attr=2, projid32bit=1 = crc=0 finobt=0 data = bsize=4096 blocks=3069952, imaxpct=25 = sunit=128 swidth=384 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [[email protected] ~]# mount /dev/mapper/ys_disk /ys_disk/ [[email protected] ~]# touch /root/cryptpasswd [[email protected] ~]# cryptsetup luksAddKey /dev/md11p1 /root/cryptpasswd Enter any passphrase: //这里输入密码51cto.com [[email protected] ~]# cat /root/cryptpasswd [[email protected] ~]# vim /etc/crypttab [[email protected] ~]# [[email protected] ~]# vim /etc/fstab [[email protected] ~]# tail -1 $! tail: cannot open '1823' for reading: No such file or directory [[email protected] ~]# tail -1 /etc/fstab /dev/mapper/ys_disk /ys_disk xfs defaults 0 0 [[email protected] ~]#
测试一下加密是否成功
看到那个红框了吧,是需要输入密码才可以进去的 //红框这里输入密码51cto.com
The end
转载于:https://blog.51cto.com/duwers/1790967