添加4块硬盘 建立RAID 10
mdadm --create --auto=yes /dev/md10 --level=10 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
查看RAID10 : mdadm --detail /dev/md10
/dev/md10:
Version : 0.90
Creation Time : Fri Jan 4 17:36:57 2013
Raid Level : raid10
Array Size : 41942912 (40.00 GiB 42.95 GB)
Used Dev Size : 20971456 (20.00 GiB 21.47 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 10
Persistence : Superblock is persistent
Update Time : Fri Jan 4 18:05:55 2013
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : near=2
Chunk Size : 64K
UUID : da09d1b5:985cd9a0:062af5d9:f346a75a
Events : 0.4
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
3 8 64 3 active sync /dev/sde
建立物理卷: pvcreate /dev/md10
查看物理卷:pvdisplay
--- Physical volume ---
PV Name /dev/md10
VG Name wangbo
PV Size 40.00 GB / not usable 7.88 MB
Allocatable yes
PE Size (KByte) 8192
Total PE 5119
Free PE 4319
Allocated PE 800
PV UUID aLzixu-Z0Gt-Nw1F-YyRA-BUvp-V78g-jf0T7s
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 29.90 GB / not usable 24.06 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 956
Free PE 0
Allocated PE 956
PV UUID mPwuhc-jKJ2-D36V-bjbd-qOTk-4dbG-h1luIX
建立卷组 vgcreate -s 8m wangbo /dev/md10
查看卷组 vgdisplay
--- Volume group ---
VG Name wangbo
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 39.99 GB
PE Size 8.00 MB
Total PE 5119
Alloc PE / Size 800 / 6.25 GB
Free PE / Size 4319 / 33.74 GB
VG UUID GccNDS-X8Sl-7CsK-pdT2-0m1J-ronu-6bHo7x
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 29.88 GB
PE Size 32.00 MB
Total PE 956
Alloc PE / Size 956 / 29.88 GB
Free PE / Size 0 / 0
VG UUID jcMupe-Dv6v-07AV-gDC8-LAj6-yFbh-3g1i8D
建立逻辑卷 lvcreate -l 400 -n wangbo1 wangbo
查看逻辑卷 lvdisplay
--- Logical volume ---
LV Name /dev/wangbo/wangbo1
VG Name wangbo
LV UUID V6WE0f-ur8d-LczE-FSmC-NDCM-3kjy-NphgEk
LV Write Access read/write
LV Status available
# open 1
LV Size 3.12 GB
Current LE 400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 512
Block device 253:2
--- Logical volume ---
LV Name /dev/wangbo/wangbo2
VG Name wangbo
LV UUID MouC8I-v5kz-fUKt-pJOU-5gxh-n6W6-wUBl0m
LV Write Access read/write
LV Status available
# open 1
LV Size 3.12 GB
Current LE 400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 512
Block device 253:3
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID 0H4plO-32SA-qxiP-Vi1o-7rjQ-65j7-jBHE1F
LV Write Access read/write
LV Status available
# open 1
LV Size 28.81 GB
Current LE 922
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID x0KIVW-1dBA-HI7j-yzJn-LTTg-O3Mt-vR0zgb
LV Write Access read/write
LV Status available
# open 1
LV Size 1.06 GB
Current LE 34
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
建立逻辑卷 lvcreate -l 400 -n wangbo2 wangbo
在MNT下建立2个文件
mkdir /mnt/wangbo1
mkdir /mnt/wangbo2
格式化逻辑卷
mkfs.ext3 /dev/wangbo/wangbo1
mkfs.ext3 /dev/wangbo/wangbo2
挂载逻辑卷
mount /dev/wangbo/wangbo1 /mnt/wangbo1
mount /dev/wangbo/wangbo2 /mnt/wangbo2
建立用户 vim useradd.sh
#!/bin/bash
groupadd rongxin
for username in rongxin1 rongxin2 rongxin3
do
useradd -g rongxin $username
echo "123456" | passwd --stdin $username
done
sh useradd.sh
建立软链接 ln -s /home /mnt/wangbo1
从新挂载到MNT/wangbo1下并开启用户和组的配额
mount -o remount,usrquota,grpquota /mnt/wangbo1
建立数据文件quotacheck -avug
开机加载配额功能 vim /etc/fstab
开启配额quotaon -avug
编辑用户配额 edquota -u rongxin1
复制用户1配额到其他用户
edquota -p rongxin1 -u rongxin2
edquota -p rongxin1 -u rongxin3
给用户写入的权限 chmod o+w /mnt/wangbo1
切换到普通用户
su - rongxin1
[root@localhost ~]# cd /mnt/wangbo1
[root@localhost wangbo1]# chmod o+w /mnt/wangbo1
[root@localhost wangbo1]# su - rongxin1
[rongxin1@localhost ~]$ cd /mnt/wangbo1
[rongxin1@localhost wangbo1]$ dd if=/dev/zero of=rongxin1 bs=1M count=180
dm-2: warning, user block quota exceeded.
180+0 records in
180+0 records out
188743680 bytes (189 MB) copied, 7.73512 seconds, 24.4 MB/s
[rongxin1@localhost wangbo1]$ dd if=/dev/zero of=rongxin11 bs=1M count=80
dm-2: write failed, user block limit reached.
dd: 写入 “rongxin11”: 超出磁盘限额
16+0 records in
15+0 records out
15847424 bytes (16 MB) copied, 0.175949 seconds, 90.1 MB/s