1, 介紹
LVM是邏輯盤卷管理(Logical Volume Manager)的簡稱,它是Linux環境下對磁盤分區進行管理的一種機制,LVM是建立在硬盤和分區之上的一個邏輯層,來提高磁盤分 LVM
區管理的靈活性。前面談到,LVM是在磁盤分區和文件系統之間添加的一個邏輯層,來為文件系統屏蔽下層磁盤分區布局,提供一個抽象的盤卷,在盤卷上建立文件系統。物理卷(physical volume)物理卷就是指硬盤分區或從邏輯上與磁盤分區具有同樣功能的設備(如RAID),是LVM的基本存儲邏輯塊,但和基本的物理存儲介質(如分區、磁盤等)比較,卻包含有與LVM相關的管理參數。
2,創建
[root@cn-iss-install-01 mapper]# fdisk -l
[root@cn-iss-install-01 mapper]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x874c7742.
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)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x874c7742
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
First cylinder (1-11748, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-11748, default 11748): +80G
Command (m for help): p
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x874c7742
Device Boot Start End Blocks Id System
/dev/sdb1 1 10444 83891398+ 5 Extended
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@cn-iss-install-01 mapper]#reboot or
[root@cn-iss-install-01 Packages]# partprobe
[root@cn-iss-install-01 ~]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
64 heads, 32 sectors/track, 16384 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005b1c0
Device Boot Start End Blocks Id System
/dev/sda1 * 2 251 256000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 252 16384 16520192 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x874c7742
Device Boot Start End Blocks Id System
/dev/sdb1 1 10444 83891398+ 5 Extended
Disk /dev/mapper/VG00-LV_rootfs: 16.4 GB, 16374562816 bytes
255 heads, 63 sectors/track, 1990 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VG00-LV_swap: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@cn-iss-install-01 ~]#
[root@cn-iss-install-01 Packages]# pvcreate /dev/sdb1
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
[root@cn-iss-install-01 Packages]#
[root@cn-iss-install-01 Packages]# vgcreate vg03 /dev/sdb1
Volume group "vg03" successfully created
[root@cn-iss-install-01 Packages]# lvcreate -L 83G -n vgdata vg03