raid下创建lvm并开启配额管理功能

1添加四块硬盘 并格式化

2做raid 10
 mdadm --create --auto=yes /dev/md10 --level=10 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

3设置开机自动加载raid
mdadm --detail /dev/md10


UUID : 0dee9159:879b236f:56dd61cf:068f03c4
vim /etc/mdadm.conf

ARRAY  /dev/md10 UUUID=0dee9159:879b236f:56dd61cf:068f03c4
vim /etc/fstab
/dev/md10  /mnt/raid10  ext3  defaults   0   0


4创建pv
[root@192 ~]# pvcreate /dev/md10
  Physical volume "/dev/md10" successfully created
[root@192 ~]# pvdisplay
  /dev/cdrom: open failed: 找不到介质
  "/dev/md10" is a new physical volume of "39.99 GB"
  --- NEW Physical volume ---
  PV Name               /dev/md10
  VG Name              
  PV Size               39.99 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               T9iEkf-0TEv-ENuj-BP1j-z39P-j8ig-oJrltv

5创建vg
[root@192 ~]# vgcreate -s 5m  zhang /dev/md10
  Physical extent size must be a power of 2.
[root@192 ~]# vgcreate -s 8m  zhang /dev/md10
  Volume group "zhang" successfully created
[root@192 ~]# vgdisplay
  --- Volume group ---
  VG Name               zhang
  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.98 GB
  PE Size               8.00 MB
  Total PE              5118
  Alloc PE / Size       0 / 0  
  Free  PE / Size       5118 / 39.98 GB
  VG UUID               xmHO9g-Eb5P-Dyhy-4VGI-hgxQ-9n3z-bOCQMN

 


6建立lv
[root@192 ~]# lvcreate -l 100 -n peng zhang
  Logical volume "peng" created
[root@192 ~]# lsdisplay
bash: lsdisplay: command not found
[root@192 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/zhang/peng
  VG Name                zhang
  LV UUID                ay1FM6-nSUu-Olgj-7mlj-2brm-QavB-Q9W4Pw
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                800.00 MB
  Current LE             100
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:0


7 格式化
 mkfs.ext3 /dev/zhang/peng
8放大
  
lvresize -l +100 /dev/zhang/peng
  Extending logical volume peng to 1.56 GB
  Logical volume peng successfully resized


resize2fs /dev/zhang/peng

9快照
lvcreate -l 100 -s -n backup /dev/zhang/peng

10  磁盘配额
  添加用户
 vim useradd.sh
[root@192 mn]# sh useradd.sh
Changing password for user laoyu1.
passwd: all authentication tokens updated successfully.
Changing password for user laoyu2.
passwd: all authentication tokens updated successfully.
Changing password for user laoyu3.
passwd: all authentication tokens updated successfully.
Changing password for user laoyu4.
passwd: all authentication tokens updated successfully.
Changing password for user laoyu5.
passwd: all authentication tokens updated successfully.
 
创建目录并挂载 开启配额功能
mkdir -pv /mnt/guazai/
 mount /dev/zhang/peng /mnt/guazai/
建立数据文件
quotacheck -avug
开机加载配额功能
vim /etc/fstab
开启配额
quotaon -avug
编辑用户配额
edquota -u laoyu1
edquota -p laoyu1  -u laoyu2
edquota -p laoyu1  -u laoyu3
edquota -p laoyu1  -u laoyu4
edquota -p laoyu1  -u laoyu5
验证
chmod o+w /mnt/guazai
su - laoyu1
cd /mnt/guazai
[laoyu1@192 guazai]$ dd if=/dev/zero of=laoyu1 bs=1M count=270
dm-0: warning, user block quota exceeded.
270+0 records in
270+0 records out
283115520 bytes (283 MB) copied, 10.8542 seconds, 26.1 MB/s
[laoyu1@192 guazai]$

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(raid,lvm,配额quota)