Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I currently have a file server, and all the files are installed in /usr/local/nginx/html/.

The setup is one hard disk with 1 TB of data. This 1 TB of storage is all used up.

I asked the guys to add two HDDs with 2 TB each. These new HDDs will be used for new storage of files. Now, if I mount these two new HDDs into /usr/local/nginx/html/, the current files in there will be deleted.

My goal is to expand the storage in /usr/local/nginx/html/ without losing data in it. Would this be possible?

share|improve this question
1  
Did you consider using RAID on your server to protect against data loss (disk failure)? –  Khaled Mar 21 '12 at 17:07
    
I'm surprised no one has mentioned using LVM. –  Justin ᚅᚔᚈᚄᚒᚔ Mar 21 '12 at 18:23
1  
… or moving him over to FreeBSD and using ZFS. True enough –  MikeyB Mar 21 '12 at 21:09
add comment

2 Answers

up vote 13 down vote accepted

The easiest way of moving the files over to the new mountpoint is:

# cd /usr/local/nginx/html
# vi /etc/fstab # (add the new disk to the fstab now so you don't forget!)
# mount /usr/local/nginx/html
# mv * /usr/local/nginx/html

And by the way, use RAID :)

share|improve this answer
    
+1, referencing current yet unreachable directory. Love it! –  Jeff Ferland Mar 21 '12 at 17:17
    
That's very clever. Took me a few seconds to work out how it could work. And yes - use RAID! –  D_Bye Mar 21 '12 at 17:19
2  
This is terrible, yet also, strangely wonderful... –  voretaq7 Mar 21 '12 at 17:20
    
Wow.. wonderful solution. –  Tim Brigham Mar 21 '12 at 17:26
    
I'm not sure if this is evil or genius. Evil genius? –  Justin ᚅᚔᚈᚄᚒᚔ Mar 21 '12 at 18:20
add comment

The files wouldn't be deleted by mounting another device at /usr/local/nginx/html - they would just be masked beneath the mounted file system.

In such a situation, I would install the new disks, create appropriate file systems (can't help there - I don't use Linux), temporarily mount the new disk at, say, /mnt and move the data from /usr/local/nginx/html to /mnt. You can then unmount the new device, and mount it at /usr/local/nginx/html and all your current files will be available on the new disk, along with all that extra capacity.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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