打算將分區/dev/sdb3創建vg, 步驟是:
1. 用/dev/sdb3創建pv
2. 使用上面的pv創建vg
但是現有的system 不是linux LVM類型,需要通過fdisk修改ID 爲8e
/dev/sdb3 13105 36947 191509504 7 HPFS/NTFS
[root@pangpangs ~]# fdisk /dev/sdb3
p(查看當前分區)
t(修改系統ID)
3(第三塊)
8e(修改類型)
w(保存)
[root@pangpangs ~]# fdisk -l
.....
Device Boot Start End Blocks Id System
/dev/sdb1 1 13105 105263104 7 HPFS/NTFS
/dev/sdb2 13105 36947 191509504 7 HPFS/NTFS
/dev/sdb3 36947 60802 191611904 8e Linux LVM
....
無法創建pv,可能是之前被掛載過
[root@pangpangs ~]# pvcreate /dev/sdb3
Can't open /dev/sdb3 exclusively. Mounted filesystem?
[root@pangpangs ~]# df -h
文件系統 容量 已用 可用 已用%% 掛載點
....
/dev/sdb3 180G 188M 171G 1% /mnt/disk3
卸載/dev/sdb3
[root@pangpangs ~]# umount -v /dev/sdb3
/dev/sdb3 umounted
成功創建pv
[root@pangpangs ~]# pvcreate /dev/sdb3
Physical volume "/dev/sdb3" successfully created
[root@pangpangs ~]# pvscan
PV /dev/sda2 VG vg_pangpangs lvm2 [931.02 GiB / 0 free]
PV /dev/sdb3 lvm2 [182.74 GiB]
Total: 2 [1.09 TiB] / in use: 1 [931.02 GiB] / in no VG: 1 [182.74 GiB】
成功創建vg
【root@pangpangs ~]# vgcreate cinder-volumes /dev/sdb3
Volume group "cinder-volumes" successfully created
[root@pangpangs ~]# vgdisplay
--- Volume group ---
VG Name cinder-volumes
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 182.73 GiB
PE Size 4.00 MiB
Total PE 46780
Alloc PE / Size 0 / 0
Free PE / Size 46780 / 182.73 GiB
VG UUID qoV4Yf-3iZZ-DorA-SAus-1b0E-OCf2-KHK6Nt
df 和 fdisk命令
xianghui@xianghui:~$ sudo fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xaf3788b6
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 106498047 53248000 7 HPFS/NTFS/exFAT
/dev/sda2 106498048 498690047 196096000 83 Linux
/dev/sda3 498690048 890879999 196094976 82 Linux swap / Solaris
/dev/sda4 890884094 1953521663 531318785 f W95 Ext'd (LBA)
Partition 4 does not start on physical sector boundary.
/dev/sda5 890884096 1953521663 531318784 7 HPFS/NTFS/exFAT
xianghui@xianghui:~$ sudo fdisk -l /dev/sda2
Disk /dev/sda2: 200.8 GB, 200802304000 bytes
255 heads, 63 sectors/track, 24412 cylinders, total 392192000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/sda2 doesn't contain a valid partition table
xianghui@xianghui:~$ sudo df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 184G 30G 146G 17% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.8G 4.0K 3.8G 1% /dev
tmpfs 779M 1.3M 777M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.8G 588K 3.8G 1% /run/shm
none 100M 32K 100M 1% /run/user
參考 http://book.51cto.com/art/201012/240911.htm
http://blog.csdn.net/aaronychen/article/details/2270048
http://blog.csdn.net/dlodj/article/details/6672357