作业 8.1

1.为主机增加80G SCSI 接口硬盘

                           

2.划分三个各20G的主分区

[root@localhost ~]# fdisk /dev/sdb

欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。

使用写入命令前请三思。

Device does not contain a recognized partition table

使用磁盘标识符 0xbfebc522 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

分区号 (1-4,默认 1):1

起始 扇区 (2048-167772159,默认为 2048):

将使用默认值 2048

Last 扇区, +扇区 or +size{K,M,G} (2048-167772159,默认为 167772159):+20G

分区 1 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):N

Partition type:

   p   primary (1 primary, 0 extended, 3 free)

   e   extended

Select (default p): p

分区号 (2-4,默认 2):2

起始 扇区 (41945088-167772159,默认为 41945088):

将使用默认值 41945088

Last 扇区, +扇区 or +size{K,M,G} (41945088-167772159,默认为 167772159):+20G

分区 2 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):n

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): p

分区号 (3,4,默认 3):3

起始 扇区 (83888128-167772159,默认为 83888128):

将使用默认值 83888128

Last 扇区, +扇区 or +size{K,M,G} (83888128-167772159,默认为 167772159):+20G

分区 3 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):wq

The partition table has been altered!

Calling ioctl() to re-read partition table.

正在同步磁盘。

3.将三个主分区转换为物理卷(pvcreate),扫描系统中的物理卷

[root@localhost ~]# pvcreate /dev/sdb[123]

  Physical volume "/dev/sdb1" successfully created

  Physical volume "/dev/sdb2" successfully created

  Physical volume "/dev/sdb3" successfully created

[root@localhost ~]# pvscan

  PV /dev/sda2   VG centos   lvm2 [39.51 GiB / 44.00 MiB free]

  PV /dev/sdb2               lvm2 [20.00 GiB]

  PV /dev/sdb1               lvm2 [20.00 GiB]

  PV /dev/sdb3               lvm2 [20.00 GiB]

  Total: 4 [99.51 GiB] / in use: 1 [39.51 GiB] / in no VG: 3 [60.00 GiB]

4.使用两个物理卷创建卷组,名字为myvg,查看卷组大小

[root@localhost ~]# vgcreate -s 8 vg0 /dev/sdb[12]

  Volume group "vg0" successfully created

5.创建逻辑卷mylv,大小为30G

[root@localhost ~]# lvcreate -L 30G -n mylv vg0

  Logical volume "mylv" created.

6.将逻辑卷格式化成xfs文件系统,并挂载到/data目录上,创建文件测试

[root@localhost ~]# mkfs -t xfs /dev/vg0/mylv

meta-data=/dev/vg0/mylv          isize=256    agcount=4, agsize=1310720 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=5242880, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@localhost ~]# mkdir /data

[root@localhost ~]# mount /dev/vg0/mylv /data

7.增大逻辑卷到35G

[root@localhost ~]# lvextend -L +5G /dev/vg0/mylv

  Size of logical volume vg0/mylv changed from 30.00 GiB (2560 extents) to 35.00 GiB (4480 extents).

  Logical volume mylv successfully resized

8.编辑/etc/fstab文件挂载逻辑卷,并支持磁盘配额选项

9.创建磁盘配额,crushlinux用户在/data目录下文件大小软限制为80M,硬限制为100M,

crushlinux用户在/data目录下文件数量软限制为80个,硬限制为100个。

[root@localhost ~]# edquota -u crushlinux

edquota: Bad format:

edquota: Cannot read quotas from file.

10.使用touch dd 命令在/data目录下测试

[root@localhost ~]# cd /data

[root@localhost data]# touch dd

[root@localhost data]# ls

dd

11.查看配额的使用情况:用户角度 [milk@localhost ~]$ du -sh 100M .

12.查看配额的使用情况:文件系统角度 [root@localhost milk]# repquota -auvs *** Report for user quotas on device /dev/mapper/myvg-mylv Block grace time: 7days; Inode grace time: 7days                         Space limits                File limits User            used    soft    hard  grace    used  soft  hard  grace ------------------------------------

猜你喜欢

转载自www.cnblogs.com/baoqingrui/p/11290679.html
8.1