歡迎您光臨本站 註冊首頁

Vmware+LVM+RAID+磁碟配額整合實驗---附具體步驟

←手機掃碼閱讀     火星人 @ 2014-03-24 , reply:0

Vmware+LVM+RAID+磁碟配額整合實驗---附具體步驟
打開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/3140608) finish=0.3min speed=106858K/sec
unused devices:
[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/3140608) finish=0.2min speed=98449K/sec
unused devices:
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:
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)提供---周末班學員實驗稿。

[火星人 ] Vmware+LVM+RAID+磁碟配額整合實驗---附具體步驟已經有855次圍觀

http://coctec.com/docs/linux/show-post-145519.html