爲/dev/sdb、/dev/sdc、/dev/sdd操作系統
[root@localhost ~]# fdisk -l code
Disk /dev/sda: 21.4 GB, 21474836480 bytes orm
255 heads, 63 sectors/track, 2610 cylinders ci
Units = cylinders of 16065 * 512 = 8225280 bytes rem
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
雖然物理磁盤添加好了,但咱們還要爲其建立一個分區,並將系統識別碼標示爲「Linux LVM」,基本操做以下
[root@localhost ~]# fdisk /dev/sdb //使用fdisk工具爲磁盤建立分區
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): p //顯示當前磁盤下已經存在的分區(目前爲空)
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n //爲磁盤添加分區
Command action
e extended
p primary partition (1-4) //這裏選擇建立主分區便可
p
Partition number (1-4): 1 //輸入分區號,這裏輸入1便可
First cylinder (1-130, default 1): //分區標記開始,使用默認便可
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): //分區標記結束,這裏分配磁盤所有可用空間
Using default value 130
Command (m for help): t //改變分區系統識別ID
Selected partition 1
Hex code (type L to list codes): 8e //這裏8e表明LVM標示,能夠輸入L來查看系統支持的ID標示碼
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p //再次顯示分區,能夠看到分區已經建立好
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 8e Linux LVM
Command (m for help): w //最後輸入w來報錯分區操做
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 //建立物理卷PV
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdd1" successfully created
[root@localhost ~]# mkfs.ext3 /dev/myVG/lv01 //爲邏輯卷分配ext3文件系統
[root@localhost ~]# mkfs.ext3 /dev/myVG/lv02
[root@localhost ~]# mkfs.ext3 /dev/myVG/lv03
[root@localhost ~]# mkdir /lv01 /lv02 /lv03 //建立掛載點
[root@localhost ~]# mount /dev/myVG/lv01 /lv01/ /掛載邏輯卷
[root@localhost ~]# mount /dev/myVG/lv02 /lv02/
[root@localhost ~]# mount /dev/myVG/lv03 /lv03
至此咱們已經將最終的邏輯卷掛載到Linux操做系統中了,而且已經能夠正常使用,爲了系統下次啓動時可以自動將邏輯卷添掛載到系統中,咱們經過下面的操做來配置系統開機自動掛載。
[root@localhost ~]# vi /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/myVG/lv01 /lv01 ext3 defaults 0 0 //這裏爲添加的掛載點
/dev/myVG/lv02 /lv02 ext3 defaults 0 0
/dev/myVG/lv03 /lv03 ext3 defaults 0 0