Snapshots padres-hijos en Btrfs
Tengo / formateado a Btrfs (salvo /boot, por una limitación de Fedora). Utilizo snapper para manejar los snapshots. Por ejemplo, en mi sistema:
j ~ sudo snapper ls
[sudo] password for j:
# | Type | Pre # | Date | User | Cleanup | Description | Userdata
-----+--------+-------+----------------------------------+------+---------+----------------------------------------------------------------------+--------------
0 | single | | | root | | current |
55 | single | | Tue 19 Nov 2019 02:16:29 AM CET | root | number | |
56 | single | | Sat 23 May 2020 12:36:49 AM CEST | root | | |
57 | pre | | Fri 29 May 2020 01:25:49 AM CEST | root | number | /usr/bin/dnf install i3 i3status dmenu i3lock xbacklight feh conky |
58 | post | 57 | Fri 29 May 2020 01:26:08 AM CEST | root | number | /usr/bin/dnf install i3 i3status dmenu i3lock xbacklight feh conky |
59 | pre | | Fri 29 May 2020 03:16:09 AM CEST | root | number | /usr/bin/dnf install volumeicon |
60 | post | 59 | Fri 29 May 2020 03:16:18 AM CEST | root | number | /usr/bin/dnf install volumeicon |
61 | pre | | Fri 29 May 2020 03:43:31 AM CEST | root | number | /usr/bin/dnf install pasystray |
62 | post | 61 | Fri 29 May 2020 03:43:34 AM CEST | root | number | /usr/bin/dnf install pasystray |
63 | pre | | Fri 29 May 2020 04:24:42 AM CEST | root | number | /usr/bin/dnf install compton |
64 | post | 63 | Fri 29 May 2020 04:24:46 AM CEST | root | number | /usr/bin/dnf install compton |
65 | pre | | Fri 29 May 2020 04:26:05 AM CEST | root | number | /usr/bin/dnf install network-manager-applet |
66 | post | 65 | Fri 29 May 2020 04:26:10 AM CEST | root | number | /usr/bin/dnf install network-manager-applet |
67 | pre | | Fri 29 May 2020 04:39:42 AM CEST | root | number | /usr/bin/dnf install xfce4-notifyd.x86_64 |
68 | post | 67 | Fri 29 May 2020 04:39:48 AM CEST | root | number | /usr/bin/dnf install xfce4-notifyd.x86_64 |
69 | pre | | Fri 29 May 2020 08:42:18 PM CEST | root | number | /usr/bin/dnf install blueman |
70 | post | 69 | Fri 29 May 2020 08:42:23 PM CEST | root | number | /usr/bin/dnf install blueman |
71 | pre | | Fri 29 May 2020 11:44:09 PM CEST | root | number | /usr/bin/dnf install openobex
|
72 | post | 71 | Fri 29 May 2020 11:44:12 PM CEST | root | number | /usr/bin/dnf install openobex |
73 | pre | | Sat 30 May 2020 03:37:56 AM CEST | root | number | /usr/bin/dnf install xfce4-power-manager |
74 | post | 73 | Sat 30 May 2020 03:38:04 AM CEST | root | number | /usr/bin/dnf install xfce4-power-manager |
75 | pre | | Sat 30 May 2020 03:57:36 AM CEST | root | number | /usr/bin/dnf install xscreensaver |
76 | post | 75 | Sat 30 May 2020 03:57:47 AM CEST | root | number | /usr/bin/dnf install xscreensaver |
77 | pre | | Sat 30 May 2020 08:34:31 AM CEST | root | number | /usr/bin/dnf remove xfce4-power-manager xfce4-power-manager-settings |
78 | post | 77 | Sat 30 May 2020 08:34:34 AM CEST | root | number | /usr/bin/dnf remove xfce4-power-manager xfce4-power-manager-settings |
82 | single | | Sat 30 May 2020 10:00:15 PM CEST | root | number | |
83 | single | | Sat 30 May 2020 10:15:57 PM CEST | root | number | rollback backup of #82 | important=yes
84* | single | | Sat 30 May 2020 10:15:58 PM CEST | root | | |
85 | pre | | Sat 30 May 2020 10:38:36 PM CEST | root | number | /usr/bin/dnf group install Xfce Desktop |
86 | post | 85 | Sat 30 May 2020 10:40:25 PM CEST | root | number | /usr/bin/dnf group install Xfce Desktop |
87 | pre | | Sat 30 May 2020 11:31:42 PM CEST | root | number | /usr/bin/dnf install arandr |
88 | post | 87 | Sat 30 May 2020 11:31:47 PM CEST | root | number | /usr/bin/dnf install arandr |
89 | single | | Sun 31 May 2020 04:00:33 AM CEST | root | | Después de forzar HDMI-A-2 |
90 | pre | | Sun 31 May 2020 04:13:30 AM CEST | root | number | /usr/bin/dnf install i3 i3status dmenu i3lock xbacklight feh conky |
91 | post | 90 | Sun 31 May 2020 04:13:41 AM CEST | root | number | /usr/bin/dnf install i3 i3status dmenu i3lock xbacklight feh conky |
92 | pre | | Sun 31 May 2020 04:40:48 AM CEST | root | number | /usr/bin/dnf install nitrogen |
93 | post | 92 | Sun 31 May 2020 04:40:52 AM CEST | root | number | /usr/bin/dnf install nitrogen |
94 | pre | | Sun 31 May 2020 05:37:12 AM CEST | root | number | /usr/bin/dnf install xscreensaver-extras |
95 | post | 94 | Sun 31 May 2020 05:37:18 AM CEST | root | number | /usr/bin/dnf install xscreensaver-extras |
96 | pre | | Sun 31 May 2020 05:41:51 AM CEST | root | number | /usr/bin/dnf install xscreensaver-gl-base xscreensaver-gl-extras |
97 | post | 96 | Sun 31 May 2020 05:41:56 AM CEST | root | number | /usr/bin/dnf install xscreensaver-gl-base xscreensaver-gl-extras |
98 | pre | | Wed 03 Jun 2020 04:15:52 AM CEST | root | number | /usr/bin/dnf install xfce4-i3-workspaces-plugin |
99 | post | 98 | Wed 03 Jun 2020 04:15:57 AM CEST | root | number | /usr/bin/dnf install xfce4-i3-workspaces-plugin |
100 | pre | | Sat 06 Jun 2020 10:20:03 AM CEST | root | number | /usr/bin/dnf update chromium-freeworld |
101 | post | 100 | Sat 06 Jun 2020 10:20:22 AM CEST | root | number | /usr/bin/dnf update chromium-freeworld |
102 | pre | | Tue 09 Jun 2020 05:29:40 PM CEST | root | number | /usr/bin/dnf install perl-core |
103 | post | 102 | Tue 09 Jun 2020 05:29:59 PM CEST | root | number | /usr/bin/dnf install perl-core |
104 | pre | | Tue 09 Jun 2020 05:47:30 PM CEST | root | number | /usr/bin/dnf install btrbk |
105 | post | 104 | Tue 09 Jun 2020 05:47:35 PM CEST | root | number | /usr/bin/dnf install btrbk |
El problema de esta herramienta es que no se pueden apreciar las relaciones padre-hijo entre snapshots. He estado investigando y he encontrado un par de formas de averiguarlo:
Con subvolume show podemos ver los snapshots hijos:
j ~ sudo btrfs subvolume show /
.snapshots/84/snapshot
Name: snapshot
UUID: f04fe30e-229f-6a41-9e01-67860ad7ee4e
Parent UUID: 8f981564-7301-9441-8009-ce18986d7b17
Received UUID: -
Creation time: 2020-05-30 22:15:58 +0200
Subvolume ID: 965
Generation: 986718
Gen at creation: 907645
Parent ID: 265
Top level ID: 265
Flags: -
Snapshot(s):
.snapshots/85/snapshot
.snapshots/86/snapshot
.snapshots/87/snapshot
.snapshots/88/snapshot
.snapshots/89/snapshot
.snapshots/90/snapshot
.snapshots/91/snapshot
.snapshots/92/snapshot
.snapshots/93/snapshot
.snapshots/94/snapshot
.snapshots/95/snapshot
.snapshots/96/snapshot
.snapshots/97/snapshot
.snapshots/98/snapshot
.snapshots/99/snapshot
.snapshots/100/snapshot
.snapshots/101/snapshot
.snapshots/102/snapshot
.snapshots/103/snapshot
.snapshots/104/snapshot
.snapshots/105/snapshot
De forma más general, con subvolume list, listando uuid (-u) y uuid padres (-p). Por ejemplo, para el ejemplo de arriba, buscando los hijos:
j ~ sudo btrfs subvolume list -uq / | grep f04fe30e-229f-6a41-9e01-67860ad7ee4e
ID 965 gen 986742 top level 265 parent_uuid 8f981564-7301-9441-8009-ce18986d7b17 uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e path .snapshots/84/snapshot
ID 966 gen 908117 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 3d15ef6d-5ac4-8c41-b90f-a0ff36704f28 path .snapshots/85/snapshot
ID 967 gen 909534 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 697b8929-177a-ca4d-964c-096d05b88c95 path .snapshots/86/snapshot
ID 968 gen 910017 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 94415df8-0d0a-504b-8886-8c0c12f7118c path .snapshots/87/snapshot
ID 969 gen 910068 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid e35b6f11-1f04-6f4f-b370-afaaa9455142 path .snapshots/88/snapshot
ID 971 gen 912432 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 63dff362-6d14-1d46-ba78-b0ceae816f4b path .snapshots/89/snapshot
ID 972 gen 912674 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid ae430e83-bb02-2b41-8af6-86ccbb7deea1 path .snapshots/90/snapshot
ID 973 gen 912734 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 9095165b-ec2d-8b41-8285-8afc32b5056a path .snapshots/91/snapshot
ID 974 gen 913149 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid e364ecec-0a45-8645-971c-09342ea4a8e8 path .snapshots/92/snapshot
ID 975 gen 913161 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 94472265-ea0d-174c-95e4-7d4303f24a83 path .snapshots/93/snapshot
ID 976 gen 913589 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 7a845260-9f38-404a-a087-3cce9f84815c path .snapshots/94/snapshot
ID 977 gen 913636 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 57550253-2867-7c44-922f-bf8499a687e7 path .snapshots/95/snapshot
ID 978 gen 913743 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 217bba12-3793-514f-83e1-e615a2a11abb path .snapshots/96/snapshot
ID 979 gen 913808 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 2bdeb1fc-8c49-7e4c-9f6c-e8013332a10c path .snapshots/97/snapshot
ID 980 gen 926529 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid dd5bee04-5255-1f41-b0b1-0c981690579a path .snapshots/98/snapshot
ID 981 gen 926544 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 60a35146-f294-8b49-a4a9-e9d7b30c8a7e path .snapshots/99/snapshot
ID 1025 gen 961105 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 7b498848-8e2d-a945-b48c-7ca1e5a9e1ce path .snapshots/100/snapshot
ID 1026 gen 961134 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 7657bf14-2d8b-984b-8ce0-c1312dd1e17a path .snapshots/101/snapshot
ID 1027 gen 984634 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 7e74cd10-86ef-b94f-9b13-15ced9abeae8 path .snapshots/102/snapshot
ID 1028 gen 984881 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 7f6019ce-fbd8-7f41-9002-4c9300c2fe45 path .snapshots/103/snapshot
ID 1029 gen 985250 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid e6a982ac-f73f-bd45-8881-efa58bc61cf7 path .snapshots/104/snapshot
ID 1030 gen 985312 top level 265 parent_uuid f04fe30e-229f-6a41-9e01-67860ad7ee4e uuid 9133720e-5e9f-3c46-9995-db4af92efccf path .snapshots/105/snapshot
Para buscar los padres:
j ~ sudo btrfs subvolume list -uq / | grep 8f981564-7301-9441-8009-ce18986d7b17
ID 938 gen 907645 top level 265 parent_uuid 0c209ed1-23b4-d442-b9ed-20b565ec618a uuid 8f981564-7301-9441-8009-ce18986d7b17 path .snapshots/57/snapshot
j ~ sudo btrfs subvolume list -uq / | grep 0c209ed1-23b4-d442-b9ed-20b565ec618a
ID 334 gen 915260 top level 265 parent_uuid 426c17b1-8261-c445-9470-bdfab083f9f6 uuid 0c209ed1-23b4-d442-b9ed-20b565ec618a path .snapshots/55/snapshot
j ~ sudo btrfs subvolume list -uq / | grep 426c17b1-8261-c445-9470-bdfab083f9f6
ID 334 gen 915260 top level 265 parent_uuid 426c17b1-8261-c445-9470-bdfab083f9f6 uuid 0c209ed1-23b4-d442-b9ed-20b565ec618a path .snapshots/55/snapshot
Mirando todas las ramas, esto es lo que me queda:
55
|- 56
|- 57
| |- 84
| |- 85
| |- 86
| |- 87
| |- [...]
| |- 105
|- 58
|- 59
|- [...]
|- 83
El snapshot activo es el 84:
j ~ sudo btrfs subvolume get-default /
ID 965 gen 986858 top level 265 path .snapshots/84/snapshot
No he encontrado ninguna herramienta que haga el diagrama de árbol que he construído manualmente, sería bastante útil…