从 CD 引导时如何挂载 zfs rpool

为了能够解决启动问题,有时我们必须使用 CDROM 以单用户模式启动系统。
这是访问根文件系统并找出导致引导问题的问题所必需的。
这篇文章描述了如何使用 CDROM 启动并挂载 zfs 根文件系统 (rpool)。

  1. 在单用户模式下从 CDROM 引导系统。
ok boot cdrom -s      
Boot device: /pci@8,700000/scsi@1/disk@6,0:f File and args: -s
SunOS[TM] Release 5.10 Version Generic_137137-09 64-bit
Copyright 1983-2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
  1. 在 /mnt 挂载点上导入 ZFS 根池以允许修改或者检查引导环境 (BE) 中的文件:
# zpool import -R /mnt rpool
cannot mount '/mnt/export': failed to create mountpoint
cannot mount '/mnt/export/home': failed to create mountpoint
cannot mount '/mnt/rpool': failed to create mountpoint
  1. 列出 zfs 文件系统:
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 16.7G 16.5G 94K /mnt/rpool
rpool/ROOT 8.30G 16.5G 18K legacy
rpool/ROOT/sol10-u6 21.1M 16.5G 8.20G /mnt
rpool/ROOT/sol10-u6-patch 8.28G 16.5G 8.20G /mnt
rpool/ROOT/sol10-u6-patch@sol10-u6-patch 85.2M - 8.20G 
rpool/dump 2.00G 16.5G 2.00G 
rpool/export 411M 16.5G 411M /mnt/export
rpool/export/home 19K 16.5G 19K /mnt/export/home
rpool/swap 6G 22.5G 16K
  1. 挂载包含操作系统的数据集:
# zfs mount rpool/ROOT/sol10-u6
# df -k
Filesystem kbytes used avail capacity Mounted on
/ramdisk-root:a 171135 168424 0 100% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 3753208 344 3752864 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
sharefs 0 0 0 0% /etc/dfs/sharetab
swap 3753464 600 3752864 1% /tmp
/tmp/dev 3753464 600 3752864 1% /dev
fd 0 0 0 0% /dev/fd
swap 3752864 0 3752864 0% /tmp/root/var/run
rpool/ROOT/sol10-u6 34836480 8597005 17316644 34% /mnt
  1. 通过挂载点访问引导环境:
# cd /mnt
# ls
a devices kernel platform ssd_state2.out
b dtrace.d kk policia storage
bin dtrace.out lib proc system
boot etc mbox rmdisk tmp
cdrom export mnt rpool truss.out
core file mnt2 sbin usr
data file+ net ssd_out var
dev home opt ssd_state.out vol
  1. 完成后,导出根池并重启:
# cd /
# zpool export rpool
# zpool list
no pools available
# reboot
日期:2020-09-17 00:15:22 来源:oir作者:oir