如何将现有 Solaris11 安装移动到新磁盘

如何将现有 Solaris11 安装移动到新磁盘

我想将现有的 Solaris 11 (x86) 安装从 HDD 移动到新的 SSD。由于 SSD 比 HDD 小,因此无法使用 dd 进行简单复制。

答案1

我设法找到了解决我的问题的方法:

  • 从 DVD/ISO 启动
  • 启动控制台

创建磁盘标签和分区布局 

root@solaris:~# format c2t1d0

selecting c2t1d0 <VMware,-VMware Virtual S-1.0-16.00GB>
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show disk ID
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> part

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> print
Current partition table (original):
Total disk sectors available: 33537981 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector        Size        Last Sector
  0  BIOS_boot    wm                40     260.00MB         532519
  1        usr    wm            532520      15.74GB         33538013
  2 unassigned    wm                 0          0              0
  3 unassigned    wm                 0          0              0
  4 unassigned    wm                 0          0              0
  5 unassigned    wm                 0          0              0
  6 unassigned    wm                 0          0              0
  8   reserved    wm          33538015       8.00MB         33554398

partition> quit


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show disk ID
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> quit

在新磁盘的分片 1 上创建新的 zpool

root@solaris:~# zpool create rpool1 c2t1d0s1

创建原始 zpool 的递归快照

root@solaris:~# zfs snapshot -r rpool@now

通过 zfs send|receive 将快照复制到新的 zpool

root@solaris:~# zfs send -R rpool@now | zfs recv -Fdu rpool1

导出两个 zpool

root@solaris:~# zpool export rpool
root@solaris:~# zpool export rpool1

在原始 zpool 的名称下导入新的 zpool

root@solaris:~# zpool import -f rpool1 rpool

激活启动环境

root@solaris:~# beadm activate be://rpool/solaris

在新磁盘上安装引导加载程序

root@solaris:~# bootadm install-bootloader -P rpool

激活启动环境(没有第二次激活就会发生错误)

root@solaris:~# beadm activate be://rpool/solaris

列出快照

root@solaris:~# zfs list -t snapshots

删除快照

root@solaris:~ # zfs destroy -R rpool@now

重启

root@solaris:# reboot

从系统中删除旧磁盘

相关内容