Essays record 2019.8.2

1. The host increases 80G SCSI interface hard disk

2. Dividing each of three primary partition 20G
[the root @ localhost ~] # VI fdisk.sh
#! Bin / the bash
the fdisk / dev / SDB the EOF <<
n-
P
. 1

+20G

n
p
2

+20G

n
p
3

+20G

n

 


w
EOF
[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb:85.9 GB, 85899345920 bytes, sectors 167 772 160
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0xda48581c

The Start End Blocks Id apparatus the System the Boot
/ dev / sdb1 20971520 83 2048 41,945,087 the Linux
/ dev / sdb2 20971520 83 41,945,088 83,888,127 the Linux
/ dev / sdb3 20971520 125 831 167 83,888,128 83 the Linux
/ dev / sdb4 Extended 125 831 168 167 772 159 20,970,496. 5
. 3. The three primary partition to a physical volume (pvcreate), physical volume scanning system of
[the root @ localhost ~] # the pvcreate / dev / sdb1
the Physical Volume "/ dev / sdb1" successfully Created
[the root @ localhost ~] # the pvcreate / dev / sdb2
the Physical Volume "/ dev / sdb2" successfully Created
[the root @ localhost ~] # the pvcreate / dev / sdb3
the Physical Volume "/ dev / sdb3" successfully Created

4. Using two physical volumes create a volume group name for myvg, view volume group size
[the root @ localhost ~] #. 8 myvg the vgcreate -s / dev / SDB [12 is]
Volume Group "myvg" successfully Created
[the root @ localhost ~] # the vgdisplay / dev / myvg
--- --- Volume Group
VG of the Name myvg
the System ID
the Format LVM2
the Metadata Areas 2
the Metadata Sequence No. 1
VG of Access Read / Write
VG of the Status resizable
MAX the LV 0
the Cur the LV 0
the Open the LV 0
Max 0 the PV
the Cur the PV 2
2 the PV ACT
VG of Size 39.98 GiB
the PE Size 8.00 MiB
the Total 5118 the PE
of Alloc the PE / Size 0/0
as Free the PE / Size 5118 / 39.98 GiB
VG of the UUID vReCKf-e33K-bjt3-WzZI-wJ9Y-hQGA-sR5TXZ

5. Create a logical volume mylv, size 30G
[root @ localhost ~] # lvcreate -L 30G -n mylv myvg
the Logical Volume "mylv" the Created.
6. The logical volume formatted xfs file system, and mounted onto / data directory, create file test
[the root @ localhost ~] # the mkfs -t xfs / dev / myvg / mylv
Meta-Data = / dev / myvg / mylv an array of lSize = 256 agcount =. 4, agsize = 1.96608 million BLKS
= sectsz = 512 attr = 2, projid32bit =. 1
= CRC = 0 finobt = 0
Data = BSIZE = 4096 Blocks = 7864320, imaxpct = 25
= SUnit = 0 SWidth = 0 BLKS
Naming = Version 2 BSIZE = 4096 ASCII-CI = 0 FTYPE = 0
log = Internal log BSIZE = 4096 Blocks = a 3840, Version = 2
= sectsz = 512 SUnit = 0 BLKS, the lazy-COUNT =. 1
Realtime = none extsz = 4096 Blocks = 0, = 0 rtextents
[the root @ localhost ~] # mkdir / Data
[the root @ localhost ~] # Mount / dev / myvg / mylv / Data

7.增大逻辑卷到35G
[root@localhost ~]# lvextend -L +5G /dev/myvg/mylv
Size of logical volume myvg/mylv changed from 30.00 GiB (3840 extents) to 35.00 GiB (4480 extents).
Logical volume mylv successfully resized

8. Edit / etc / fstab file to mount logical volumes and supports disk quotas options
[root @ localhost ~] # vim / etc / fstab
/ dev / myvg / mylv / XFS the Data Defaults, usrquota, grpquota 0 0

9. Create a disk quota, crushlinux user / data directory under the file size is limited to soft 80M, a hard limit of 100M,
crushlinux user / data directory under the file number of the soft limit is 80, a hard limit of 100.
[the root @ localhost ~] # Mount -a
[the root @ localhost ~] # the quotacheck -vug / Data /
the quotacheck: Skipping / dev / Mapper / myvg-mylv [/ Data]
the quotacheck: Can Not Find filesystem to filesystem or Not Check with Mounted Option quota.
[the root @ localhost ~] # the quotaon -uv / Data /
the quotaon: Enforcing User quota already ON / dev / Mapper / myvg-mylv
[the root @ localhost ~] # the useradd -d / Data / Milk Milk
[the root @ localhost ~] # Milk the edquota -u
/ dev / Mapper / myvg-12 is mylv 81920 80 100 102400. 7

10. Use touch dd command tested at / data directory
[the root @ localhost ~] # SU Milk
[Milk @ localhost the root] $ CD
[Milk @ localhost ~] $ Touch A
[Milk @ localhost ~] $ dd IF = / dev / ZERO = of / BS = B = 100 1M COUNT.
dd: write "./b" error: disk quota exceeded
record 100 + 0 read into
the recording to write the 99 + 0
104837120 bytes (105 MB) copied , 3.20284 seconds, 32.7 MB / sec

11. View usage quotas: a user's perspective
[Milk @ localhost ~] $ du -SH
100M.

12. View usage quotas: File System angle
[root @ localhost Milk] # -auvs the repquota
*** Report a quotas for the User Device ON / dev / Mapper / myvg-mylv
Block Grace Time: 7days; Inode Grace Time: 7days
Space Limits File Limits
the User Used Used Soft Hard Soft Hard Grace Grace
---------------------------------------- ------------------------------
the root -. 3 0 0 0K 0K 0K
Milk + - 81920K 100M 100M 6days 14 80 100

*** Status for user quotas on device /dev/mapper/myvg-mylv
Accounting: ON; Enforcement: ON
Inode: #131 (2 blocks, 2 extents)

Guess you like

Origin www.cnblogs.com/lyqlyqlyq/p/11288212.html