制作lvm 逻辑卷
[root@localhost ~]# fdisk -l | grep sd[b-z]
Disk /dev/sdb doesn't contain a validpartition table
Disk /dev/sdc doesn't contain a validpartition table
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
[root@localhost ~]#
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOSpartition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes willremain in memory only,
until you decide to write them. After that,of course, the previous
content won't be recoverable.




The number of cylinders for this disk isset to 2610.
There is nothing wrong with that, but thisis larger than 1024,
and could in certain setups cause problemswith:
1) software that runs at boot time (e.g.,old versions of LILO)
2) booting and partitioning software fromother OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partitiontable 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-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK(1-2610, default 2610):
Using default value 2610


Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e(Linux LVM)


Command (m for help): p


Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes


Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 8e Linux LVM


Command (m for help): w
The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.
添加两块磁盘,分区方法同上
[root@localhost ~]# fdisk -l | grep -i lvm
/dev/sdb1 1 2610 20964793+ 8e Linux LVM
/dev/sdc1 1 2610 20964793+ 8e Linux LVM
[root@localhost ~]#
[root@localhost ~]# partprobe
[root@localhost ~]# fdisk -l | grep -i lvm
/dev/sdb1 1 2610 20964793+ 8e Linux LVM
/dev/sdc1 1 2610 20964793+ 8e Linux LVM
[root@localhost ~]#
[root@localhost ~]# pvcreate /dev/sdb1/dev/sdc1
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
[root@localhost ~]# pvscan
PV/dev/sdb1 lvm2[19.99 GB]
PV/dev/sdc1 lvm2[19.99 GB]
Total: 2 [39.99 GB] / in use: 0 [0 ] / in no VG: 2 [39.99 GB]
[root@localhost ~]# vgcreate vg_data/dev/sdb1 /dev/sdc1
Volume group "vg_data" successfully created
[root@localhost ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_data" using metadata type lvm2
[root@localhost ~]#
[root@localhost ~]# lvcreate -L 16G -nlv_data vg_data
Logical volume "lv_data" created
[root@localhost ~]#
[root@localhost ~]# lvscan
ACTIVE '/dev/vg_data/lv_data' [16.00 GB] inherit
[root@localhost ~]#
[root@localhost ~]# mkfs.ext3/dev/vg_data/lv_data
[root@localhost ~]# mkdir /mybox
[root@localhost ~]# mount/dev/vg_data/lv_data /mybox
[root@localhost ~]# df -hT
文件系统
类型
容量
已用 可用 已用% 挂载点
/dev/sda2 ext3 19G 2.3G 16G 13% /
/dev/sda3 ext3 9.5G 151M 8.9G 2% /data
/dev/sda1 ext3 99M 12M 83M 13% /boot
tmpfs tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/vg_data-lv_data
ext3 16G 173M 15G 2% /mybox
[root@localhost ~]#
[root@localhost ~]# echo"/dev/vg_data/lv_data /mybox ext3 defaults,usrquota,acl 00">>/etc/fstab
[root@localhost ~]# reboot
[root@localhost ~]# df –hT
文件系统
类型
容量
已用 可用 已用% 挂载点
/dev/sda2 ext3 19G 2.3G 16G 13% /
/dev/sda3 ext3 9.5G 151M 8.9G 2% /data
/dev/sda1 ext3 99M 12M 83M 13% /boot
tmpfs tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/vg_data-lv_data
ext3 16G 173M 15G 2% /mybox
[root@localhost ~]#
[root@localhost ~]# lvextend -L 24G/dev/vg_data/lv_data
Extending logical volume lv_data to 24.00 GB
Logical volume lv_data successfully resized
[root@localhost ~]# resize2fs/dev/vg_data/lv_data
[root@localhost ~]# df -hT
文件系统
类型
容量
已用 可用 已用% 挂载点
/dev/sda2 ext3 19G 2.3G 16G 13% /
/dev/sda3 ext3 9.5G 151M 8.9G 2% /data
/dev/sda1 ext3 99M 12M 83M 13% /boot
tmpfs tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/vg_data-lv_data
ext3 24G 173M 23G 1% /mybox
[root@localhost ~]#