分区
fdisk /dev/vdb
        vfat
        ntfs
        ext
        xfs
n
p
1
2048
+100M
p
partprobe
Command (m for help): m
Command action
   a  toggle a bootable flag
   b  edit bsd disklabel
   c  toggle the dos compatibility flag
   d  delete a partition                      删除分区
   g  create a new empty GPT partition table
   G  create an IRIX (SGI) partition table
   l  list known partition types
   m  print this menu
   n  add a new partition                     新建分区
   o  create a new empty DOS partition table
   p  print the partition table               显示分区
   q  quit without saving changes             推出不保存
   s  create a new empty Sun disklabel
   t  change a partition's system id          修改分区功能id
   u  change display/entry units
   v  verify the partition table
   w  write table to disk and exit            保存更改到分区表中
   x  extra functionality (experts only)
[root@localhost ~]# fdisk /dev/vdb
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.

                                                                                                                                                             1,4-3         Top
Command (m for help): d
Partition number (1-5, default 5):
Partition 5 is deleted

Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (618496-20971519, default 618496):
Using default value 618496
Last sector, +sectors or +size{K,M,G} (618496-20971519, default 20971519):+100M
Partition 5 of type Linux and of size 100 MiB is set

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
分区类型位主分区
分区类型位扩展分区
[root@localhost ~]# cat /proc/partitions
major minor  #blocks  name

 253        0  10485760 vda
 253        1  10484142 vda1
 253      16   10485760 vdb
 253      17     102400 vdb1
 253      18     102400 vdb2
 253      19     102400 vdb3
 253      20          1 vdb4
 253      21     102400 vdb5
fdisk -l         查看系统上能识别的设备
cat /proc/partitions
mkfs.xfs /dev/vdb5      格式化分区/dev/vdb5(换个文件系统)之后即可识别,挂载使用
blkid                   查看系统可用的设备
swapon -s               查看swap 分区大小使用情况
2.swap


3.磁盘加密
fdisk /dev/vdb
cryptsetup luksFormat /dev/vdb1
cryptsetup open /dev/vdb1 westos
mkfs.xfs /dev/mapper/westos
mount /dev/mapper/westos /mnt/
umount /mnt/
cryptsetup close westos
 cryptsetup open /dev/vdb1 lol
       cryptsetup luksFormat/dev/vdb1  密码设置成功不提示
       cryptsetup open /dev/vdb1 lol    打开才能用 ll/dev/mapper/ 查看
   13 ll /dev/mapper/
   14 mkfs.xfs /dev/mapper/lol
   15 mount /dev/mapper/lol /mnt/
   16 df
   17 cd /mnt/             保存文件数据  挂载前后识别的是不同的设备
   18 touch tiomo
   19 vim tiomo
   20 cat tiomo
   21 umount /mnt/
   22 cd
   25 umount /mnt/
   26 cryptsetup close lol
                                                                              22.加密磁盘的永久挂载
vim /etc/crypttab
解密后设备文件管理文件 设备 加密字符存放文件
vim /root/lukspdfile
chmod 600 /root/lukspsfile
cryptsetup luksAddKey /dev/vdb1 /root/lukspsfile
vim /etc/fstable
    /dev/mapper/taxing /mnt xfs defaults 00
reboot
3.加密清除
vim /etc/fstab
> /etc/crypttab
rm -rf /root/lukspsfile
umount /mnt
cryptsetup close taxing
mkfs.xfs /dev/vdb1
4.磁盘阵列
C创建
l执行级别
a如果没有这个盘自动建立
n同时几块盘创建riad
x闲置
    1 fdisk /dev/vdb
    3 partprobe
    4 cat /proc/partitions
    6 mdadm -C /dev/md0 -a yes -l 1 -n 2 -x 1 /dev/vdb{1..3}
    7 mkfs.xfs /dev/md0
    8 cat /proc/partitions
    9 mount /dev/md0 /mnt/
   10 df
   11 cd /mnt/
   12 touch aa
   13 ls
watch -n 1 cat /proc/mdstat 监控/dev/md0 状态

停止磁盘阵列
   15 mdadm -f /dev/md0 /dev/vdb1  先 -f(使停止。处于损坏的状态) 再 -r(使删除)
   16 mdadm -r /dev/md0 /dev/vdb1
   17 mdadm -f /dev/md0 /dev/vdb3
   18 mdadm -r /dev/md0 /dev/vdb3
   20 mdadm -f /dev/md0 /dev/vdb2  最后一块在使用,不能删除,需要停止磁盘阵列
   21 df
   22 umount /mnt/
   23 cd
   24 umount /mnt/         停止磁盘阵列前先卸载
   25 mdadm -S /dev/md0        停止磁盘阵列
5.配额
mkdir /pub
 chmod 1777 /pub/
mount -o usrquota /dev/vdb1 /pub
quotaon -uv /dev/vdb1   指定激活显示
edquota -u student  编辑设置
Disk quotas for user taxing (uid 1001):
  Filesystem                   blocks       soft       hard    inodes     soft     hard
  /dev/vdb1                    482800          0    500000          1        0       0
~                                                                                               
 su - taxing
[taxing@localhost pub]$ dd if=/dev/zero of=/pub/file bs=1M count=500
dd: error writing ‘/pub/file’: No space left on device
472+0 records in
471+0 records out
494387200 bytes (494 MB) copied, 2.10227 s, 235 MB/s
永久挂载(开机启动)
vim /etc/fstab
    /dev/vdb1    /mnt    xfs     defaults,usrquota   0   0