Solaris 10 преобразование UFS root раздела в ZFS

Для диска который будет использоваться как ZFS root пул есть ряд требований. Для x86 систем
необходимо создать раздел с помощью утилиты fdisk. На диске также необходимо указать метку SMI с
помощью утилиты format (EFI метка не подходит).
На подготовленном устройстве создадим ZFS пул с необходимым для root раздела объемом.
# zpool create -f zfs-root-pool c1d1s0

Проверим создано ли окружение для загрузки
# lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names

Создадим окружение используя zfs-root-pool
# lucreate -c ufs-env -n zfs-env -p zfs-root-pool
.....
Population of boot environment <zfs-env> successful.
Creation of boot environment <zfs-env> successful.

-с текущее окружение
-n новое окружение
-p пул, используемый для создания окружения  

По окончанию процесса создания, активируем новое zfs-env окружение
# luactivate zfs-env
.....
Propagating findroot GRUB for menu conversion.
File </etc/lu/installgrub.findroot> propagation successful
File </etc/lu/stage1.findroot> propagation successful
File </etc/lu/stage2.findroot> propagation successful
File </etc/lu/GRUB_capability> propagation successful
Deleting stale GRUB loader from all BEs.
File </etc/lu/installgrub.latest> deletion successful
File </etc/lu/stage1.latest> deletion successful
File </etc/lu/stage2.latest> deletion successful
Activation of boot environment <zfs-env> successful.

Проверяем статус
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
ufs-env                    yes      yes    no        no     -
zfs-env                    yes      no     yes       no     -

Перезапускаемся
# init 6

После перезапуска ZFS пул станет активным, а UFS раздел можно будет удалить
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
ufs-env                    yes      no     no        yes    -
zfs-env                    yes      yes    yes       no     -

Solaris OpenIndiana увеличение файловой системы UFS (x86/SPARC) с помощью format, growfs

После увеличения физического размера диска, необходимо изменить и размер файловой системы UFS.
Проверим изменения размера диска с помощью iostat
# iostat -E c0d1
с0d1 - увеличенный диск.

Для X86 систем:
Запускаем утилиту format (ресурс должен быть размонтирован)
# format

Выбираем диск и запускаем утилиту fdisk
Specify disk (enter its number): 1
selecting c0d1
Controller working list found
[disk formatted, defect list found]

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
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> fdisk

Нам необходимо пересоздать Solaris2 раздел если он был ранее создан, с помощью
опций: 3. Delete a partition, 1. Create a partition

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection:

При создании указываем 100% используемого места

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? 1

Specify the percentage of disk to use for this partition
(or type "c" to specify the size in cylinders). 100

                                                        Cylinders
Partition   Status    Type        Start   End   Length   %
=========   ======    ========  ====   ===   ======   ===
    1                 Solaris2          1          1498   1498     100

Сохраняем конфигурацию и выходим
5. Exit (update disk configuration and exit)

Создаем разметку для slice 0
format> p

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
        7      - change `7' 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> p
Current partition table (original):
Total disk cylinders available: 1496 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup     wu        0 - 1495     2.92GB (1496/0/0) 6127616
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       0               0         (0/0/0)          0
  5 unassigned    wm       0               0         (0/0/0)          0
  6 unassigned    wm       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
  8       boot       wu       0 -    0        2.00MB    (1/0/0)       4096
  9 alternates      wm      1 -    2        4.00MB    (2/0/0)       8192

partition> 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]: root
Enter partition permission flags[wm]: wm
Enter new starting cyl[3]: 3
Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: $
partition> p
Current partition table (unnamed):
Total disk cylinders available: 1496 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root       wm       3 - 1495     2.92GB    (1493/0/0) 6115328
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup     wu       0 - 1495      2.92GB    (1496/0/0) 6127616
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       0               0         (0/0/0)          0
  5 unassigned    wm       0               0         (0/0/0)          0
  6 unassigned    wm       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
  8       boot      wu       0 -    0        2.00MB    (1/0/0)       4096
  9 alternates     wm       1 -    2        4.00MB    (2/0/0)       8192

Если все верно, ставим метку
partition> label
Ready to label disk, continue? y

Проверяем что файловая система в целости
# fstyp /dev/rdsk/c0d1s0
ufs

Увеличиваем файловую систему командой growfs
# growfs -v /dev/rdsk/c0d1s0
/usr/lib/fs/ufs/mkfs -G /dev/rdsk/c0d1s0 6115328
/dev/rdsk/c0d1s0:       6115328 sectors in 1493 cylinders of 128 tracks, 32 sectors
        2986.0MB in 65 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
 5183232, 5277472, 5371712, 5465952, 5560192, 5654432, 5748672, 5842912,
 5937152, 6031392

Монтируем ресурс
# mount /dev/dsk/c0d1s0 /test/

Для SPARC систем:
Запускаем format, выбираем диск
Specify disk (enter its number): 2
selecting c1t600A0B80004600800000087B2DF9663Dd0
[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
        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
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit

Выбираем тип диска
format> type

AVAILABLE DRIVE TYPES:
        0. Auto configure
        1. Quantum ProDrive 80S
        2. Quantum ProDrive 105S
        3. CDC Wren IV 94171-344
        4. SUN0104
        5. SUN0207
        6. SUN0327
        7. SUN0340
        8. SUN0424
        9. SUN0535
        10. SUN0669
        11. SUN1.0G
        12. SUN1.05
        13. SUN1.3G
        14. SUN2.1G
        15. SUN2.9G
        16. Zip 100
        17. Zip 250
        18. Peerless 10GB
        19. IBM-1815  FAStT-0914
        20. SUN146G
        21. IBM-1815  FAStT-0914
        22. IBM-1815  FAStT-0914
        23. IBM-1815  FAStT-0914
        24. IBM-1815  FAStT-0914
        25. IBM-1815  FAStT-0914
        26. IBM-1815  FAStT-0914
        27. other
Specify disk type (enter its number)[26]: 0
c1t600A0B80002331800000087B4DF6610Dd0: configured with capacity of 480.96GB
...
[disk formatted]

Далее аналогичным способом что и для x86 создаем разметку и метку для slice, используем утилиту growfs для увеличения диска.

Дополнительная информация