磁盘管理综合测试

[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x2ce67a99 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x81884075 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x87195fa0 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk -l

磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x00099607

设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 83886079 40893440 8e Linux LVM

磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x2ce67a99

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 83 Linux

磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x81884075

设备 Boot Start End Blocks Id System
/dev/sdc1 2048 41943039 20970496 83 Linux

磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x87195fa0

设备 Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 83 Linux

磁盘 /dev/mapper/centos-root:39.7 GB, 39720058880 字节,77578240 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

[root@localhost ~]# rpm -q mdadm
mdadm-4.0-5.el7.x86_64
[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd]1
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 myly /dev/md5
Volume group "myly" successfully created
[root@localhost ~]# vgremove myly
Volume group "myly" successfully removed
[root@localhost ~]# vgcreate myvg /dev/md5
Volume group "myvg" successfully created
[root@localhost ~]# lvcreate -L 30G -n myly myvg
Logical volume "myly" created.
[root@localhost ~]# mkfs.ext4 /dev/myvg/myly
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2155872256
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

[root@localhost ~]# mount /dev/myvg/myly /usr/local/apache/htdocs
[root@localhost ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 37G 5.3G 32G 15% /
devtmpfs devtmpfs 977M 0 977M 0% /dev
tmpfs tmpfs 993M 0 993M 0% /dev/shm
tmpfs tmpfs 993M 9.0M 984M 1% /run
tmpfs tmpfs 993M 0 993M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 161M 854M 16% /boot
tmpfs tmpfs 199M 4.0K 199M 1% /run/user/42
tmpfs tmpfs 199M 20K 199M 1% /run/user/0
/dev/sr0 iso9660 8.1G 8.1G 0 100% /run/media/root/CentOS 7 x86_64
/dev/mapper/myvg-myly ext4 30G 45M 28G 1% /usr/local/apache/htdocs
[root@localhost ~]# vim /etc/fstab


   [root@localhost htdocs]# touch index.html
[root@localhost htdocs]# lynx 192.168.153.8
[root@localhost htdocs]# ls
index.html lost+found
[root@localhost htdocs]# vim index.html
[root@localhost htdocs]# lynx 192.168.153.8

 

  [root@localhost ~]# useradd jinlintao
[root@localhost ~]# mount -o remount,usrquota,grpquota /usr/local/apache/htdocs/[root@localhost ~]# mount | tail -1
/dev/mapper/myvg-myly on /usr/local/apache/htdocs type ext4 (rw,relatime,quota,usrquota,grpquota,stripe=256,data=ordered)
[root@localhost ~]# vi /etc/fstab
[root@localhost ~]# quotacheck -avug
quotacheck: Your kernel probably supports journaled quota but you are not using i. Consider switching to journaled quota to avoid running quotacheck after an unclan shutdown.
quotacheck: Scanning /dev/mapper/myvg-myly [/usr/local/apache/htdocs] done
quotacheck: Cannot stat old user quota file /usr/local/apache/htdocs/aquota.user:没有那个文件或目录. Usage will not be subtracted.
quotacheck: Cannot stat old group quota file /usr/local/apache/htdocs/aquota.grou: 没有那个文件或目录. Usage will not be subtracted.
quotacheck: Cannot stat old user quota file /usr/local/apache/htdocs/aquota.user:没有那个文件或目录. Usage will not be subtracted.
quotacheck: Cannot stat old group quota file /usr/local/apache/htdocs/aquota.grou: 没有那个文件或目录. Usage will not be subtracted.
quotacheck: Checked 2 directories and 1 files
quotacheck: Old file not found.
quotacheck: Old file not found.
[root@localhost ~]# quotaon -avug
/dev/mapper/myvg-myly [/usr/local/apache/htdocs]: group quotas turned on
/dev/mapper/myvg-myly [/usr/local/apache/htdocs]: user quotas turned on
[root@localhost ~]# edquota -u jinlintao
[root@localhost ~]# chmod -R 777 /usr/
chmod: 更改"/usr/local/apache/htdocs/aquota.group" 的权限: 不允许的操作
chmod: 更改"/usr/local/apache/htdocs/aquota.user" 的权限: 不允许的操作
Try 'chmod --help' for more information.

[root@localhost ~]# su - jinlintao

密码

[jinlintao@localhost ~]$ dd if=/dev/zero of=/usr/local/apache/htdocs/ceshi bs=1M count=100
dm-2: warning, user block quota exceeded.
记录了100+0 的读入
记录了100+0 的写出
104857600字节(105 MB)已复制,0.528268 秒,198 MB/秒
[jinlintao@localhost ~]$ dd if=/dev/zero of=/usr/local/apache/htdocs/ceshi bs=1M count=500
dm-2: warning, user block quota exceeded.
dm-2: write failed, user block limit reached.
dd: 写入"/usr/local/apache/htdocs/ceshi" 出错: 超出磁盘限额
记录了101+0 的读入
记录了100+0 的写出
104857600字节(105 MB)已复制,0.119654 秒,876 MB/秒
[jinlintao@localhost ~]$

猜你喜欢

转载自www.cnblogs.com/4545945a/p/11298724.html