磁盘管理综合测试题
[root@localhost ~]# fdisk -l | grep "/dev/" (查看dev下的所有磁盘)
磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
/dev/sda1 * 2048 1026047 512000 83 L
/dev/sda2 1026048 83886079 41430016 8e L
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/mapper/centos-root:40.2 GB, 40227569664 字节,
磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4
[root@localhost ~]# fdisk /dev/sdb (分区)
欢迎使用 fdisk (util-linux 2.23.2)。
[root@localhost ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。
[root@localhost ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。
[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd】1 (创建RAID5)
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 20954112K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@localhost ~]# pvcreate /dev/md5 (转换物理卷)
Physical volume "/dev/md5" successfully created
[root@localhost ~]# vgcreate myvg /dev/md5 (转换卷组)
Volume group "myvg" successfully created
[root@localhost ~]# vgdisplay (显示卷组)
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 39.96 GiB
PE Size 4.00 MiB
Total PE 10231
Alloc PE / Size 0 / 0
Free PE / Size 10231 / 39.96 GiB
VG UUID XF3mKL-ZWcL-PpNi-oymH-e7es-ephc-HMSpYW
[root@localhost ~]# lvcreate -L 20G -n mylv myvg (转换逻辑卷)
Logical volume "mylv" created.
[root@localhost ~]# lvdisplay (显示逻辑卷)
[root@localhost ~]# mkfs.ext4 /dev/myvg/mylv (格式化)
[root@localhost ~]# mount /dev/myvg/mylv /usr/local/apache/htdocs (挂载网站)
[root@localhost ~]# vim /etc/fstab (编辑自动挂载)
[root@localhost ~]# cd /usr/local/apache/htdocs/ (进入目录)
[root@localhost htdocs]# touch index.html (创建空文件)
[root@localhost htdocs]# vim index.html (编辑更改文件)
[root@localhost htdocs]# /usr/local/apache/bin/apachectl start (刷新)
[root@localhost htdocs]# lynx 192.168.200.99 (测试)
[root@localhost ~]# useradd axuan (建立新用户)
[root@localhost ~]# quotacheck -avug (扫描并建立quota)
[root@localhost ~]# quotaon -auvg (开启quotaon服务)
[root@localhost ~]# edquota -u axuan (编辑用户,组,的限制)
[root@localhost ~]# chmod 777 /usr/local/apache/htdocs/ (给文件夹权限)
[root@localhost ~]# su axuan (切换用户)
[axuan@localhost root]$ dd if=/dev/zero of=/usr/local/apache/htdocs/awei bs=1M count=90 (测试)