I recently worked on an Android project in Ubuntu, but after extracting the root file system, I reported that the hard disk was not enough. The configured size is 15 GB. However, it is very convenient to expand partitions. Of course, first you have to set the size of the hard disk to be added. This time, I upgraded it to 30 GB to see if it has an alarm. 1. Create a New partition first check the existing partition: root @ ubuntu:/# fdisk-lDisk/dev/sda: 32.2 GB, 32212254720bytes255he
I recently worked on an Android project in Ubuntu, but after extracting the root file system, I reported that the hard disk was not enough. The configured size is 15 GB. However, it is very convenient to expand partitions. Of course, first you have to set the size of the hard disk to be added. This time, I upgraded it to 30 GB to see if it has an alarm.
1. Create a New Partition
First, check the existing partitions:
Root @ ubuntu:/# fdisk-l
Disk/dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x000e11ac
Device Boot Start End Blocks Id System
/Dev/sda1*1 1871 15021056 83 Linux
/Dev/sda2 1871 1958 704513 5 Extended
/Dev/sda5 1871 1958 704512 82 Linux swap/Solaris
Root @ ubuntu :/#
From the above information, we can see two primary partitions:/dev/sda1 and/dev/sda2, so we can create a/dev/sda3
Root @ ubuntu: // # fdisk/dev/sda
WARNING: DOS-compatible mode is deprecated. It's stronugly recommended
Switch off the mode (command 'C') and change display units
Sectors (command 'U ').
Command (m for help ):
M for help. Input m for help;
Command action
A toggle a bootable flag
B edit bsd disklabel
C toggle the dos compatibility flag
D delete a partition
L list known partition types
M print this menu
N add a new partition
O create a new empty DOS partition table
P print the partition table
Q quit without saving changes
S create a new empty Sun disklabel
T change a partition's system id
U change display/entry units
V verify the partition table
W write table to disk and exit
X extra functionality (experts only)
Command (m for help ):
From the information above, n is the Add partition, that is, the new partition; w is the save.
Command (m for help): n
Command action
L logical (5 or over)
P primary partition (1-4)
Create a logical partition or a primary partition. Enter p to create the primary partition.
If:
Selected partition 4
No free sectors available
Indicates that there is no idle hard disk, and you have to manually add it to the virtual machine.
Then press the default data input, and remember to input w to save. Q: exit.