Increasing Disk Space in Debian 9

When there is not nearly enough on the digital server, the manager manually raises the vacuum. Exactly how to do this on a web server running 9 is explained listed below.

Preliminary preparation

Go to the server control board and move the slider. The worth is selected independently depending on the requirements of the administrator:

We save the changes.

Important! All of the following operations are performed with superuser rights.

Setup

Let’s run an OS scan to find free space.
echo 1 > /sys/block/sda/device/rescan

The utility finds the added disk space and translates the Debian information.

1. Let’s use the built-in parted utility to add a new volume to the current one. Let’s start with the p key.
Parted
(parted) p

This will open a window with the following information:

Screenshot #2. Information about disk space.

We remember the number indicated at number 1. In our case, this is 236 Gb.

2. Let the utility know which section needs to be changed. In screenshot #2, is marked with the number 2.
(parted) resizepart 2

We indicate after the question mark the new size, which is available after increasing the volume. In our case, this is 236Gb. Press Enter. Exit the utility with the quit command.

3. Update the current OS configuration. First, let’s open the built-in fdisk manager, specifying the current disk partition (sda). Let’s run the utility with the n key.
fdisk //sda
Command ( for help): n

The screen will ask you to assign a disk type.

In our example, this will be a logical drive. Press the l key.

Next, you need to set the values ​​​​of the start and end sectors. We leave it as it is, i.e. press “Enter” twice.

The utility will create a new partition. We remember its number – in our case it is 7.

4. Using the key t , change the partition type.

We indicate the number of the section that we will change (for our situation – 7). Next, we introduce a new type – 8e. If you need to know the list of available types, then use the L key.

5. Enter the operand w. The utility will report the impossibility of rebooting – we will do it manually.

6. Let’s notify the Debian OS about the changes in the sda ​​partition.
partx -v -a /dev/sda

7. Activate the new partition using the internal command.
pvcreate /dev/sda7

8. Now you need to add a new physical partition to the current volume group.
vgextend debian94-vg /dev/sda7

9. The penultimate stage – we increase the disk space of the logical volume.
lvextend -l +100%FREE /dev/debian94-vg/root

And the final step is to expand the file system of the hard drive.
resize2fs /dev/debian94-vg/root

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!