Solaris

如何將現有的 Solaris11 安裝移動到新磁碟

  • January 9, 2021

我想將現有的 Solaris 11 (x86) 安裝從 hdd 移動到新的 ssd。因為 ssd 比 hdd 小,所以無法使用 dd 進行簡單複制。

我設法找到了解決我的問題的方法:

  • 從 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

在新磁碟的 slice 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

從系統中刪除舊磁碟

引用自:https://unix.stackexchange.com/questions/628303