What if the disk is full? Practical tips, very easy to use with or without testing!

♥ 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

picture

Now, after using it for a while, the disk is running out of space

picture

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   

[Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (the latest version of actual combat)_哔哩哔哩_bilibili [Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (actual combat) The latest version) has a total of 200 videos, including: 1. Why should interface automation be done in interface automation, 2. The overall view of request in interface automation, 3. Interface combat in interface automation, etc. UP hosts more exciting videos, please pay attention to UP account . https://www.bilibili.com/video/BV17p4y1B77x/?spm_id_from=333.337.search-card.all.click There is not enough disk space on the test server. How to mount a new disk?

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'

picture

In the following pop-up window, fill in the 'file size', others can use the default, click Create

picture

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.

picture

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.

picture

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

picture

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

 

picture

 Next, we can mount our new disk

mount -t ext4 /dev/sdb1 /newload_disk

picture

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

picture

 Ok, now mount a new disk is complete, restart the computer, the new disk also exists.

 

Guess you like

Origin blog.csdn.net/caixiangting/article/details/132391996