linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rollback of a snapshot is just read-only
@ 2015-04-24 14:08 Lentes, Bernd
  2015-04-24 14:42 ` Hugo Mills
  2015-04-27 10:38 ` Juergen Sauer
  0 siblings, 2 replies; 5+ messages in thread
From: Lentes, Bernd @ 2015-04-24 14:08 UTC (permalink / raw)
  To: 'linux-btrfs@vger.kernel.org'

Hi,

it should be just a small problem, but it is one. How can I rollback to a snapshot of my root filesystem ?
Googeling, I found a lot of solutions, each different.
I finally choosed this one: https://btrfs.wiki.kernel.org/index.php/UseCases#I_want_to_be_able_to_do_rollbacks_with_Btrfs

I made the snapshot, changed some configuration, and afterwards I'd like to rollback to the snapshot:

- btrfs subvolume snapshot -r  /  /.snapshots/vor_nvidia

- change some configuration

- btrfs subvolume set-default 625 (id of the snapshot)

- reboot

My /-folder is again the old one, that's ok. The change of the configuration has disappeared. But it is just read-only:
pc63422:~ # touch /test
touch: cannot touch '/test': Read-only file system

mount says:

...
/dev/sda1 on /  type btrfs (rw,ssd,space_cache)
...

It seems to be rw !?

OS: SLES 12 64bit
kernel: 3.12.38-44-default

pc63422:~ # rpm -qa|grep -i btrfs
btrfsprogs-3.16.2-7.1.x86_64
libbtrfs0-3.16.2-7.1.x86_64
btrfsmaintenance-0.1-7.1.noarch

pc63422:~ # btrfs --version
Btrfs v3.16.2+20150127

pc63422:~ # btrfs fi show
Label: none  uuid: 7edcb64a-4ca6-47ec-8979-54e158c96ac2
        Total devices 1 FS bytes used 145.19GiB
        devid    1 size 450.00GiB used 150.04GiB path /dev/sda1

pc63422:~ # btrfs fi df /
Data, single: total=146.01GiB, used=142.74GiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, single: total=4.00GiB, used=2.44GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

Thanks for any hint.


Bernd

--
Bernd Lentes

Systemadministration
Institut für Entwicklungsgenetik
Gebäude 35.34 - Raum 208
HelmholtzZentrum münchen
bernd.lentes@helmholtz-muenchen.de
phone: +49 89 3187 1241
fax:   +49 89 3187 2294
http://www.helmholtz-muenchen.de/idg

Je suis Charlie



Helmholtz Zentrum München
Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
Ingolstädter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht München HRB 6466
USt-IdNr: DE 129521671

^ permalink raw reply	[flat|nested] 5+ messages in thread

