Extend linux volume under vsphere
Exs 5.5.0, ubuntu 12.04 server
LVM2
fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 磁頭,63 磁區/磁軌,13054 磁柱,總計 209715200 磁區
單位 = 磁區 之於 1 * 512 = 512 位元組
磁區大小 (邏輯/實體):512 位元組 / 512 位元組
I/O 大小 (最小/最佳化):512 位元組 / 512 位元組
磁碟識別碼:0x0008602e
所用裝置 開機 開始 結束 區塊 識別號 系統
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 209715199 104606721 5 延伸
/dev/sda5 501760 104855551 52176896 8e Linux LVM
Disk /dev/mapper/uservertest-root: 44.8 GB, 44807749632 bytes
...
磁碟 /dev/mapper/uservertest-swap_1: 8585 MB,8585740288 位元組
...
fdisk /dev/sda
命令 (m 以獲得說明): p
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 磁頭,63 磁區/磁軌,13054 磁柱,總計 209715200 磁區
單位 = 磁區 之於 1 * 512 = 512 位元組
磁區大小 (邏輯/實體):512 位元組 / 512 位元組
I/O 大小 (最小/最佳化):512 位元組 / 512 位元組
磁碟識別碼:0x0008602e
所用裝置 開機 開始 結束 區塊 識別號 系統
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 209715199 104606721 5 延伸
/dev/sda5 501760 104855551 52176896 8e Linux LVM
命令 (m 以獲得說明): n
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 6
起初 磁區 (104857600-209715199, 預設 104857600):
使用預設值 104857600
最後 磁區, +磁區 或 +大小{K,M,G} (104857600-209715199, 預設 209715199):
使用預設值 209715199
命令 (m 以獲得說明): t
分割區編號 (1-6): 6
十六進位編碼 (輸入 L 以列出編碼): 8e
命令 (m 以獲得說明): p
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 磁頭,63 磁區/磁軌,13054 磁柱,總計 209715200 磁區
單位 = 磁區 之於 1 * 512 = 512 位元組
磁區大小 (邏輯/實體):512 位元組 / 512 位元組
I/O 大小 (最小/最佳化):512 位元組 / 512 位元組
磁碟識別碼:0x0008602e
所用裝置 開機 開始 結束 區塊 識別號 系統
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 209715199 104606721 5 延伸
/dev/sda5 501760 104855551 52176896 8e Linux LVM
/dev/sda6 104857600 209715199 52428800 8e Linux LVM
Run partprobe to reload partition table
partprobe
Create new LVM physical volume to new partition
pvcreate /dev/sda6
lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
root uservertest -wi-ao 41.73g
swap_1 uservertest -wi-ao 8.00g
Add new physical volume to existing Volume Group (uservertest
)
vgextend uservertest /dev/sda6
vgdisplay
--- Volume group ---
VG Name uservertest
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 99.75 GiB
PE Size 4.00 MiB
Total PE 25537
Alloc PE / Size 12730 / 49.73 GiB
Free PE / Size 12807 / 50.03 GiB
VG UUID 1kxkkh-221S-gLOC-YdwK-YnuQ-64qO-b4Aoc6
Extend Logical Volume size
lvresize -l +12807 /dev/uservertest/root
Extending logical volume root to 91.76 GiB
Logical volume root successfully resized
resize2fs -p /dev/uservertest/root
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/uservertest/root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 6
Performing an on-line resize of /dev/uservertest/root to 24053760 (4k) blocks.
The filesystem on /dev/uservertest/root is now 24053760 blocks long.
refter:
http://wwhlnes.blogspot.tw/2014/04/blog-post.html
http://v-reality.info/2010/06/working-with-linux-volumes-n-vsphere/