ZFS 神奇地消失了可用的存储空间

ZFS 神奇地消失了可用的存储空间

好吧,这让我很抓狂。在系统上运行 zfs,我的根分区似乎毫无原因地缩小了。现在我的空间已经用完了,而且找不到所有东西都去了哪里。

简单df展示如下:

[root@SV02 /]# df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/opus-2457409-2017-11-07-release
                        90G   6.6G        35G    16%    /
swap                    11G   404K        11G     1%    /etc/svc/volatile
...
/usr/lib/libc/libc_hwcap1.so.1
                        41G   6.6G        35G    16%    /lib/libc.so.1
...
swap                    11G     4K        11G     1%    /tmp
swap                    11G    60K        11G     1%    /var/run
rpool/export            90G    32K        35G     1%    /export
rpool/export/home       90G    86K        35G     1%    /export/home
rpool/export/home/open  90G   404M        35G     2%    /export/home/open
rpool                   90G    43K        35G     1%    /rpool

已使用/可用似乎不一致...尝试追踪它:

[root@SV02 /]# du -sh *  | sort -h | tail -10
  10M   root
  48M   lib
  58M   etc
 141M   kernel
 174M   platform
 405M   export
 1.5G   opt
 1.5G   usr
 3.1G   var
 3.6G   proc

好的,那里只有几 GB 的数据...以为可能是快照,但事实似乎并非如此:

[root@SV02 /]# zfs list -t all
NAME                                                             USED  AVAIL  REFER  MOUNTPOINT
rpool                                                           55.5G  34.6G  43.5K  /rpool
rpool/ROOT                                                      38.6G  34.6G    31K  legacy
rpool/ROOT/C_Backup1                                            1.24M  34.6G  5.61G  /
rpool/ROOT/C_backup2                                            1.33M  34.6G  5.61G  /
rpool/ROOT/napp-it-0.8l3                                        3.00M  34.6G  2.10G  /
rpool/ROOT/napp-it-0.9e1                                        1.66M  34.6G  5.61G  /
rpool/ROOT/nfsv4                                                  54K  34.6G  2.11G  /
rpool/ROOT/openindiana                                          18.3M  34.6G  2.02G  /
rpool/ROOT/opus-2457044-2015-01-31-install                      65.4M  34.6G  31.6G  /a
rpool/ROOT/opus-2457044-2015-01-31-preinstall                      1K  34.6G  5.61G  /
rpool/ROOT/opus-2457044-2015-05-19-pre15                          45K  34.6G  6.32G  /
rpool/ROOT/opus-2457044-2016-10-03-backup                         52K  34.6G  31.3G  /
rpool/ROOT/opus-2457409-2016-10-04-install                      15.5M  34.6G  31.7G  /a
rpool/ROOT/opus-2457409-2016-10-04-preinstall                     52K  34.6G  31.5G  /
rpool/ROOT/opus-2457409-2017-11-07-release                      38.5G  34.6G  6.57G  /
rpool/ROOT/opus-2457409-2017-11-07-release@install              4.40M      -  1.56G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-02-25-22:01:25  6.64M      -  1.58G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-02-25-22:05:33  84.6M      -  2.02G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-03-19-23:25:59  58.0M      -  2.11G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-17:55:40      0      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-17:55:48      0      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-18:13:10  1.44M      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-18:14:31  2.17M      -  2.12G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-21:55:47  15.3M      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:34:52  9.18M      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:43:54   362K      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:44:05   362K      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-05-19-21:49:36   227M      -  6.32G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:11:30  3.15M      -  31.3G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:30   936K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:42   986K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:53:00   112M      -  31.8G  -
rpool/ROOT/pre_napp-it-0.8l3                                      35K  34.6G  1.58G  /
rpool/ROOT/pre_napp-it-0.9e1                                      71K  34.6G  2.10G  /
rpool/ROOT/sv02-4-10-14                                           70K  34.6G  2.10G  /
rpool/ROOT/sv02-4-10-14-v2                                      4.17M  34.6G  2.12G  /
rpool/dump                                                      8.00G  34.6G  8.00G  -
rpool/export                                                     404M  34.6G    32K  /export
rpool/export/home                                                404M  34.6G  86.5K  /export/home
rpool/export/home/open                                           404M  34.6G   404M  /export/home/open
rpool/swap                                                      8.50G  43.0G   132M  -

