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'm putting together a simple daily backup script which rsyncs my home directory to a separate partition. I want to have the backup partition mounted at all times to allow browsing, however I also want it to be readonly so I don't mess it accidentally.

My initial plan was to mount the backup partition as readonly and bind mount it read-write in the tmp directory before the backup starts. Something like this:

mount -o ro /dev/sda1 /backup

# At start of each backup session

mount --bind /backup /tmp/backup12345
mount -o remount,rw /tmp/backup12345

This doesn't seem to work. The bind mount remains readonly despite remounting it read-write.

Can anyone suggest a solution to this? Appreciated.

share|improve this question
add comment

1 Answer

you're remounting the bind mount, which is mounting a read-only partition. You would need to remount /backup as read/write in order to write to the partition. The bind mount is more like a 'symlink' to an underlying partition/inode.

share|improve this answer
add comment

Your Answer

 
discard

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