Ubuntu disk space is insufficient to solve

Ubuntu Series Articles

Ubuntu: expand hard disk space



foreword

When using a VMware virtual machine, there was a reminder that the disk is insufficient. I didn’t take it seriously until the virtual machine couldn’t be opened. I tried a few times to start it, but the card was like a few years ago, and I couldn’t get angry. Search information to solve this problem.


1. Set up the virtual machine

提示:对虚拟机进行设置需要保证Ubuntu处于关机状态

1. Open the VMware virtual machine and click Edit Virtual Machine Settings

insert image description here

2. Click hard disk (SCSI), expand disk capacity in turn

insert image description hereClick Expand to set the appropriate disk size, thinking that the disk expansion can be completed here?
Yeah! Let me enter the virtual machine LookLook:
insert image description here
When I enter the top of the virtual machine, it reminds me that the disk space is insufficient, and there is only 281.9MB of space left. At first, I wondered why it was not given 80G, why did it still remind me?
After consulting other good brothers’ articles, I found that the maximum disk size just set is only to allocate the maximum disk size to the virtual machine, but it is not directly allocated to the disk. You should enter the virtual machine to set the disk allocation before it can be used. In the good brothers' articles, they use different methods to divide the virtual machine disk, which makes my scalp tingle, but there is no way to establish a persistent personality, so I can only bite the bullet and read on.

Second, use GParted for disk partitioning

提示:在进行下一步之前,大家可以关掉Ubuntu然后使用快照的方法对虚拟机进行存档,方便后续操做失误回档重来。推荐大家去看看原子哥的文章设置一下快照功能,不过我1000多把石头人表示根本不在怕的

1. GParted partition management software

GPartedis a very popular and free partition editor available for Linux distributions by Ankush Das. In , you can do many things GPartedwith , from simple formatting tasks to important partitioning tasks . GPartedThere are so many on Baidu, I don’t have time to paste the rest for you, just install it

2. Terminal command df -h to view the current system memory status

After entering the virtual machine again, wake up the terminal and type the terminal command:

The code is as follows: df -h

insert image description hereIt can be seen that the available space under the existing root directory is 24G, and the occupation reaches 99%, which is strange, and I haven’t downloaded any learning materials, and it is full, so let’s expand it, and start the installation belowGParted

3. Terminal command df -h to view the current system memory status

Type the terminal command:
sudo apt-get install gparted
insert image description here
enter the password and wait for the installation:
insert image description here
after the installation is complete, continue to type:
sudo gparted
insert image description here
open GParted as shown in the figure above, the unallocated 55GB disk below is the expansion just configured. Next, you only need to expand this disk to other disks to solve the problem of insufficient memory.

[Note] Remember to enable the virtual machine networking service here, otherwise the installation will fail. You can refer to this series to set up virtual machine networking

4. Adjust the disk space size

Here is a brief introduction to the partition on Baidu:
in the picture, /dev/sda1 does not understand what the partition is for the time being. It is guessed that the boot disk
/dev/sda2 is the extended partition
/dev/sda5 is the main partition.
鼠标点击不同分区可以显示图形中的内存大小

insert image description here
You can find /dev/ sda2 and /dev/sda5 are represented by blue solid line frame and black solid line frame respectively, figure out the system partition, let’s get started!
Because /dev/sda1 is the primary partition in other articles, and /dev/sda5 is the primary partition in my virtual machine. From the df -h figure, we can see that /dev/sda5 is the root directory. Therefore, you should modify the size of the /dev/sda2 extended partition first, and then modify the size of /dev/sda5 in the extended partition. The example is as follows: 1. Right-click /dev/sda2 to resize/
move
insert image description here
2. Adjust the size of the extended partition: ( Just drag and drop the mouse)
insert image description here
In order to directly fill up without being affected by the memory in the future:
insert image description here
click the lower right corner to resize/move to confirm the operation. Return to the main interface of GParted and you can see that the blue box selection range of /dev/sda2 has become larger, including the unallocated disk space: 3. insert image description here
Adjust the disk size of the main partition:
insert image description here
the same operation, but the virtual machine crashes when I open it I read it once:
insert image description here
It seems that you can’t directly and roughly fill it up. Here I suggest you drag and drop gently. The protection is only because everyone is responsible:
insert image description here
after the modification, return to the main interface. At this time, you will find that there is an unallocated space of 1MB :
insert image description here
I really want to use it too, but I tried various methods for this partition and couldn’t solve it. If anyone solves this problem, remember to give me a kick, thank you!
4. Confirm the operation
Click the green Nike in the prompt bar to confirm the partition operation:
insert image description here
After clicking Apply, a processing operation will pop up, waiting for completion:
insert image description here
5. Shut down and restart & verify:
After allocating the disk space, we need to restart the virtual machine:
insert image description here
insert image description here
enter df -h in the terminal to verify the disk division:
insert image description here
it can be clearly found that the current capacity of /dev/sda5 is 79G, and it should be enough if there are no learning materials. So far, the disk space of the virtual machine VMware has been solved. Insufficient problem, Thomas the little train sent congratulations:

insert image description here
insert image description here


Summarize

The above is the content of today. It briefly introduces the use of GParted. I hope others can send me more usage plans.
Refer to the following great articles: young Danny , Punctual Atom , Wuliu Future

Guess you like

Origin blog.csdn.net/TianHW103/article/details/126887764