I have a Debian server.

I have the following situation in my server. In the root I have Apache server running. I noticed that the disk is full but I can see that in /dev/sda2 there is still 50 gb available.

Is there a way to merge them, or increase the disk space of root?

enter image description here

Disk /dev/sda: 74.5 GiB, 80026361856 bytes, 156301488 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
Disklabel type: dos
Disk identifier: 0x7db7aa90

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         4096  40962047  40957952 19.5G 83 Linux
/dev/sda2        40962048 155246591 114284544 54.5G 83 Linux
/dev/sda3       155246592 156293119   1046528  511M 82 Linux swap / Solaris
  • Is this a local machine or a remote server?
    – Alxs
    Apr 8, 2017 at 14:31
  • You can repartition but you will need to unmount your root filesystem, which is considerably easier if you're physically at the machine.
    – Alxs
    Apr 8, 2017 at 14:38

1 Answer 1


An easier solution than re-installing your OS with a different partition layout, or booting from a rescue disk and resizing existing partitions, may be to use a bind mount.

There is an excellent answer about bind mounts here:

Let's say for the sake of the discussion that your Apache server was talking up all the space, and it was rooted in /var/www.

Using a bind mount, you could create a directory in /home, which is where /dev/sda2 is mounted, like /home/www, move everything from /var/www into /home/www, and then bind mount /home/www at /var/www.

bash-# mkdir /home/www
bash-# mv /var/www/* /home/www/
bash-# chown -R $owner:$group /home/www   <-- this step may be optional
bash-# mount --bind /home/www /var/www

This would allow you to consume space from /dev/sda as if it were part of /, without having to resize any partitions, or even reboot the server.

It also means you don't need to configure anything that is expecting things in /var/www to look for them in /home/www ( startup scripts, applications that use the webserver, cron jobs, etc ).

Just don't forget to add it to /etc/fstab:

/home/www /var/www none defaults,bind 0 0

Otherwise it won't persist after a reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.