有 34 GB 可用,但我不知道在哪里?不知所措,不幸的是,我对 zfs 的了解还不够,无法正确排除故障。重启后仍然存在,我最近没有删除任何大文件或任何东西,所以不要认为这是一个保留任何东西的过程……任何指导都将不胜感激。

添加:

[root@SV02 /]# zfs list -t all
NAME                                         USED  AVAIL  REFER  MOUNTPOINT
rpool                                       23.5G  66.6G  43.5K  /rpool
rpool/ROOT                                  6.58G  66.6G    31K  legacy
rpool/ROOT/opus-2457409-2017-11-07-release  6.58G  66.6G  6.58G  /
rpool/dump                                  8.00G  66.6G  8.00G  -
rpool/export                                 404M  66.6G    32K  /export
rpool/export/home                            404M  66.6G  86.5K  /export/home
rpool/export/home/open                       404M  66.6G   404M  /export/home/open
rpool/swap                                  8.50G  75.0G   132M  -

答案1

看起来有几个“叶节点”数据集(没有子数据集)占据了磁盘使用量的大部分rpool

rpool/ROOT/opus-2457409-2017-11-07-release    38.5G
rpool/dump                                    8.00G
rpool/swap                                    8.50G

总计为 55G,与 报告的 55.5G 非常接近rpoolUSED大概您想保留rpool/dumprpool/swap定义它们现在的样子,这样就只剩下rpool/ROOT/opus-...-11-07-release您可以从中删除内容以释放空间的东西了。

出于某种我不明白的原因,在您的输出中,该数据集的挂载点列为/,但在许多其他数据集中也是如此。您实际上无法将多个文件系统挂载到同一个目录,因此显然那里有些混乱。尝试创建一个新目录,zfs mount将数据集挂载在那里,用 标识要从中删除的内容du,然后删除一些文件。

不幸的是,当您删除那里的东西时,您很快就会意识到它没有释放任何空间,这是因为您也拥有该数据集的一堆快照:

rpool/ROOT/opus-2457409-2017-11-07-release                      38.5G  34.6G  6.57G  /
rpool/ROOT/opus-2457409-2017-11-07-release@install              4.40M      -  1.56G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-02-25-22:01:25  6.64M      -  1.58G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-02-25-22:05:33  84.6M      -  2.02G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-03-19-23:25:59  58.0M      -  2.11G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-17:55:40      0      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-17:55:48      0      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-18:13:10  1.44M      -  2.10G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2014-04-12-18:14:31  2.17M      -  2.12G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-21:55:47  15.3M      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:34:52  9.18M      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:43:54   362K      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-01-31-22:44:05   362K      -  5.61G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2015-05-19-21:49:36   227M      -  6.32G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:11:30  3.15M      -  31.3G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:30   936K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:42   986K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:53:00   112M      -  31.8G  -

具体来说,请查看最后一个快照,@2016-10-04-16:53:00总共 38.5G 中的 31.8G 将由该快照保留。看起来大部分使用量至少可以追溯到@2016-10-04-16:11:30,因此您还需要删除(至少)这些快照以恢复大部分数据:

rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:11:30  3.15M      -  31.3G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:30   936K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:34:42   986K      -  31.5G  -
rpool/ROOT/opus-2457409-2017-11-07-release@2016-10-04-16:53:00   112M      -  31.8G  -

如果您不需要更旧的快照,您也可以删除它们。一般建议,最好只在需要时保留快照,而不是无限期地保留,因为您最终会意外地在其中一个快照中捕获一些重要信息,并陷入这种情况。

相关内容