0

I have this:

/home/devsite1/public_html/media on /home/devsite2/public_html/media type none (rw,bind)

I mistakenly thought that deleting /home/devsite2/public_html/media would have no effect on the "devsite1" version. Is there any way to prevent that effect?

I am on CentOS 6.7

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Buttle Butkus
  • 1,741
  • 8
  • 33
  • 45

2 Answers2

0

The easiest way to prevent a disk from being modified is to mount it as read-only instead of read-write.

I suspect this isn't exactly what you were looking for. If you have files from 2 locations and you want to use 1 as a "base" and write all modified content/new content to the 2nd location, you might want to consider using something like unionfs to mount both directories to 1 target. You can make one read-only, and the other read-write... or make both read-write, but keep in mind that the first file-system will get the writes unless it becomes unavailable.

TheCompWiz
  • 7,409
  • 17
  • 23
  • No I think read-only is *probably* what I want. Will that also prevent deletions? Basically, the mounted folder was supposed to be there as a dummy, or mock, just to provide the image resources to make my development copy look like the original. I should have done my research first, but I did not expect to be working on that copy and suddenly delete the original. – Buttle Butkus Dec 04 '15 at 21:29
0

Consider also just duplicating the entire thing with cp -r. Simpler can be better. Later you can figure out differences with some kind of version control system.

You could come up with a permissions scheme where they cannot touch each other. Allowing you to share resources with symlinks or whatever. Such as ownership and writable by users devsite1 and devsite2 respectively. Maybe read only on both for a www group or something for the web server.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34