1

The case I have is a directory that stores phone call recordings throughout the day. The root filesystem is running out of space so we added an external hard drive. This server may not be taken out of production for any reason, so what I would like to do is mount the new disk over the same recordings directory, and then after all of the calls in progress have finished I would copy them from the old filesystem into the new one.

I will be able to determine when the calls in progress during this transition have been finished up.

My question is how can I access the files beneath /var/x/y/recordings/ after I mount a new disk onto /var/x/y/recordings/?

I believe an open file should be able to finish being written to and eventually closed after a new FS is mounted over its parent directory. Is this incorrect?

4 Answers 4

4

My question is how can I access the files beneath /var/x/y/recordings/ after I mount a new disk onto /var/x/y/recordings/?

If you know that you are going to be doing this ahead of time, then you can do a mount --bind /var/x/y/recordings /foo before you mount something else into that location. The folder you did the bind mount too should still be show you the underlying filesystem instead of the one you mounted.

I believe an open file should be able to finish being written to and eventually closed after a new FS is mounted over its parent directory.

I am sorry, I am not sure about that. You may need to test on a spare box.

3
  • 2
    +1 for mount --bind. As to the second question, yes, the process will be able to continue writing to the open file even after the new filesystem is mounted on /var/x/y/recordings, because it is writing to a file descriptor, not to a specific path. However, if the process closes the file descriptor, it will be unable to re-open it unless you first copy the file to the new filesystem. Nov 3, 2010 at 16:55
  • Good freaking call--I should have thought of that from my installing gentoo days! Thanks to both of you. Nov 3, 2010 at 21:43
  • 2
    You don't even need to plan ahead of time: you can do e.g. mount --bind /var /foo and see the old files under /foo/x/y/recordings. Nov 13, 2010 at 15:34
0

Instead of replacing the /var/x/y/recordings directory with a new filesystem, mount the new drive as /var/x/y/recordings/archive and move older recordings from /var/x/y/recordings to /var/x/y/recordings/archive to free up space. Then once you are able to schedule some downtime you can move the new disk to /var/x/y/recordings full time. You might want to look into using LVM or a similar technology to be able to expand filesystems on the fly.

2
  • The spec doesn't allow for downtime. Whether or not that means I just don't want to stay after hours for this job is irrelevant! Nov 3, 2010 at 21:42
  • No downtime ever?
    – jcollie
    Nov 4, 2010 at 2:23
0

Tangentially related: have you considered the disk I/O performance impact of the phone calls on the external drive versus what you have internally? If you're exceeding ~40 IOPS on your current disk, you might find that it's not fast enough and it might result in hanging, choppiness and dropped calls on your PBX if you're logging synchronously.

0

While you can access files from both drives using (e.g.) unionfs - its not the right way to solve the problem. Mount the new drive somewhere else (or move the original files).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .