Como reparar o zsysctl após excluir manualmente os instantâneos com `zfs destroy`?

Como reparar o zsysctl após excluir manualmente os instantâneos com `zfs destroy`?

Estou executando o Linux Mint 20.3 com ZFS (inclusive para /). Até muito recentemente, sempre que eu instalava ou removia pacotes, ele também criava um instantâneo para que eu pudesse selecioná-lo durante a inicialização para reverter uma alteração que pudesse ter quebrado o sistema.

Mas parece que há uma limitação deste sistema, onde ele não consegue lidar com um grande número (1200+) de instantâneos. Não consigo mais encontrar o problema, mas sugeri executar for dataset in $(zfs list -t snapshot -o name | grep @autozsys); do sudo zfs destroy "$dataset"; donepara excluir a maioria dos instantâneos.

Como não precisava desses instantâneos mais antigos, tentei. Não consegui deletar alguns porque eram clones de outros e sem saber se isso me faria perder dados ao vivo, deixei por isso mesmo.

Mais tarde, aprendi sobre o zsysctlcomando para gerenciar instantâneos... E parece que quebrei meu sistema ao não usar esse comando, mas zfs destroydiretamente.

Agora, sempre que eu apt installou apt remove, recebo este erro (após uma pausa de 30 segundos):ERROR Service took too long to respond. Disconnecting client.

Acho que zsysctlestá parcialmente quebrado porque a execução zsysctl showdos resultados na última entrada nas listas bpoole rpoola data 0001-01-01 00:00:00estão obviamente erradas:

$ zsysctl show
Name:           rpool/ROOT/ubuntu_uyv8gh
ZSys:           true
Last Used:      current
History:        
  - Name:       rpool/ROOT/ubuntu_uyv8gh@autozsys_nma9lm
    Created on: 2022-11-17 17:43:38
  - Name:       rpool/ROOT/ubuntu_uyv8gh@autozsys_1ayzvs
    Created on: 2022-11-14 13:22:37
  - Name:       rpool/ROOT/ubuntu_uyv8gh@autozsys_yv8nrd
    Created on: 2022-11-11 17:13:10
  - Name:       rpool/ROOT/ubuntu_uyv8gh@autozsys_yu0btn
    Created on: 2022-02-15 15:58:44
  - Name:       rpool/ROOT/ubuntu_6xf31g
    Created on: 2021-10-22 17:13:50
