keine Snapshots von Datasets mit gesetzten jailed=on vom Host aus möglich

crotchmaster

happy BSD user
Hallo,

ich bin noch dabei, mein Backup eines FreeBSD Systems mit zfs auf die Beine zustellen. Das automatische Erstellen der Snapshots habe ich nun mit sysutils/zfstools hinbekommen.

Allerdings ist mir beim Auflisten der Snapshots aufgefallen, dass nicht von allen Datasets ein Snapshot erstellt wird. Eine erste Analyse ergab, dass die Datasets mit jailed=on ausgenommen sind. Das ist, gelinde gesagt, Mist.

Anbei die Befehle und der jeweilige output dazu:

Code:
[root@freebsd-vm /usr/local/etc/periodic]zfs list -t snapshot
NAME                                                            USED  AVAIL  REFER  MOUNTPOINT
zroot@zfs-auto-snap_daily-2017-08-18-03h00                         0      -    19K  -
zroot@zfs-auto-snap_frequent-2017-08-18-18h45                      0      -    19K  -
zroot/ROOT/default@zfs-auto-snap_daily-2017-08-17-16h00         124K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_daily-2017-08-17-20h00         123K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_daily-2017-08-18-03h00         122K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_frequent-2017-08-18-06h45      119K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_frequent-2017-08-18-09h19       20K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_frequent-2017-08-18-18h33       20K      -  13.6G  -
zroot/ROOT/default@zfs-auto-snap_frequent-2017-08-18-18h45       89K      -  13.6G  -
zroot/jails@zfs-auto-snap_daily-2017-08-18-03h00                   0      -  75.5K  -
zroot/jails@zfs-auto-snap_frequent-2017-08-18-18h45                0      -  75.5K  -
zroot/jails/basejail@zfs-auto-snap_daily-2017-08-18-03h00          0      -   437M  -
zroot/jails/basejail@zfs-auto-snap_frequent-2017-08-18-18h45       0      -   437M  -
zroot/jails/dbserver@zfs-auto-snap_daily-2017-08-18-03h00          0      -  2.47G  -
zroot/jails/dbserver@zfs-auto-snap_frequent-2017-08-18-18h45       0      -  2.47G  -
zroot/jails/newjail@zfs-auto-snap_daily-2017-08-18-03h00           0      -  2.07M  -
zroot/jails/newjail@zfs-auto-snap_frequent-2017-08-18-18h45        0      -  2.07M  -
zroot/jails/poudriere@zfs-auto-snap_daily-2017-08-17-16h00     74.5K      -   696M  -
zroot/jails/poudriere@zfs-auto-snap_daily-2017-08-17-20h00       38K      -   696M  -
zroot/jails/poudriere@zfs-auto-snap_daily-2017-08-18-03h00         0      -   696M  -
zroot/jails/poudriere@zfs-auto-snap_frequent-2017-08-18-18h45      0      -   696M  -
zroot/jails/webserver@zfs-auto-snap_daily-2017-08-18-03h00         0      -   971M  -
zroot/jails/webserver@zfs-auto-snap_frequent-2017-08-18-18h45      0      -   971M  -
zroot/usr/home@zfs-auto-snap_daily-2017-08-17-20h00            31.5K      -   430M  -
zroot/usr/home@zfs-auto-snap_daily-2017-08-18-03h00                0      -   430M  -
zroot/usr/home@zfs-auto-snap_frequent-2017-08-18-18h45             0      -   430M  -
zroot/var/audit@zfs-auto-snap_daily-2017-08-18-03h00               0      -    19K  -
zroot/var/audit@zfs-auto-snap_frequent-2017-08-18-18h45            0      -    19K  -
zroot/var/log@zfs-auto-snap_daily-2017-08-17-16h00               24K      -   265K  -
zroot/var/log@zfs-auto-snap_daily-2017-08-17-20h00             23.5K      -   264K  -
zroot/var/log@zfs-auto-snap_daily-2017-08-18-03h00             41.5K      -   266K  -
zroot/var/log@zfs-auto-snap_frequent-2017-08-18-06h45          27.5K      -   269K  -
zroot/var/log@zfs-auto-snap_frequent-2017-08-18-09h19            28K      -   270K  -
zroot/var/log@zfs-auto-snap_frequent-2017-08-18-18h33            28K      -   270K  -
zroot/var/log@zfs-auto-snap_frequent-2017-08-18-18h45            28K      -   270K  -
zroot/var/mail@zfs-auto-snap_daily-2017-08-18-03h00            27.5K      -  88.5K  -
zroot/var/mail@zfs-auto-snap_frequent-2017-08-18-18h45             0      -    96K  -

