♥ Foreword
After many years of testing, you should encounter insufficient disk space to some extent. For example, the test environment you are using now, because you need to test, so if the project has been started, you will keep writing logs. If you do not clean up the logs regularly, Over time, the disk space may be completely occupied, making it impossible to write data.
For example, I have a server with 50g disk space
Now, after using it for a while, the disk is running out of space
There is not enough disk space. At this time, if you perform some operations to write to the disk, an error will be reported and cannot be executed.
If you want to learn automated testing, here I recommend a set of videos for you. This video can be said to be the number one automated testing tutorial on the entire network at station B. At the same time, the number of people online has reached 1,000, and there are notes to collect and share with you. Dashen Technical Exchange: 798478386
Disk is not enough, how to solve it? Of course, there are two ways, delete some unused content to free up disk space; or mount a new disk. Then today I will explain to you how to mount a new disk.
For example, you have installed a virtual machine with VirtualBox, and there was a disk during the installation, and now you want to practice mounting a new disk.
First, use VirtualBox to create a new virtual machine, as shown in the figure, the key point is [Virtual Hard Disk] to select "Create a virtual hard disk now", and then click 'Create'
In the following pop-up window, fill in the 'file size', others can use the default, click Create
At this point, we have finished creating a new hard drive.
Next, you can find another virtual machine with the system installed, click "Settings", in the pop-up window, find "Storage", select the controller SATA, click Add Disk, select the disk we created above, and click [Select] button.
Then, click the [ok] button in the lower right corner of the setting pop-up window. At this time, the system already has 2 disks, and start the virtual machine.
The machine is started. If you directly use the df -h command to check, you will find that there are no 2 disks, because the new external memory of the Linux machine needs to be mounted before it can be used. However, at this point, we can see that there are 2 disks using fdisk -l.
Next, we need to partition the new disk. We need to have super-supervisor privileges to perform this operation.
fdisk /dev/sdb
m
n
p
1
回车
回车
w
At this point, the partition for the second disk has been created, and then, format the disk
mkfs.ext4 /dev/sdb1
Then, create a new mount directory
mkdir /newload_disk
Next, we can mount our new disk
mount -t ext4 /dev/sdb1 /newload_disk
When executing the df -h command, we can see that there are now two disks, sda and sdb.
Do you think everything is ok? Not yet, if you only do the above things and restart the computer, the disk will disappear again, and you need to mount it again.
We can edit the fstab file
vim /etc/fstab
# 在最后,增加一行
/dev/sdb1 /newload_disk ext4 errors=remount-ro 0 1
Ok, now mount a new disk is complete, restart the computer, the new disk also exists.