Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As far as I understand, the snapshots made by btrfs subvolume snapshot are writable by default and are visible at a certain path under the mountpoint of your btrfs volume.

How to setup the system so that there is a gurantee during the normal operation of the system that nothing is written to the snapshot? But without making it invisible to the users (i.e., it should remain accessible for reading by any users with respect to their permissions).

(For now, I've just chmod og-rwx /.snapshots where my snapshots are mapped to. But that doesn't fulfill the second of my wishes, and also the guarantee is not strong enough: a process with root's rights could spoil something there.)

Does one need to do some tricks with mount to achieve this goal?

share|improve this question
    
In LVM, there is AFAIU a dedicated lvchange --permission r for this purpose. –  imz -- Ivan Zakharyaschev Aug 17 '11 at 15:25
    
Comparing the default situation in btrfs (i.e., writable snapshots) to LVM: Can LVM snapshots be writable?. –  imz -- Ivan Zakharyaschev Aug 22 '11 at 23:57
1  
What distro are you using? Ubuntu ships with an old version of btrfs-tools, and thus does not provide read-only snapshots. –  Stefan Lasiewski May 16 '12 at 23:04

3 Answers 3

Are you using Ubuntu?

Ubuntu ships with an old version of btrfs-tools (aka "btrfs-progs"), and thus the userland tools do not support read-only snapshots.

See this bug (and it's parent bug):

https://bugs.launchpad.net/ubuntu/+source/btrfs-tools/+bug/924621

share|improve this answer

I think it is supposed to be:

btrfs subvolume snapshot -r live snap

Except it doesn't work for me.

I get that from reading the source code of the btrfs command. However it doesn't seem to work, if you try it, the argument parser gives you an error. I can't see why, and haven't bothered to ask the developers. This is off v0.19 (rev fdb6c0 in their git repository).

(BTW, I like the remount idea, but sadly ordinary users can't do it, and I am trying to keep backups of my home directory).

share|improve this answer
1  
Doesn't work for me either on Ubuntu 11.10. –  Stefan Lasiewski Feb 1 '12 at 2:21

According to Btrfs wiki, read-only snapshots are available since Linux 2.6.38. So make sure you have a recent kernel. Apart from that, you should be just able to do it using ro mount option (mount -o [other-options],ro ...).

share|improve this answer
1  
kernel.org had a security breech in mid-2011, and apparently btrfs.wiki.kernel.org is a snapshot of the wiki from before the security breech, and contains old information. From what I can tell, the current Btrfs wiki is at btrfs.ipv5.de , and this will eventually be merged into btrfs.wiki.kernel.org –  Stefan Lasiewski Feb 1 '12 at 17:16
1  
btrfs.wiki.kernel.org is now back and is updated! –  Stefan Lasiewski May 16 '12 at 23:03

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.