Данная команда может использоваться в очень многих случаях, и является по сути швейцарским ножом в Solaris. Ниже будут описаны несколько примеров.
1) Восстановление метки zfs.
Если вы увидели сообщение
primary label corrupt; using backup
то восстановить метку очень просто:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@0,0/pci1022,7458@1/pci11ab,11ab@1/disk@0,0
[...]
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Reading the primary EFI GPT label failed. Using backup label.
Use the 'backup' command to restore the primary label.
format> backup
Restoring primary label.
format> label
Ready to label disk, continue? y
format> quit
2) Проверка дисков
В команде format есть меню analyze, через которое можно проверять диски на сбойные сектора.
format> analyze ANALYZE MENU: read - read only test (doesn't harm SunOS) refresh - read then write (doesn't harm data) test - pattern testing (doesn't harm data) write - write then read (corrupts data) compare - write, read, compare (corrupts data) purge - write, read, write (corrupts data) verify - write entire disk, then verify (corrupts data) print - display data buffer setup - set analysis parameters config - show analysis parameters quit analyze>
Описание параметров ниже. Оставляю без перевода, что бы не терялся смысл.
Sub-Command | Description |
---|---|
read | Reads each sector on the current disk. Repairs defective blocks as a default. |
refresh | Reads then writes data on the current disk without harming the data. Repairs defective blocks as a default. |
test | Writes a set of patterns to the disk without harming the data. Repairs defective blocks as a default. |
write | Writes a set of patterns to the disk then reads the data on the disk back. Destroys existing data on the disk. Repairs defective blocks as a default. |
compare | Writes a set of patterns to the disk, reads the data back, and then compares it to the data in the write buffer. Destroys existing data on the disk. Repairs defective blocks as a default. |
purge | Removes all data from the disk so that the data can’t be retrieved by any means. Data is removed by writing three distinct patterns over the entire disk (or a section of the disk). If the verification passes, a hex-bit pattern is written over the entire disk (or a section of the disk).Repairs defective blocks as a default. |
verify | Writes unique data to each block on the entire disk in the first pass. Reads and verifies the data in the next pass. Destroys existing data on the disk. Repairs defective blocks as a default. |
Displays the data in the read/write buffer. | |
setup | Lets you specify the following analysis parameters:
Analyze entire disk? yes Starting block number: depends on drive Ending block number: depends on drive Loop continuously? no Number of passes: 2 Repair defective blocks? yes Stop after first error? no Use random bit patterns? no Number of blocks per transfer: 126 (0/n/nn) Verify media after formatting? yes Enable extended messages? no Restore defect list? yes Restore disk label? yes Defaults are shown in bold. |
config | Displays the current analysis parameters. |
quit | Exits the analyze menu. |