现象:
While trying to extend the partition using #growpart command getting error.
# growpart /dev/vdb 6
attempt to resize /dev/vdb failed. sfdisk output below:
| sfdisk: Warning: extended partition does not start at a cylinder boundary.
| DOS and Linux will interpret the contents differently.
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (34,8,40)
|
| sfdisk: start: (c,h,s) expected (1023,15,63) found (34,8,41)
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (67,0,48)
|
| sfdisk: start: (c,h,s) expected (1023,15,63) found (67,0,49)
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (99,8,56)
|
| sfdisk: start: (c,h,s) expected (1023,15,63) found (99,8,57)
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (325,1,17)
|
| sfdisk: start: (c,h,s) expected (1023,15,63) found (101,9,26)
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (134,1,33)
|
| sfdisk: start: (c,h,s) expected (1023,15,63) found (136,2,3)
|
| sfdisk: end: (c,h,s) expected (1023,15,63) found (168,10,10)
|
|
| Disk /dev/vdb: 31207 cylinders, 16 heads, 63 sectors/track
| Old situation:
| Units: cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0
|
| Device Boot Start End #cyls #blocks Id System
| /dev/vdb1 2+ 2082- 2081- 1048576 83 Linux
| /dev/vdb2 2082+ 4163- 2081- 1048576 83 Linux
| /dev/vdb3 4163+ 6243- 2081- 1048576 83 Linux
| /dev/vdb4 6243+ 20805- 14562- 7339008 5 Extended
| /dev/vdb5 6245+ 8326- 2081- 1048576 83 Linux
| /dev/vdb6 8328+ 10408- 2081- 1048576 83 Linux
| Warning: given size (23062495) exceeds max allowable size (12576768)
| cannot build surrounding extended partition
| sfdisk: bad input
FAILED: failed to resize
***** WARNING: Resize failed, attempting to revert ******
/tmp/growpart.RP3Zez/orig.save: No such file or directory
sfdisk: cannot stat partition restore file (/tmp/growpart.RP3Zez/orig.save)
***** Appears to have gone OK ****
# df -hT /u03
Filesystem Type Size Used Avail Use% Mounted on
/dev/vdb6 xfs 1014M 33M 982M 4% /u03
原因:
# parted /dev/vdb u s p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 31457280s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 2099199s 2097152s primary
2 2099200s 4196351s 2097152s primary
3 4196352s 6293503s 2097152s primary
4 6293504s 20971519s 14678016s extended
5 6295552s 8392703s 2097152s logical xfs
6 8394752s 10491903s 2097152s logical xfs
The /dev/sda6 is the logical partition (under extended partition)
处理方法
Since it is a logical volume, need to extend the extended partition and then the logical partition.
例子:
● Extend the extended partition.
# growpart /dev/sda 4
# growpart /dev/vdb 4
CHANGED: partition=4 start=6293504 old: size=14678016 end=20971520 new: size=25163743 end=31457247
# parted /dev/vdb u s p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 31457280s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 2099199s 2097152s primary
2 2099200s 4196351s 2097152s primary
3 4196352s 6293503s 2097152s primary
4 6293504s 31457246s 25163743s extended
5 6295552s 8392703s 2097152s logical xfs
6 8394752s 10491903s 2097152s logical xfs
● Extend the logical partition.
# growpart /dev/vdb 6
CHANGED: partition=6 start=8394752 old: size=2097152 end=10491904 new: size=23062495 end=31457247
# parted /dev/vdb u s p
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 31457280s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 2099199s 2097152s primary
2 2099200s 4196351s 2097152s primary
3 4196352s 6293503s 2097152s primary
4 6293504s 31457246s 25163743s extended
5 6295552s 8392703s 2097152s logical xfs
6 8394752s 31457246s 23062495s logical xfs
● Extend the filesystem according the filesystem procedure, In this case it is xfs filesystem.
# xfs_growfs /u0X
# df -hT /u0X
# xfs_growfs /u03
meta-data=/dev/vdb6 isize=256 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0 rmapbt=0
= reflink=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 262144 to 2882811
# df -hT /u03
Filesystem Type Size Used Avail Use% Mounted on
/dev/vdb6 xfs 11G 35M 11G 1% /u03
|