我在两个磁盘上有一个ZFS池(镜像RAID),我从FreeBSD 11.0服务器转移到Ubuntu 16.04.2 LTS服务器.
导入池后,我看到:
- NAME USED AVAIL REFER MOUNTPOINT
- zroot 993G 790G 104K /mnt/zfs
- zroot/ROOT 989G 790G 96K none
- zroot/ROOT/default 989G 790G 989G none
- zroot/tmp 140K 790G 140K none
- zroot/usr 3.37G 790G 96K none
- zroot/usr/home 2.15G 790G 2.15G none
- zroot/usr/ports 640M 790G 640M none
- zroot/usr/src 608M 790G 608M none
- zroot/var 1.66M 790G 96K none
- zroot/var/audit 96K 790G 96K none
- zroot/var/crash 96K 790G 96K none
- zroot/var/log 476K 790G 476K none
- zroot/var/mail 840K 790G 840K none
- zroot/var/tmp 96K 790G 96K none
我希望看到的是Ubuntu系统上/ mnt / zfs下的一个完全填充的目录树,其中包含993GiB的文件.我所看到的是一个部分填充的目录树,其中没有文件:
- $tree /mnt/zfs
- /mnt/zfs
- ├── tmp
- ├── usr
- │ ├── home
- │ ├── ports
- │ └── src
- └── var
- ├── audit
- ├── crash
- ├── log
- └── tmp
我很确定我在这里缺少一些基本的东西.
尝试#1:根据@ Zoredache的建议设置ROOT的挂载点,只会产生一个空的ROOT目录:
- $sudo zfs set mountpoint=/mnt/zfs/ROOT zroot/ROOT
- $tree /mnt/zfs
- /mnt/zfs
- └── ROOT
尝试#2:根据@ user121391的建议设置ROOT / default的挂载点,也会产生一个空目录:
- $sudo zfs set mountpoint=/mnt/zfs/ROOT zroot/ROOT/default
- $tree /mnt/zfs
- /mnt/zfs
- 0 directories,0 files
尝试#3:根据@ user131391的其他建议,挂载单个目录似乎有效:
- $sudo zfs set mountpoint=/mnt/zfs/usr/home zroot/usr/home
- $tree /mnt/zfs
- /mnt/zfs
- └── usr
- └── home
- └── duncan
- ├── tmp
- │ ├── code
- ...
- └── usb
- 17978 directories,67539 files
这很棒,但遗憾的是没有任何帮助.我之后的文件在/usr/local /下,它们没有出现在zfs list的结果中.但是,如果你看一下尺寸,这个空间显然会被使用:
- zroot/ROOT/default 989G 790G 989G none
- zroot/usr 3.37G 790G 96K none
尝试#4:
有关MichaelKjörling的更多信息:
- $sudo zfs set mountpoint=/mnt/zfs/ROOT zroot/ROOT/default
- $sudo zfs get mountpoint,mounted zroot -t filesystem -r
- NAME PROPERTY VALUE SOURCE
- zroot mountpoint none local
- zroot mounted no -
- zroot/ROOT mountpoint none local
- zroot/ROOT mounted no -
- zroot/ROOT/default mountpoint /mnt/zfs/ROOT local
- zroot/ROOT/default mounted no -
- zroot/tmp mountpoint none local
- zroot/tmp mounted no -
- zroot/usr mountpoint none local
- zroot/usr mounted no -
- zroot/usr/home mountpoint none local
- zroot/usr/home mounted no -
- zroot/usr/ports mountpoint none local
- zroot/usr/ports mounted no -
- zroot/usr/src mountpoint none local
- zroot/usr/src mounted no -
- zroot/var mountpoint none local
- zroot/var mounted no -
- zroot/var/audit mountpoint none local
- zroot/var/audit mounted no -
- zroot/var/crash mountpoint none local
- zroot/var/crash mounted no -
- zroot/var/log mountpoint none local
- zroot/var/log mounted no -
- zroot/var/mail mountpoint none local
- zroot/var/mail mounted no -
- zroot/var/tmp mountpoint none local
- zroot/var/tmp mounted no -
- $tree /mnt/zfs
- /mnt/zfs
- 0 directories,0 files
解决方法
zroot和zroot / ROOT不包含任何文件,它们只是其他数据的容器.
您的大部分数据都是zroot / ROOT / default.
其他zfs文件系统应该从zroot继承它们的mountpoint(不知道在从FreeBSD到Ubuntu的过渡中这些信息是如何丢失的):
- zfs inherit mountpoint zroot/tmp
- zfs inherit mountpoint zroot/usr
- zfs inherit mountpoint zroot/usr/home
- zfs inherit mountpoint zroot/usr/ports
…等等(可能会对此进行-r但我没有检查过).
应该具有无挂载点的唯一zfs文件系统是zroot / ROOT:
- zfs set mountpoint=none zroot/ROOT
完成所有这些操作后,您需要导出并重新导入池,并按正确顺序挂载文件系统:
- zpool export zroot
将池导入新的挂载点但不实际挂载任何内容:
- zpool import -a -N -r /mnt/zfs
挂载根池:
- zfs mount zroot/ROOT/default
安装其他一切:
- zfs mount -a