* rollback of a snapshot is just read-only
@ 2015-04-24 14:26 Lentes, Bernd
  2015-04-27 11:47 ` Austin S Hemmelgarn
  0 siblings, 1 reply; 5+ messages in thread
From: Lentes, Bernd @ 2015-04-24 14:26 UTC (permalink / raw)
  To: 'linux-btrfs@vger.kernel.org'

Hi,

it should be just a small problem, but it is one. How can I rollback to a snapshot of my root filesystem ?
Googeling, I found a lot of solutions, each different.
I finally choosed this one: https://btrfs.wiki.kernel.org/index.php/UseCases#I_want_to_be_able_to_do_rollbacks_with_Btrfs

I made the snapshot, changed some configuration, and afterwards I'd like to rollback to the snapshot:

- btrfs subvolume snapshot -r  /  /.snapshots/vor_nvidia

- change some configuration

- btrfs subvolume set-default 625 (id of the snapshot)

- reboot

My /-folder is again the old one, that's ok. The change of the configuration has disappeared. But it is just read-only:
pc63422:~ # touch /test
touch: cannot touch '/test': Read-only file system

mount says:

...
/dev/sda1 on /  type btrfs (rw,ssd,space_cache)
...

It seems to be rw !?

OS: SLES 12 64bit
kernel: 3.12.38-44-default

pc63422:~ # rpm -qa|grep -i btrfs
btrfsprogs-3.16.2-7.1.x86_64
libbtrfs0-3.16.2-7.1.x86_64
btrfsmaintenance-0.1-7.1.noarch

pc63422:~ # btrfs --version
Btrfs v3.16.2+20150127

pc63422:~ # btrfs fi show
Label: none  uuid: 7edcb64a-4ca6-47ec-8979-54e158c96ac2
        Total devices 1 FS bytes used 145.19GiB
        devid    1 size 450.00GiB used 150.04GiB path /dev/sda1

pc63422:~ # btrfs fi df /
Data, single: total=146.01GiB, used=142.74GiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, single: total=4.00GiB, used=2.44GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

Thanks for any hint.


Bernd

--
Bernd Lentes

Systemadministration
Institut für Entwicklungsgenetik
Gebäude 35.34 - Raum 208
HelmholtzZentrum münchen
bernd.lentes@helmholtz-muenchen.de
phone: +49 89 3187 1241
fax:   +49 89 3187 2294
http://www.helmholtz-muenchen.de/idg

Je suis Charlie



Helmholtz Zentrum München
Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
Ingolstädter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht München HRB 6466
USt-IdNr: DE 129521671

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rollback of a snapshot is just read-only
  2015-04-24 14:08 Lentes, Bernd
@ 2015-04-24 14:42 ` Hugo Mills
  2015-04-27 10:38 ` Juergen Sauer
  1 sibling, 0 replies; 5+ messages in thread
From: Hugo Mills @ 2015-04-24 14:42 UTC (permalink / raw)
  To: Lentes, Bernd; +Cc: 'linux-btrfs@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 1942 bytes --]

On Fri, Apr 24, 2015 at 04:08:24PM +0200, Lentes, Bernd wrote:
> Hi,
> 
> it should be just a small problem, but it is one. How can I rollback to a snapshot of my root filesystem ?
> Googeling, I found a lot of solutions, each different.
> I finally choosed this one: https://btrfs.wiki.kernel.org/index.php/UseCases#I_want_to_be_able_to_do_rollbacks_with_Btrfs
> 
> I made the snapshot, changed some configuration, and afterwards I'd like to rollback to the snapshot:
> 
> - btrfs subvolume snapshot -r  /  /.snapshots/vor_nvidia

   You made a read-only snapshot.

> - change some configuration
> 
> - btrfs subvolume set-default 625 (id of the snapshot)
> 
> - reboot

   ... so it's going to be read-only when you try using it as your
root FS. :)

> My /-folder is again the old one, that's ok. The change of the configuration has disappeared. But it is just read-only:
> pc63422:~ # touch /test
> touch: cannot touch '/test': Read-only file system
> 
> mount says:
> 
> ...
> /dev/sda1 on /  type btrfs (rw,ssd,space_cache)
> ...
> 
> It seems to be rw !?

   There's a bit of an awkward distinction here: subvolumes (and hence
snapshots) have a read-only property which is entirely independent of
the mount flags. So you've got a read-write mount (i.e. the VFS will
allow a write attempt, and pass it down to the FS), but that part of
the FS is itself read-only (so the FS will complain).

   What you should probably be considering is not using set-default,
but instead using mount options (subvol=/path) to select the subvolume
you want to mount. If you want to make a read-only snapshot into a
read-write one, you can simply snapshot it again without the -r
option.

   Hugo.

-- 
Hugo Mills             | Reading Mein Kampf won't make you a Nazi. Reading
hugo@... carfax.org.uk | Das Kapital won't make you a communist. But most
http://carfax.org.uk/  | trolls started out with a copy of Lord of the Rings.
PGP: E2AB1DE4          |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rollback of a snapshot is just read-only
  2015-04-24 14:08 Lentes, Bernd
  2015-04-24 14:42 ` Hugo Mills
