- 论坛徽章:
- 0
|
Vmware+LVM+RAID+磁盘配额整合实验---附具体步骤
以下文档由广东省linux公共服务技术支持中心(GDLC)独家提供---周末班学员实验稿。转载请未注明出处。
打开vmware,并添加多块硬盘,重新启动RedHat AS 5.3系统,进入系统后,通过以下步骤操作,具体步骤如下。
1、显示磁盘分区情况。
[root@rhlinux ~]# fdisk -l
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 16 128488+ 83 Linux
/dev/sda2 17 576 4498200 83 Linux
/dev/sda3 577 652 610470 82 Linux swap
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdf: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdf doesn't contain a valid partition table
2、对磁盘划分分区,其它的分区划分方法如下。
[root@rhlinux ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3、显示分区结果
[root@rhlinux ~]# fdisk -l
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 16 128488+ 83 Linux
/dev/sda2 17 576 4498200 83 Linux
/dev/sda3 577 652 610470 82 Linux swap
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 391 3140676 83 Linux
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 391 3140676 83 Linux
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 391 3140676 83 Linux
Disk /dev/sde: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 391 3140676 83 Linux
Disk /dev/sdf: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 391 3140676 83 Linux
4、将分区信息写入内核
[root@rhlinux ~]# partprobe
[root@rhlinux ~]# cat /proc/partitions
major minor #blocks name
8 0 5242880 sda
8 1 128488 sda1
8 2 4498200 sda2
8 3 610470 sda3
8 16 3145728 sdb
8 17 3140676 sdb1
8 32 3145728 sdc
8 33 3140676 sdc1
8 48 3145728 sdd
8 49 3140676 sdd1
8 64 3145728 sde
8 65 3140676 sde1
8 80 3145728 sdf
8 81 3140676 sdf1
5、创建RAID5设备。
[root@rhlinux ~]# mdadm -Cv /dev/md0 -l5 -n4 -x1 -c16 /dev/sd{b,c,d,e,f}1
mdadm: layout defaults to left-symmetric
mdadm: size set to 3140608K
mdadm: array /dev/md0 started.
[root@rhlinux ~]# cat /proc/mdstat
Personalities : [raid5]
md0 : active raid5 sde1[4] sdf1[5] sdd1[2] sdc1[1] sdb1[0]
9421824 blocks level 5, 16k chunk, algorithm 2 [4/3] [UUU_]
[====>................] recovery = 22.1% (696448/314060 finish=0.3min speed=106858K/sec
unused devices: <none>
[root@rhlinux ~]# cat /proc/mdstat
Personalities : [raid5]
md0 : active raid5 sde1[4] sdf1[5] sdd1[2] sdc1[1] sdb1[0]
9421824 blocks level 5, 16k chunk, algorithm 2 [4/3] [UUU_]
[=========>...........] recovery = 48.7% (1532416/314060 finish=0.2min speed=98449K/sec
unused devices: <none>
6、显示RAID5校验状态
[root@rhlinux ~]# cat /proc/mdstat
Personalities : [raid5]
md0 : active raid5 sde1[3] sdf1[4] sdd1[2] sdc1[1] sdb1[0]
9421824 blocks level 5, 16k chunk, algorithm 2 [4/4] [UUUU]
unused devices: <none>
7、创建物理卷
[root@rhlinux ~]# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
8、创建卷组
[root@rhlinux ~]# vgcreate vg00 /dev/md0
Volume group "vg00" successfully created
9、创建逻辑卷
[root@rhlinux ~]# lvcreate -L +6G -n lv00 vg00
Logical volume "lv00" created
[root@rhlinux ~]# lvscan
ACTIVE '/dev/vg00/lv00' [6.00 GB] inherit
10、为/dev/vg00/lv00逻辑卷创建文件系统
[root@rhlinux ~]# mke2fs -j /dev/vg00/lv00
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
786432 inodes, 1572864 blocks
78643 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1610612736
48 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
11、在/etc/fstab文件中,添加以下内容。
[root@rhlinux ~]# mkdir /lun01
[root@rhlinux ~]# vi /etc/fstab
/dev/vg00/lv00 /lun01 ext3 defaults 0 0
[root@rhlinux ~]# mount /dev/vg00/lv00 /lun01/
12、添加用户配额和工作组配额。
[root@rhlinux ~]# vi /etc/fstab
/dev/vg00/lv00 /lun01 ext3 defaults,usrquota,grpquota 0 0
13、重新挂载分区
[root@rhlinux ~]# mount -o remount /lun01/
[root@rhlinux ~]# mount |grep lun
/dev/mapper/vg00-lv00 on /lun01 type ext3 (rw,usrquota,grpquota)
14、创建磁盘配额文件
[root@rhlinux ~]# quotacheck -cvugf /lun01
quotacheck: Scanning /dev/mapper/vg00-lv00 [/lun01] quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
done
quotacheck: Checked 3 directories and 2 files
quotacheck: Old file not found.
quotacheck: Old file not found.
15、编辑配额。
[root@rhlinux ~]# useradd user1
[root@rhlinux ~]# edquota -u user
16、激活配额。
[root@rhlinux ~]# quotaon -a
以上文档由广东省linux公共服务技术支持中心(GDLC)独家提供---周末班学员实验稿。转载请未注明出处。 |
|