Run fdisk-l after expansion to check whether the operation is successful.
[Root @ localhost ~ ] # Fdisk-l
Disk/dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sda1*1 6 48163 + 83 Linux
/Dev/sda2 7 515 4088542 + 83 Linux
/Dev/sda3 516 1239 5815530 83 Linux
/Dev/sda4 1240 1305 530145 5 Extended
/Dev/sda5 1240 1305 530113 + 82 Linux swap/Solaris
It can be seen that sda has been extended to 16 GB but is not allocated to the file system.
Continue to execute fdisk/dev/sda to create a disk.
[Root @ localhost ~ ] # Fdisk/dev/sda
The number of cylinders for this disk is set to 1958.
There is nothing wrong with that, but this is larger than 1024,
And coshould in certain setups cause problems:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(E.g., dos fdisk, OS/2 FDISK)
Command (m for help): n
No free sectors available
When fdisk-l is run earlier, it is clearly the last 1305 cylinder, and there should be 1958 cylinders. Why is there no idle sector.
Let's take a look at the execution result of fdisk-l. It turns out that/dev/sda5 is allocated as a swap partition. It is easy to solve the problem after finding the cause.
1. Disable swap partition # swapoff/dev/sda5
2. Delete sda4 and sda5.
[Root @ localhost ~ ] # Fdisk/dev/sda
The number of cylinders for this disk is set to 1958.
There is nothing wrong with that, but this is larger than 1024,
And coshould in certain setups cause problems:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(E.g., dos fdisk, OS/2 FDISK)
Command (m for help): d
Partition number (1-5): 5
Command (m for help): d
Partition number (1-5): 4
3. Create extended partition 4, create partition sda5, write
Command (m for help): n
Command action
E extended
P primary partition (1-4)
E
Selected partition 4
First cylinder (1240-1958, default 1240 ):
Using default value 1240
Last cylinder or + size or + sizeM or + sizeK (1240-1958, default 1958 ):
Using default value 1958
Command (m for help): n
First cylinder (1240-1958, default 1240 ):
Using default value 1240
Last cylinder or + size or + sizeM or + sizeK (1240-1958, default 1958 ):
Using default value 1958
Command (m for help): w
The partition table has been altered!
For more information about resizing, see the online tutorial.
Author guojian3021886