0

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.

1 Answers1

-1

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.

karmawhore
  • 3,865
  • 18
  • 9