实验-mount
mount /dev/sda3 /mnt/sda3
mount -o loop onekeyghost.iso /mnt/iso
mount -o remount,ro /mnt/sda3
实验-分区
添加一块大于2T的硬盘
fdisk -l
parted -l
gdisk -l /dev/sdb
gdisk /dev/sdb
实验-swap分区
fdisk /dev/sda #用n建立sda3的主分区,格式为82
partprobe
mkswap /dev/sda3
swapon -s
swapon /dev/sda3
swapon -s
swapoff /dev/sda3
swapon -s
blkid
vim /etc/fstab
UUID="34232b95-db31-4b98-b2c6-950f089f68c9" swap swap defaults 0 0
swapon -a
swapon -s
实验-lv
fdisk /dev/sda #用n建立sda4的扩展分区,在其下建立sda5和sda6两个逻辑分区,格式为8e
partprobe
pvs
pvcreate /dev/sda5 /dev/sda6
pvs
pvdisplay
vgs
vgcreate -s 32M qinvg /dev/sda5 /dev/sda6
vgs
vgdisplay
lvs
lvcreate -L 512M qinvg -n qinlv
lvs
lvdisplay
mkfs.xfs /dev/qinvg/qinlv
mkdir /mnt/qinlv
mount | grep qinlv
mount /dev/qinvg/qinlv /mnt/qinlv/
mount | grep qinlv
umount /mnt/qinlv/
mount | grep qinlv
blkid
vim /etc/fstab
UUID=c17aaeb8-589d-4f21-aaf7-434064998263 /mnt/qinlv xfs defaults 0 0
mount -a
mount | grep qinlv
umount /mnt/qinlv
lvremove /dev/qinvg/qinlv
lvs
vgremove qinvg
vgremove
pvremove /dev/sda5 /dev/sda6
pvs
fdisk -l /dev/sda #用d删除sda5和sda6分区
partprobe
实验-lv在线扩容
mount /dev/qinvg/qinlv /mnt/qinlv/
df -Th | grep qinlv
lvresize -L 2G /dev/qinvg/qinlv
df -Th | grep qinlv
xfs_growfs /mnt/qinlv/
df -Th | grep qinlv
实验-针对ext4文件系统的quota
setenforce 0
fdisk /dev/sda
umount /mnt/qinlv/
mkfs.ext4 /dev/qinvg/qinlv
mount | grep qinlv
vim /etc/fstab
UUID=c17aaeb8-589d-4f21-aaf7-434064998263 /mnt/qinlv ext4 defaults,usrquota,grpquota 0 0
mount -a
mount | grep qinlv
chmod o+rwx /mnt/qinlv
quotacheck -cvug /mnt/qinlv/
ll /mnt/qinlv
quotaon -ugv /mnt/qinlv/
setquota -u qin 10240 20480 5 6 /mnt/qinlv/
su - qin
touch /mnt/qinlv/file{1..99}
ll /mnt/qinlv
rm -f /mnt/qinlv/*
dd if=/dev/zero of=/mnt/qinlv/1 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/2 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/3 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/4 bs=1M count=9
ll /mnt/qinlv
实验-针对xfs文件系统的quota
setenforce 0
umount /mnt/qinlv/
mount | grep qinlv
mkfs.xfs /dev/qinvg/qinlv
vim /etc/fstab
UUID=c17aaeb8-589d-4f21-aaf7-434064998263 /mnt/qinlv xfs defaults,usrquota,grpquota 0 0
mount -a
mount | grep qinlv
chmod o+rwx /mnt/qinlv
setquota -u qin 10240 20480 5 6 /mnt/qinlv
su - qin
touch /mnt/qinlv/file{1..99}
ll /mnt/qinlv
rm -f /mnt/qinlv/*
dd if=/dev/zero of=/mnt/qinlv/1 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/2 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/3 bs=1M count=9
dd if=/dev/zero of=/mnt/qinlv/4 bs=1M count=9
ll /mnt/qinlv
实验-raid0
添加2块磁盘,并分区
fdisk -l | grep "Disk /dev/sd"
mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sdb1 /dev/sdc1
mkfs.xfs /dev/md0
mkdir /mnt/md0
mount /dev/md0 /mnt/md0
dd if=/dev/zero of=/mnt/md0/md0test bs=1M count=500
df - Th
mdadm -D /dev/md0
实验-raid1
mdadm -C /dev/md1 -a yes -l 1 -n 2 /dev/sdb2 /dev/sdc2
mkfs.xfs /dev/md1
mkdir /mnt/md1
mount /dev/md1 /mnt/md1
dd if=/dev/zero of=/mnt/md1/md1test bs=1M count=500
df -Th
mdadm -D /dev/md1
实验-raid5
mdadm -C /dev/md5 -a yes -l 5 -n 3 /dev/sdb3 /dev/sdc3 /dev/sdd3
mkfs.xfs /dev/md5
mkdir /mnt/md5
mount /dev/md5 /mnt/md5
dd if=/dev/zero of=/mnt/md5/md5test bs=1M count=500
df -Th
mdadm -D /dev/md5
实验-raid5坏1块硬盘
dd if=/dev/zero of=/mnt/md5/md5file bs=1M count=1000
df -Th
umount /mnt/md5
mdadm /dev/md5 -f /dev/sdd3 #模拟/dev/sdd3为坏盘
mdadm -D /dev/md5
mount /dev/md5 /mnt/md5/
ll /mnt/md5/
df -Th
mdadm /dev/md5 -r /dev/sdd3 #热拔/dev/sdd3
mdadm -D /dev/md5 #显示仅剩2块硬盘
mdadm /dev/md5 -a /dev/sdd3 #热插/dev/sdd3
mdadm -D /dev/md5 #快速查看可看到同步数据百分比变化
mount /dev/md5 /mnt/md5
ll /mnt/md5
实验-raid5热备
mdadm -C /dev/md5x -a yes -l 5 -n 3 -x 1 /dev/sdb4 /dev/sdc4 /dev/sdd4 /dev/sde4
mkfs.xfs /dev/md5x
mkdir /mnt/md5x
mount /dev/md5x /mnt/md5x
dd if=/dev/zero of=/mnt/md5x/md5xtest bs=1M count=500
df -Th
mdadm -D /dev/md6