环境:
虚拟化环境,SUSE Linux Enterprise
Server 11sp3,直接把虚拟磁盘从100G改成150G。
现有的LVM是100G,/home
的LV需要再加50G。
步骤:
fdisk
先把多加的50G分成一个区,再把该区划成pv,把该pv加到vg里面,再扩LV,最后扩文件系统。
xickDB:~ # df
-h
Filesystem
Size
Used Avail Use% Mounted on
/dev/mapper/system-root
9.9G 5.2G
4.2G 56% /
udev
1.9G
100K 1.9G 1%
/dev
tmpfs
9.0G
72K 9.0G 1%
/dev/shm
/dev/sda1
152M 81M
63M 57% /boot
/dev/mapper/system-home
25G 13G
11G 55% /home
xickDB:~ # fdisk
-l
Disk /dev/sda: 161.1 GB,
161061273600 bytes
255 heads, 63 sectors/track,
19581 cylinders, total 314572800 sectors
... ...
Disk /dev/mapper/system-swap
doesn't contain a valid partition table
xickDB:~ #
vgdisplay
xickDB:~ # fdisk
/dev/sda
Command (m for help):
n
Command action
p
Partition number (1-4, default
3):
Using default value
3
First sector
(209715200-314572799, default
209715200):
Using default value
209715200
Last sector, +sectors or
+size{K,M,G} (209715200-314572799, default
314572799):
Using default value
314572799
Command (m for help):
p
Disk /dev/sda: 161.1 GB,
161061273600 bytes
255 heads, 63 sectors/track,
19581 cylinders, total 314572800 sectors
Units = sectors of 1 * 512 =
512 bytes
Sector size (logical/physical):
512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier:
0x0009d2de
/dev/sda1 *
2048
321535
159744 83
Linux
/dev/sda2
321536 209715199
104696832 8e
Linux LVM
/dev/sda3
209715200
314572799 52428800
83 Linux
Command (m for help):
w
The partition table has been
altered!
xickDB:~ #
reboot
Broadcast message from root
(pts/1) (Sat Mar 28 16:37:26 2015):
The system is going down for
reboot NOW!
Last login: Sat Mar 28 16:29:59
2015 from 10.31.29.10
xickDB:~
#
xickDB:~ # fdisk
-l
Disk /dev/sda: 161.1 GB,
161061273600 bytes
255 heads, 63 sectors/track,
19581 cylinders, total 314572800 sectors
Units = sectors of 1 * 512 =
512 bytes
Sector size (logical/physical):
512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier:
0x0009d2de
/dev/sda1 *
2048
321535
159744 83
Linux
/dev/sda2
321536 209715199
104696832 8e
Linux LVM
/dev/sda3
209715200
314572799 52428800
83 Linux
... ...
xickDB:~ # pvs
xickDB:~ # pvcreate
/dev/sda3
xickDB:~ # pvs
xickDB:~ # vgextend system
/dev/sda3
xickDB:~ #
vgdisplay
xickDB:~ # lvs
xickDB:~ # lvextend
--help
lvextend
xickDB:~ # lvextend --size +50G
/dev/mapper/system-home
xickDB:~ # lvs
xickDB:~ # resize2fs
/dev/mapper/system-home
resize2fs 1.41.9
(22-Aug-2009)
Filesystem at
/dev/mapper/system-home is mounted on /home; on-line resizing
required
old desc_blocks = 2,
new_desc_blocks = 5
Performing an on-line resize of
/dev/mapper/system-home to 19660800 (4k) blocks.
The filesystem on
/dev/mapper/system-home is now 19660800 blocks long.
xickDB:~ # df
-h
Filesystem
Size
Used Avail Use% Mounted on
/dev/mapper/system-root
9.9G 5.2G
4.2G 56% /
udev
1.9G
104K 1.9G 1%
/dev
tmpfs
9.0G
72K 9.0G 1%
/dev/shm
/dev/sda1
152M 81M
63M 57% /boot
/dev/mapper/system-home
74G 13G
58G 19% /home