@ 2015-04-27 10:38 ` Juergen Sauer
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Sauer @ 2015-04-27 10:38 UTC (permalink / raw)
  To: Lentes, Bernd, 'linux-btrfs@vger.kernel.org'

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 24.04.2015 um 16:08 schrieb Lentes, Bernd:
> Hi,
> 
> it should be just a small problem, but it is one. How can I rollback t
o a snapshot of my root filesystem ?
> Googeling, I found a lot of solutions, each different.
> I finally choosed this one: https://btrfs.wiki.kernel.org/index.php/Us
eCases#I_want_to_be_able_to_do_rollbacks_with_Btrfs
> 
> I made the snapshot, changed some configuration, and afterwards I'd li
ke to rollback to the snapshot:
> 
> - btrfs subvolume snapshot -r  /  /.snapshots/vor_nvidia
> 
> - change some configuration
> 
> - btrfs subvolume set-default 625 (id of the snapshot)
> 
> - reboot
...

It seems, that you has set the RO "readonly" flag on the subvolume.
The btrfs tool may se/unset the flag like

# mount /dev/sdXY /mnt -o subvol=/
# btrfs su list .
ID 258 gen 13711 top level 5 path backup
[ ... ]
# btrfs prop list backup
ro                  Set/get read-only flag of subvolume.
compression         Set/get compression for a file or directory

root@pc6:/mnt# btrfs prop get backup
ro=true
root@pc6:/mnt# btrfs prop set backup ro false
root@pc6:/mnt# btrfs prop get backup
ro=false

This worked on:
root@pc6:/mnt# uname -a ; btrfs --version
Linux pc6 3.19.3-3-ARCH #1 SMP PREEMPT Wed Apr 8 14:10:00 CEST 2015
x86_64 GNU/Linux
btrfs-progs v3.19

mit freundlichen Grüßen
Jürgen Sauer
- -- 
Jürgen Sauer - automatiX GmbH,
+49-4209-4699, juergen.sauer@automatix.de
Geschäftsführer: Jürgen Sauer,
Gerichtstand: Amtsgericht Walsrode • HRB 120986
Ust-Id: DE191468481 • St.Nr.: 36/211/08000
GPG Public Key zur Signaturprüfung:
http://www.automatix.de/juergen_sauer_publickey.gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlU+EZgACgkQW7UKI9EqarFm9ACgzHjBGXV8Jlscn2ADV1fmdSo6
qgcAn0wWESh7XADCX2Lp8DWrz3FPSnMS
=5tHu
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rollback of a snapshot is just read-only
  2015-04-24 14:26 rollback of a snapshot is just read-only Lentes, Bernd
@ 2015-04-27 11:47 ` Austin S Hemmelgarn
  0 siblings, 0 replies; 5+ messages in thread
From: Austin S Hemmelgarn @ 2015-04-27 11:47 UTC (permalink / raw)
  To: Lentes, Bernd, 'linux-btrfs@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 2096 bytes --]

On 2015-04-24 10:26, Lentes, Bernd wrote:
> Hi,
>
> it should be just a small problem, but it is one. How can I rollback to a snapshot of my root filesystem ?
> Googeling, I found a lot of solutions, each different.
> I finally choosed this one: https://btrfs.wiki.kernel.org/index.php/UseCases#I_want_to_be_able_to_do_rollbacks_with_Btrfs
>
> I made the snapshot, changed some configuration, and afterwards I'd like to rollback to the snapshot:
>
> - btrfs subvolume snapshot -r  /  /.snapshots/vor_nvidia
>
> - change some configuration
>
> - btrfs subvolume set-default 625 (id of the snapshot)
>
> - reboot
>
> My /-folder is again the old one, that's ok. The change of the configuration has disappeared. But it is just read-only:
> pc63422:~ # touch /test
> touch: cannot touch '/test': Read-only file system
>
> mount says:
>
> ...
> /dev/sda1 on /  type btrfs (rw,ssd,space_cache)
> ...
>
> It seems to be rw !?
>
> OS: SLES 12 64bit
> kernel: 3.12.38-44-default
>
> pc63422:~ # rpm -qa|grep -i btrfs
> btrfsprogs-3.16.2-7.1.x86_64
> libbtrfs0-3.16.2-7.1.x86_64
> btrfsmaintenance-0.1-7.1.noarch
>
> pc63422:~ # btrfs --version
> Btrfs v3.16.2+20150127
>
> pc63422:~ # btrfs fi show
> Label: none  uuid: 7edcb64a-4ca6-47ec-8979-54e158c96ac2
>          Total devices 1 FS bytes used 145.19GiB
>          devid    1 size 450.00GiB used 150.04GiB path /dev/sda1
>
> pc63422:~ # btrfs fi df /
> Data, single: total=146.01GiB, used=142.74GiB
> System, single: total=32.00MiB, used=16.00KiB
> Metadata, single: total=4.00GiB, used=2.44GiB
> GlobalReserve, single: total=512.00MiB, used=0.00B
>
> Thanks for any hint.
>
>
So, a snapshot being read-only is totally different from the FS being 
mounted read-only.  There is a special property on the snapshot that 
determines whether it is read-only or writable, which is first set when 
the snapshot is created.  To change that property so that the snapshot 
is writable, you can use the following command from the top directory of 
the snapshot:
     btrfs property set . ro false



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2967 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-27 11:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 14:26 rollback of a snapshot is just read-only Lentes, Bernd
2015-04-27 11:47 ` Austin S Hemmelgarn
  -- strict thread matches above, loose matches on Subject: below --
2015-04-24 14:08 Lentes, Bernd
2015-04-24 14:42 ` Hugo Mills
2015-04-27 10:38 ` Juergen Sauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).