Code:
[root@freebsd-vm /usr/local/etc/periodic]zfs get -t filesystem all|grep auto-snapshot                                                          
zroot                                      com.sun:auto-snapshot  true                                       local                              
zroot/ROOT                                 com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/ROOT/default                         com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails                                com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails/basejail                       com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails/dbserver                       com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails/newjail                        com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails/poudriere                      com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/jails/webserver                      com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/postgresdb                           com.sun:auto-snapshot  true                                       local                              
zroot/postgresdb/tablespaces               com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/postgresdb/tablespaces/bitbucket_ts  com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/postgresdb/tablespaces/blp_ts        com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/postgresdb/tablespaces/jira_ts       com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/postgresdb/tablespaces/phalcon_ts    com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/postgresdb/tablespaces/ttrss_ts      com.sun:auto-snapshot  true                                       inherited from zroot/postgresdb    
zroot/poudriere                            com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/data                       com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/data/.m                    com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/data/cache                 com.sun:auto-snapshot  false                                      local                              
zroot/poudriere/data/logs                  com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/data/packages              com.sun:auto-snapshot  false                                      local                              
zroot/poudriere/data/wrkdirs               com.sun:auto-snapshot  false                                      local                              
zroot/poudriere/jails                      com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/jails/fbsd130armv6         com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/ports                      com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/poudriere/ports/default              com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/tmp                                  com.sun:auto-snapshot  false                                      local                              
zroot/usr                                  com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/usr/home                             com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/usr/ports                            com.sun:auto-snapshot  false                                      local                              
zroot/usr/src                              com.sun:auto-snapshot  false                                      local                              
zroot/var                                  com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/var/audit                            com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/var/crash                            com.sun:auto-snapshot  false                                      local                              
zroot/var/log                              com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/var/mail                             com.sun:auto-snapshot  true                                       inherited from zroot              
zroot/var/tmp                              com.sun:auto-snapshot  false                                      local

Code:
[root@freebsd-vm /usr/local/etc/periodic]zfs get -t filesystem all|grep jailed|grep -v off
zroot/postgresdb                           jailed                 on                                         local
zroot/postgresdb/tablespaces               jailed                 on                                         inherited from zroot/postgresdb
zroot/postgresdb/tablespaces/bitbucket_ts  jailed                 on                                         inherited from zroot/postgresdb
zroot/postgresdb/tablespaces/blp_ts        jailed                 on                                         inherited from zroot/postgresdb
zroot/postgresdb/tablespaces/jira_ts       jailed                 on                                         inherited from zroot/postgresdb
zroot/postgresdb/tablespaces/phalcon_ts    jailed                 on                                         inherited from zroot/postgresdb
zroot/postgresdb/tablespaces/ttrss_ts      jailed                 on                                         inherited from zroot/postgresdb
zroot/poudriere                            jailed                 on                                         local
zroot/poudriere/data                       jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/data/.m                    jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/data/cache                 jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/data/logs                  jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/data/packages              jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/data/wrkdirs               jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/jails                      jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/jails/fbsd130armv6         jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/ports                      jailed                 on                                         inherited from zroot/poudriere
zroot/poudriere/ports/default              jailed                 on                                         inherited from zroot/poudriere

Trotz viel Suchens habe ich bisher nichts dazu gefunden, kann mir aber nicht vorstellen, dass ich der Erste mit dem Problem bin. Welche Möglichkeiten gibt es, um doch noch für diese Datasets einen Snapshot vom Hostsystem aus zumachen?

Gruß c.
 
Das ist leider nicht zu ändern. Technisch gesehen ist der Host das spezielle Jail mit der JID 0. Ein ZFS-Dataset kann nur und ausschließlich von dem Jail aus manipuliert werden, dem es zugewiesen ist. Spricht wenn das Jail zu z.B. JID 1 gehört, kann der Host auf JID 0 es nicht mehr anfassen. Ich feuere als Würg-Around per "jexec ..." vom Host das Snapshot-Kommando noch mal im Jail ab, aber schön ist das nicht... :(
 
Hallo Yamagi,

vielen Dank für den Hinweis mit jexec, das hatte ich gar nicht auf dem Schirm. Mit dem Würg-around kann ich leben, da dies alles in einem Script passieren wird.
Wie heißt es so doch: Nicht schön, aber selten! :D
 
Kleines Update. Ich habe heute nochmal ein bisschen rumgespielt. Es sieht so aus, dass Snapshots doch vom Host-System aus gehen.
Und zwar habe ich zuerst die zfstools in den Jails installiert, dafür musste ich meine ezjail Jails starten. Nach einem neuerlichen Start von zfs-auto-snapshot waren Snapshots der Tablespace Datasets des DB-Servers erstellt worden, nicht aber für das Poudriere Jail. Komisch, dachte ich mir, da ich das Script mit einem jexec-Aufruf der zfstools noch in der Mache hatte. Das ein zfs-auto-snapshot im Host ein im Jail installiertes zfs-auto-snapshot aufruft, wäre doch etwas viel Automagie gewesen. Also habe ich die zfstools in den Jails wieder deinstalliert und den Befehl nochmal vom Host abgesetzt. Wieder wurden von den Tablespace Datasets Snapshots erstellt, Poudriere wurde wieder komplett ignoriert.
Dann viel mir ein, das Poudriere seine Datasets ja bei Bedarf mountet. Also flux ins Jail gewechselt und zfs mount -a abgesetzt und vom Host wieder einen Snapshot erstellt und siehe da, auch von den Poudriere Datasets werden Snapshots erstellt. Es schaut so aus, das Datasets eingehängt sein müssen, um von ihnen einen Snapshot erstellen zu können, dann aber auch vom Host aus erstellt werden können.
 
Zurück
Oben