Let us assume that I have two hard drives (A,B) and have the following directories:
- /var/www
- /var/www/upload
Currently if I upload a file to /var/www OR /var/www/upload ; it will be saved in drive A.
How do I make the folder /var/www/upload point to the drive B. So if I upload a file to /var/www/upload it will be saved in drive B but when I upload a file to /var/www ,it will be saved in drive A.
Best Answer
I assumed that disk A is not mounted as the root (/) filesystem. If it is, just ignore lines with driveA.
Edit your /etc/fstab:
You can replace "auto" by the filesystem you have on that partition, but the above should work anyway.
If disks A and B are mounted elsewhere you can try symlinking:
Note: /var/www and directory "upload" on driveA must not exist or this will fail.
Personally I prefer using the bind option of mount:
Consider editing /etc/fstab though - it's probably the best way.