dasdfmt - Format a DASD
Use the dasdfmt command to low-level format ECKD-type direct access storage devices (DASD).
dasdfmt uses an ioctl call to the DASD driver to format tracks. A block size (hard sector size) can be specified. The formatting process can take quite a long time (hours for large DASD).
- For DASDs that have previously been formatted with dasdfmt, use the dasdfmt quick format mode.
- Use the -p option to monitor the progress.
dasdfmt syntax
- 1 You are prompted for the block size if you omit it for an option that requires this specification.
- 2 If neither the -l option nor the -k option are specified, a VOLSER is generated from the device number through which the volume is accessed.
- -r <cylinders> or --requestsize=<cylinders>
- specifies the number of cylinders to be processed in one formatting step. The value must be an integer in the range 1 - 255. The default is 10 cylinders. Use this parameter to use any available PAV devices. Ideally, the number of cylinders matches the number of associated devices, counting the base device and all alias devices.
- -b <block_size> or --blocksize=<block_size>
- specifies one of the following block sizes in bytes: 512, 1024, 2048, or 4096.
For the quick and expand modes and for the --check option, you can omit the block size. Otherwise, you are prompted if you do not specify a value for the block size. You can then press Enter to accept 4096 or specify a different value.
Tip: Set <block_size> as large as possible (ideally 4096); the net capacity of an ECKD DASD decreases for smaller block sizes. For example, a DASD formatted with a block size of 512 byte has only half of the net capacity of the same DASD formatted with a block size of 4096 byte. - <node>
- specifies the device node of the device to be formatted, for example, /dev/dasdzzz.
- -d <disklayout> or --disk_layout=<disklayout>
- formats the device with the compatible disk layout (cdl) or the Linux® disk layout (ldl). If the parameter is not specified, the default (cdl) is used.
- -L or --no_label
- valid for
-d ldl
only, where it suppresses the default LNX1 label. - -l <volser> or --label=<volser>
- specifies the volume serial number to be written to the disk. If the VOLSER contains special characters, it must be enclosed in single quotation marks. In addition, any '$' character in the VOLSER must be preceded by a backslash ('\').
- -k or --keep_volser
- keeps the volume serial number when writing the volume label . Keeping the volume serial number is useful, for example, if the volume serial number was written with a z/VM® tool and should not be overwritten.
- -M <mode> or --mode=<mode>
- specifies the mode to be used for formatting the device. Valid modes are:
- full
- Format the entire disk with the specified block size. This is the default mode.
- quick
- formats the first two tracks and writes label and partition information. Only use this option if you are sure that the target DASD already contains a regular format with the specified block size.
- expand
- format all unformatted tracks at the end of the target DASD. This mode assumes that tracks at the beginning of the DASD volume have already been correctly formatted, while a consecutive set of tracks at the end are unformatted. You can use this mode to make added space available for Linux use after dynamically increasing the size of a DASD volume.
- -p or --progressbar
- displays a progress bar. Do not use this option if you are using a line-mode terminal console driver. For example, if you are using a 3215 terminal device driver or a line-mode hardware console device driver.
- -P or --percentage
- displays one line for each formatted cylinder. The line shows the number of the cylinder and percentage of formatting process. Intended for use by higher level interfaces.
- -m <hashstep> or --hashmarks=<hashstep>
- displays a number sign (#) after every <hashstep> cylinders
are formatted. <hashstep> must be in the range
1 - 1000. The default is 10.
The -m option is useful where the console device driver is not suitable for the progress bar (-p option).
- --check
- performs a complete format check on a DASD volume.
Omit the block size specification (-b option) to check for a consistent format for any valid block size. Specify a block size to confirm that the DASD has been formatted consistently with that particular block size.
- -y
- starts formatting immediately without prompting for confirmation.
- -F or --force
- formats the device without checking whether it is mounted.
- -v
- displays extra information messages (verbose).
- -t or --test
- runs the command in test mode. Analyzes parameters and prints what would happen, but does not modify the disk.
- -C or --check_host_count
- checks the host-access open count to ensure that the device is not online to another operating system instance. Use this option to ensure that the operation is safe, and cancel it if other operating system instances are accessing the volume.
- -- norecordzero
- prevents a format write of record zero. This option is intended for experts: Subsystems in DASD drivers are by default granted permission to modify or add a standard record zero to each track when needed. Before you revoke the permission with this option, you must ensure that the device contains standard record zeros on all tracks.
- -V or --version
- displays the version number of dasdfmt and exits.
- -h or --help
- displays an overview of the syntax. Any other parameters are ignored. To view the man page, enter man dasdfmt.
Examples
- To format a 100 cylinder z/VM minidisk with the standard
Linux disk layout and a 4 KB blocksize with device node
/dev/dasdc:
# dasdfmt -b 4096 -d ldl -p /dev/dasdc Drive Geometry: 100 Cylinders * 15 Heads = 1500 Tracks I am going to format the device /dev/dasdc in the following way: Device number of device : 0x192 Labelling device : yes Disk label : LNX1 Disk identifier : 0X0192 Extent start (trk no) : 0 Extent end (trk no) : 1499 Compatible Disk Layout : no Blocksize : 4096 Mode : Full --->> ATTENTION! <<--- All data of that device will be lost. Type yes to continue, no will leave the disk untouched: yes Formatting the device. This may take a while (get yourself a coffee). cyl 100 of 100 |#################################|100% [1s] Finished formatting the device. Rereading the partition table... ok #
- To format the same disk with the compatible disk layout (accepting the default value of the
-d option).
# dasdfmt -b 4096 -p /dev/dasdc Drive Geometry: 100 Cylinders * 15 Heads = 1500 Tracks I am going to format the device /dev/dasdc in the following way: Device number of device : 0x192 Labelling device : yes Disk label : VOL1 Disk identifier : 0X0192 Extent start (trk no) : 0 Extent end (trk no) : 1499 Compatible Disk Layout : yes Blocksize : 4096 Mode : Full --->> ATTENTION! <<--- All data of that device will be lost. Type yes to continue, no will leave the disk untouched: yes Formatting the device. This may take a while (get yourself a coffee). cyl 100 of 100 |#################################|100% [1s] Finished formatting the device. Rereading the partition table... ok #
- To format with the -P option:
# dasdfmt -P /dev/dasde cyl 1 of 500 | 0% cyl 2 of 500 | 0% cyl 3 of 500 | 0% cyl 4 of 500 | 0% cyl 5 of 500 | 1% ... cyl 496 of 500 | 99% cyl 497 of 500 | 99% cyl 498 of 500 | 99% cyl 499 of 500 | 99% cyl 500 of 500 | 100%
- To make best use of PAV when formatting a DASD that
has one base device and four alias devices, specify five cylinders:
# dasdfmt /dev/dasdd -y -b 4096 -d cdl -r 5 Finished formatting the device. Rereading the partition table... ok
- To format a previously formatted DASD in quick format mode.
# dasdfmt -b 4096 -p --mode=quick /dev/dasdf
- To format tracks that have been added at the end of an already formatted
DASD.
# dasdfmt -b 4096 -p --mode=expand /dev/dasdg
- To check whether a DASD has been correctly formatted with a block size of
4096
bytes.
# dasdfmt -b 4096 -p --check /dev/dasdg Checking format of the entire disk... cyl 1113 of 1113 |#################################|100% [19s] Done. Disk is fine.
- To ensure that the DASD is not online to an operating system instance in
a different LPAR when you start formatting the
DASD:
# dasdfmt -b 4096 -p -C /dev/dasdh
dasdfmt always checks the host-access open count. If the count indicates access by another operating system instance, the response depends on the -C option. With this option, the command is canceled. Otherwise, a warning is displayed before you are prompted to confirm that you want to proceed.