ubuntu14.04 expand disk space--Gparted tool

Problem description: Previously, the disk space of Ubuntu was 20G. As more and more files are stored, the disk space has been used up to 18G, so the disk space needs to be expanded to 40G.

z@ubuntu:~$ sudo fdisk -l
[sudo] password for z:

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x0002a851

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    39845887    19921920   83  Linux
/dev/sda2        39847934    41940991     1046529    5  Extended
/dev/sda5        39847936    41940991     1046528   82  Linux swap / Solaris
z@ubuntu:~$

z@ubuntu:~$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             1021968         4   1021964   1% /dev
tmpfs             206384      1332    205052   1% /run
/dev/sda1       19478204  17818480    647244  97% /
none                   4         0         4   0% /sys/fs/cgroup
none                5120         0      5120   0% /run/lock
none             1031920       220   1031700   1% /run/shm
none              102400        44    102356   1% /run/user
.host:/        470639612 298286328 172353284  64% /mnt/hgfs
z@ubuntu:~$ ^C
z@ubuntu:~$

step:

1. Close Ubuntu, select virtual machine settings in vmware, enter the size you want to expand to - 40G, and finally click Expand.

Note: Ubuntu must be turned off, otherwise the disk space cannot be expanded.

2. Install gparted partition management software

$apt-get install gparted

3. Open the gparted software and you need to enter the virtual machine user password.

4. Delete the extend partition. The sda1 partition size can be reset only after deleting the partition.

The specific deletion method is: first right-click the swap partition, select "swap off", and then right-click to delete the swap partition. After deleting the swap partition, you can delete the extend partition.

Note: Sorry, I forgot to take a screenshot of this step.

5. Right-click on the sda1 partition, reset the size of sda1 to 38G, then right-click on the unallocated space to create an extend partition of 2G, then right-click on the unallocated space to create a swap partition of 2G, click the green check mark above to save the settings, and then select the Gparted menu Column "edit"->"apply all operations" to make the configuration take effect.

Note: The swap partition is separated from the extend partition, so the maximum swap partition can reach 2G (the maximum value of the extend partition). If you need to create another partition on the extend partition, you must reasonably allocate the disk space occupied by the extend partition to ensure that the combined size of all partitions must not be higher than the extend partition size.

6. Restart ubuntu and check whether the expansion is successful - the result is successful.

z@ubuntu:~$ su root
Password:
root@ubuntu:/home/z# df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             1021968        12   1021956   1% /dev
tmpfs             206384      1308    205076   1% /run
/dev/sda1       38169080  17833312  18563788  49% /
none                   4         0         4   0% /sys/fs/cgroup
none                5120         0      5120   0% /run/lock
none             1031920       152   1031768   1% /run/shm
none              102400        36    102364   1% /run/user
.host:/        470639612 298315588 172324024  64% /mnt/hgfs
root@ubuntu:/home/z#

Reference link: https://blog.csdn.net/u011345885/article/details/73060897?utm_source=blogxgwz1#commentsedit
————————————
Copyright Statement: This article is written by a CSDN blogger The original article of "dragon_cdut" follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/renlonggg/article/details/83107346

Guess you like

Origin blog.csdn.net/yufeng1108/article/details/104060544