3

The disk (or 2 disks in a RAID 1) of a server is running full (96 %). I want to add a new SSD (not being part of the RAID).

What I don't understand is how or where to mount it, so I can use it seamlessly within the existing structures.

How do I mount sub-directory to a hard drive in Linux? doesn't make me smarter, even if it's probably what I am looking for.

I have something like /var/www/vhosts/example.com/httpdocs/images/dirA. Since it is important for me that the web servers (Apache and nginx) can access the files on the new disk immediately, I think I have to mount it somewhere inside of /var/www/vhosts/example.com/httpdocs/ so it won't end in limited access.

So can I just create /var/www/vhosts/example.com/httpdocs/images/dirB and mount the new disk there? Will it affect the RAID in any way?

Or is it maybe more advisable to mount it "outside", like /newDiskX and then symlink /newDiskX to /var/www/vhosts/example.com/httpdocs/images/dirB?

What I've understood from https://unix.stackexchange.com/questions/198542/what-happens-when-you-mount-over-an-existing-folder-with-contents is that I can't mount it directly to /var/www/vhosts/example.com/httpdocs/images/dirA without complications or actually gaining more space overall.

My problem is, that I have only "one shot" and I can't do it myself; I have to tell my hoster to install the new disk and where to mount/bind/link it.

EDIT:

To visualize it, here the current/planned structure:

/
├── A/ (existing on old disk)
|   ├── B/ (existing on old disk, access point for Apache etc.)
|   |   ├── C/ (existing on old disk)
|   |   |   └── file.tmp (existing on old disk)
|   |   ├── D/ (existing on old disk)
|   |   ├── file.tmp (existing on old disk)
|   |   └── E/ (existing on old disk)
|   |   └── X/ (new to be on new disk)
|   └── other stuff
3

In other words, you have some directory structure like /a/b/c/d/e and you want to mount your new disk to /a/b/c/. If you'd simply mount it there, you'd lost access to you /a/b/c/d/ directory content!

So first you'll have to backup the content of /a/b/c/* subtree. If it's static, you can do it even with running application (httpd/nginx I guess). If it's something dynamic, you'd have to either disable the application or switch it to RO mode.

Now, when you have the content somewhere else, stop the application to be sure, nothing accesses it. Delete the /a/b/c/* so you get free space in the partition.

The /a/b/c is now empty directory and can be used as mounpoint. Let your provider to mount the new device to the /a/b/c mountpoint and restore data from your previous backup so you have /a/b/c/d subtree back. Start your application.

Now you should have all the space of the new device available in /a/b/c/.

The best if you try yourself for example with flash disk or SD card so you know what's going to happen.

  • Almost. I have something like /a/b/c/d/e and want to mount the new disk to /a/b/c/d/x. So /a/b/c/d exists, x doesn't yet. Would be a new directory inside of an existing directory with other directories/files. – antesoles Oct 27 '17 at 10:15
  • 1
    Yes, then it seems safe. The new empty dir is valid mountpoint. – Jaroslav Kucera Oct 27 '17 at 11:27

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.