7

I understand that this is a question that is asked quite often, but unfortunately most answers involve using a LiveCD which in this case isn't possible. I'm currently using a dedicated server running Ubuntu 14.04 LTS on a host that allocates most of the disk space to the /home directory. Unfortunately, I have run out of disk space on the root directory, effectively breaking my server. My conundrum is that I already have quite a bit of data set up on the server, making it difficult to back everything up locally and reinstall the dedicated server using a better allocation.

Essentially what I'm looking for is a way to allocate everything currently on the .home directory to the / directory. From what I've read, there's no way to reallocate disks while in operation, so I really don't know where to go from here. My host does offer a "Rescue Mode" which appears to create a temporary virtual machine that mounts the current file tree in a /mnt directory, but I'm not too sure if I can repartition the disk through that. It also has an option to "Netboot", which I haven't tried yet but is always a possibility.

I am not too sure where to go from here, so any help you can provide would be much appreciated!

  • 2
    What is taking up the disk space? Are binaries such as packages? Or is it the runtime data? You would move this data to /home and use links to it. For example, /var would point to /home/var. Its hacky, but it would do the trick. – PEdroArthur May 12 '16 at 18:50
1

Ideally you should add another disk and migrate parts of your system to that but you might not get that option with your hosting solution.

As an emergency measure you could create a loopback partition in your /home folder and the mount it for use as one of the other folders like var or usr. This is a security issue as it potentially gives your user account root access so make sure you don't put the loopback on a webroot or otherwise share location.

How to make loopbacks http://www.walkernews.net/2007/07/01/create-linux-loopback-file-system-on-disk-file/

Then edit your /etc/fstab file and add an entry mounting the loopback in the right place then copy the files over to it.

Ultimately this will probably make your server worse for anyone else to understand and will negatively effect performance under heavy load . This is a bizarre reallocation of disk space, the proper solution is to deploy your system with LVM which abstracts the partitioning of disks so that you can mostly reallocate on the fly.

0

If you have enough space in your /home partition then you can create a directory in some path of your /home partition and mount that partition to where ever required using the mount utility if you are using Logical Volume Manager (LVM) using the command:

mount --bind <some-path-of-/home partition> <some-path-of-/ partition>

This mounts the path till your next reboot. However, you can use the /etc/fstab for permanent setup by appending the following lines in /etc/fstab

<some-path-of-/ partition> <some-path-of-/home partition> none bind 0 0  

More information in this link.

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.