Users:
  - Name:    pierre
    History: 
     - rpool/USERDATA/pierre_gg46xm@autozsys_nma9lm (2022-11-17 17:43:40)
     - rpool/USERDATA/pierre_gg46xm@autozsys_m6wubi (2022-11-17 14:29:58)
     - rpool/USERDATA/pierre_gg46xm@autozsys_17okng (2022-11-17 11:29:23)
     - rpool/USERDATA/pierre_gg46xm@autozsys_dgvgfz (2022-11-17 10:29:19)
     - rpool/USERDATA/pierre_gg46xm@autozsys_5mk4hd (2022-11-16 15:55:03)
     - rpool/USERDATA/pierre_gg46xm@autozsys_z90d2e (2022-11-16 14:54:03)
     - rpool/USERDATA/pierre_gg46xm@autozsys_pfutl5 (2022-11-16 13:54:03)
     - rpool/USERDATA/pierre_gg46xm@autozsys_5dfwde (2022-11-16 12:42:58)
     - rpool/USERDATA/pierre_gg46xm@autozsys_iuusno (2022-11-16 11:42:54)
     - rpool/USERDATA/pierre_gg46xm@autozsys_zzrd7w (2022-11-16 10:41:57)
     - rpool/USERDATA/pierre_gg46xm@autozsys_d4kkrw (2022-11-16 09:41:55)
     - rpool/USERDATA/pierre_gg46xm@autozsys_2ws9fj (2022-11-15 16:06:23)
     - rpool/USERDATA/pierre_gg46xm@autozsys_cfb7iu (2022-11-15 15:06:23)
     - rpool/USERDATA/pierre_gg46xm@autozsys_3rcqfi (2022-11-15 13:35:17)
     - rpool/USERDATA/pierre_gg46xm@autozsys_56mb7s (2022-11-15 12:07:32)
     - rpool/USERDATA/pierre_gg46xm@autozsys_9b068o (2022-11-15 11:06:38)
     - rpool/USERDATA/pierre_gg46xm@autozsys_o610qz (2022-11-15 10:06:35)
     - rpool/USERDATA/pierre_gg46xm@autozsys_fw4jbj (2022-11-15 08:38:21)
     - rpool/USERDATA/pierre_gg46xm@autozsys_j9ow55 (2022-11-14 17:00:43)
     - rpool/USERDATA/pierre_gg46xm@autozsys_mfc8hk (2022-11-14 15:59:43)
     - rpool/USERDATA/pierre_gg46xm@autozsys_1ayzvs (2022-11-14 13:22:39)
     - rpool/USERDATA/pierre_gg46xm@autozsys_y6xypr (2022-11-14 12:57:47)
     - rpool/USERDATA/pierre_gg46xm@autozsys_o0aj49 (2022-11-14 11:57:46)
     - rpool/USERDATA/pierre_gg46xm@autozsys_iljt6z (2022-11-14 10:57:43)
     - rpool/USERDATA/pierre_gg46xm@autozsys_2fmmg5 (2022-11-14 09:56:43)
     - rpool/USERDATA/pierre_gg46xm@autozsys_lxkohx (2022-11-14 08:55:51)
     - rpool/USERDATA/pierre_gg46xm@autozsys_czv8zx (2022-11-13 16:58:50)
     - rpool/USERDATA/pierre_gg46xm@autozsys_8kl96y (2022-11-13 15:57:50)
     - rpool/USERDATA/pierre_gg46xm@autozsys_5ks5h8 (2022-11-13 14:56:50)
     - rpool/USERDATA/pierre_gg46xm@autozsys_5m7wwk (2022-11-13 13:56:50)
     - rpool/USERDATA/pierre_gg46xm@autozsys_40udn4 (2022-11-13 12:28:40)
     - rpool/USERDATA/pierre_gg46xm@autozsys_uagprp (2022-11-13 11:28:39)
     - rpool/USERDATA/pierre_gg46xm@autozsys_4vbncy (2022-11-13 10:28:39)
     - rpool/USERDATA/pierre_gg46xm@autozsys_9buhaa (2022-11-13 09:26:59)
     - rpool/USERDATA/pierre_gg46xm@autozsys_92de9m (2022-11-12 14:48:45)
     - rpool/USERDATA/pierre_gg46xm@autozsys_x5vgcm (2022-11-12 12:00:12)
     - rpool/USERDATA/pierre_gg46xm@autozsys_pm05qo (2022-11-12 10:43:35)
     - rpool/USERDATA/pierre_gg46xm@autozsys_kxd0z1 (2022-11-12 09:43:32)
     - rpool/USERDATA/pierre_gg46xm@autozsys_welapl (2022-11-11 17:18:27)
     - rpool/USERDATA/pierre_gg46xm@autozsys_yv8nrd (2022-11-11 17:13:11)
     - rpool/USERDATA/pierre_gg46xm-rpool.ROOT.ubuntu-6xf31g (2022-11-09 07:17:16)
     - rpool/USERDATA/pierre_gg46xm@autozsys_yu0btn (2022-02-15 15:58:45)
     - rpool/USERDATA/pierre_hntkn5 (0001-01-01 00:00:00)
  - Name:    root
    History: 
     - rpool/USERDATA/root_gg46xm@autozsys_nma9lm (2022-11-17 17:43:40)
     - rpool/USERDATA/root_gg46xm@autozsys_1ayzvs (2022-11-14 13:22:39)
     - rpool/USERDATA/root_gg46xm@autozsys_yv8nrd (2022-11-11 17:13:11)
     - rpool/USERDATA/root_gg46xm-rpool.ROOT.ubuntu-6xf31g (2022-11-09 07:17:16)
     - rpool/USERDATA/root_gg46xm@autozsys_yu0btn (2022-02-15 15:58:45)
     - rpool/USERDATA/root_hntkn5 (0001-01-01 00:00:00)

Correr zsysctl save -vvnão fornece muito mais informações:

$ zsysctl save -vv
DEBUG /zsys.Zsys/SaveUserState() call logged as [e560ff96:3c3c6ace] 
DEBUG Check if grpc request peer is authorized     
DEBUG Polkit call result, authorized: true         
DEBUG Didn't receive any information from service in 30s 
ERROR Service took too long to respond. Disconnecting client.

Como posso me recuperar desse estado parcialmente quebrado?

Responder1

Você pode remover vários instantâneos usando %.

Exemplo:

zfs destroy rpool/USERDATA/pierre_gg46xm@autozsys_nma9lm%autozsys_yv8nrd 

Isso remove tudo deautozsys_nma9lmatravésautozsys_yv8nrd.

Se você tiver clones misturados entre mais de 1.200 instantâneos, talvez valha a pena reavaliar a configuração ou separar seus dados em pools específicos de dados.

Vejo que você usou o zsysctl. Não estou familiarizado com isso, mas o ZFS já está simplificado com dois comandos principais; zfse zpool.

Não parece haver muita utilidade em usar zsysctlaqui porque definitivamente complica sua configuração. Pode ser uma abstração desnecessária enão tem futuro na plataforma. Considere removê-lo.

zsys sendo removido do Ubuntu #235

zsys não consegue lidar com grandes quantidades de snapshots #224

(Eu diria o mesmo para a raiz ZFS e o grande número de instantâneos)

informação relacionada