曾经就T2的机器没办法做上LVM的问题纠结了N天,最后打单子问T2,他们给出了解决的办法,经过测试成功,在这里分享给大家.

LVM on CentOS Install Instructions

You can use our standard CentOS “RAID 0” install to create the base install and then convert the “RAID 0” slice to LVM.
Reinstall the CentOS OS with RAID 0 and once the OS install has completed log in to the system and run the following commands (choose which setup you prefer - LVM on RAID 1 [RECOMMENDED], LVM on RAID 0, LVM without RAID):

LVM on RAID 1

1
2
3
4
5
6
7
8
9
10
11
umount /raid0 
/bin/sed -i -e '/^\/.*\/raid0/d' /etc/fstab
/sbin/mdadm --manage /dev/md2 --stop
/sbin/mdadm --zero-superblock /dev/sda3 /dev/sdb3
sed -i -e '/^ARRAY/d' /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf
/sbin/mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3
pvcreate /dev/md2
vgcreate lvmRaid /dev/md2
sed -i -e '/^ARRAY/d' /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf

Note that you can name your Volume Group whatever you like, I just chose to name it “lvmRaid” (you see that in the last vgcreate command).
At this point you have an empty LVM space running on RAID 1.

LVM on RAID 0

1
2
3
4
5
6
7
8
9
10
11
umount /raid0 
/bin/sed -i -e '/^\/.*\/raid0/d' /etc/fstab
/sbin/mdadm --manage /dev/md2 --stop
/sbin/mdadm --zero-superblock /dev/sda3 /dev/sdb3
sed -i -e '/^ARRAY/d' /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf
/sbin/mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb3
pvcreate /dev/md2
vgcreate lvmRaid /dev/md2
sed -i -e '/^ARRAY/d' /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf

Note that you can name your Volume Group whatever you like, I just chose to name it “lvmRaid” (you see that in the last vgcreate > command).
At this point you have an empty LVM space running on RAID 0.

LVM with no RAID

1
2
3
4
5
6
7
8
umount /raid0 
/bin/sed -i -e '/^\/.*\/raid0/d' /etc/fstab
/sbin/mdadm --manage /dev/md2 --stop
/sbin/mdadm --zero-superblock /dev/sda3 /dev/sdb3
sed -i -e '/^ARRAY/d' /etc/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm.conf
pvcreate /dev/sda3 /dev/sdb3
vgcreate lvmSet /dev/sda3 /dev/sdb3

Note that you can name your Volume Group whatever you like, I just chose to name it “lvmSet” (you see that in the last vgcreate command).
At this point you have an empty LVM space running without RAID.
You may also want to create a “storage” partition to store your templates and ISO images. You can do that with commands like these:

1
2
3
4
5
6
7
lvcreate -L 50g lvmRaid -n storage 
mkfs.ext3 /dev/lvmRaid/storage
mkdir /storage
printf "/dev/lvmRaid/storage\t/storage\text3\tdefaults,noatime\t0\t2\n" >> /etc/fstab
mount /storage
mkdir /storage/iso
mkdir /storage/templates

Note that if you used the “LVM No RAID” commands then your volume group may be named lvmSet instead of lvmRaid. Adjust the commands accordingly.