format: blkid content check, format argument, and verbose argument

- Added new argument -force to the format utility. This will force formatting of the specified single device if it exists and is a block device
- By default, the format package will no longer format the specified single device if content exists on that device
- Added new blkid-based check for content, in addition to the existing check for partitions on autoformat candidate devices.
- Cleanup of old unused code.
- Refactoring of block device verification.
- Added test/cases/040_packages/006_format_mount/005_by_device_force
- Added document of new arguments to /docs/external-disk.md. Also sorted the arguments in the doc alphabetically and added them as bullets so they do not run together on the page.

Signed-off-by: Isaac Rodman <isaac@eyz.us>
This commit is contained in:
Isaac Rodman
2017-09-22 13:44:49 -07:00
committed by Isaac Rodman
parent 367c7e2c88
commit 3de78f2109
6 changed files with 287 additions and 50 deletions

View File

@@ -45,9 +45,18 @@ onboot:
command: ["/usr/bin/format", "-type", "ext4", "-label", "DATA", "/dev/vda"]
```
`-type` can be used to specify the type. This is `ext4` by default but `btrfs` and `xfs` are also supported
`-label` can be used to give the disk a label
The final (optional) argument specifies the device name
```
onboot:
- name: format
image: linuxkit/format:<hash>
command: ["/usr/bin/format", "-force", "-type", "xfs", "-label", "DATA", "-verbose", "/dev/vda"]
```
- `-force` can be used to force the partition to be cleared and recreated (if applicable), and the recreated partition formatted. This option would be used to re-init the partition on every boot, rather than persisting the partition between boots.
- `-label` can be used to give the disk a label
- `-type` can be used to specify the type. This is `ext4` by default but `btrfs` and `xfs` are also supported
- `-verbose` enables verbose logging, which can be used to troubleshoot device auto-detection and (re-)partitioning
- The final (optional) argument specifies the device name
## Mount the disk