summaryrefslogtreecommitdiffstats
path: root/tests/expected/fdisk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /tests/expected/fdisk
parentInitial commit. (diff)
downloadutil-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz
util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/expected/fdisk')
-rw-r--r--tests/expected/fdisk/align-512-4K80
-rw-r--r--tests/expected/fdisk/align-512-4K-6381
-rw-r--r--tests/expected/fdisk/align-512-4K-md80
-rw-r--r--tests/expected/fdisk/align-512-51268
-rw-r--r--tests/expected/fdisk/align-512-512-topology80
-rw-r--r--tests/expected/fdisk/bsd_0_64.BE213
-rw-r--r--tests/expected/fdisk/bsd_0_64.LE213
-rw-r--r--tests/expected/fdisk/bsd_0_64_alpha.LE217
-rw-r--r--tests/expected/fdisk/bsd_1_0.BE213
-rw-r--r--tests/expected/fdisk/bsd_1_0.LE213
-rw-r--r--tests/expected/fdisk/gpt0
-rw-r--r--tests/expected/fdisk/gpt-change-type-by-number20
-rw-r--r--tests/expected/fdisk/gpt-change-type-by-uuid20
-rw-r--r--tests/expected/fdisk/gpt-corrupt-backup-table20
-rw-r--r--tests/expected/fdisk/gpt-corrupt-primary-table20
-rw-r--r--tests/expected/fdisk/gpt-create-again-partition20
-rw-r--r--tests/expected/fdisk/gpt-create-partitions0
-rw-r--r--tests/expected/fdisk/gpt-delete-partition19
-rw-r--r--tests/expected/fdisk/gpt-empty-pt12
-rw-r--r--tests/expected/fdisk/gpt-resize43
-rw-r--r--tests/expected/fdisk/gpt-resize.err4
-rw-r--r--tests/expected/fdisk/id1
-rw-r--r--tests/expected/fdisk/id-create-mbr-with-id-0x11
-rw-r--r--tests/expected/fdisk/id-create-mbr-with-id-0x1.sparc0
-rw-r--r--tests/expected/fdisk/id-create-mbr-with-id-0x21
-rw-r--r--tests/expected/fdisk/id-create-mbr-with-id-0x2.sparc0
-rw-r--r--tests/expected/fdisk/id.sparc1
-rw-r--r--tests/expected/fdisk/mbr-dos-mode0
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-create-another-log-par20
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-create-extended-par16
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-create-logical-par20
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-create-primary-partition15
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-delete-extended-par12
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-delete-logical-par17
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-delete-primary-par19
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-empty-pt13
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-re-create-primary-par15
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-set-partition-type15
-rw-r--r--tests/expected/fdisk/mbr-dos-mode-set-primary-par-active15
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete19
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-1st-active15
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-1st-primary15
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete20
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate15
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-2nd-primary16
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-empty-pt14
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-extended17
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-extended-delete12
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end47
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-logical21
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-logical-delete18
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode-logical-recreate21
-rw-r--r--tests/expected/fdisk/mbr-sort0
-rw-r--r--tests/expected/fdisk/mbr-sort-create-logical-partitions22
-rw-r--r--tests/expected/fdisk/mbr-sort-create-primary-partitions18
-rw-r--r--tests/expected/fdisk/mbr-sort-empty-pt10
-rw-r--r--tests/expected/fdisk/mbr-sort-fix-order20
-rw-r--r--tests/expected/fdisk/oddinput7
-rw-r--r--tests/expected/fdisk/oddinput.err4
-rw-r--r--tests/expected/fdisk/oddinput.toosmall1
-rw-r--r--tests/expected/fdisk/sunlabel0
-rw-r--r--tests/expected/fdisk/sunlabel-create-first-partition16
-rw-r--r--tests/expected/fdisk/sunlabel-create-second-partition29
-rw-r--r--tests/expected/fdisk/sunlabel-delete-all-partitions1
-rw-r--r--tests/expected/fdisk/sunlabel-empty-sun-pt14
-rw-r--r--tests/expected/fdisk/sunlabel-set-first-par-mountable16
-rw-r--r--tests/expected/fdisk/sunlabel-set-first-par-readonly16
-rw-r--r--tests/expected/fdisk/sunlabel-set-partition-sysid16
68 files changed, 2257 insertions, 0 deletions
diff --git a/tests/expected/fdisk/align-512-4K b/tests/expected/fdisk/align-512-4K
new file mode 100644
index 0000000..ec06613
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K
@@ -0,0 +1,80 @@
+Create partitions
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+
+Command (m for help): Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (22528-102399, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (2 primary, 0 extended, 2 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (3,4, default 3): First sector (43008-102399, default 43008): Last sector, +/-sectors or +/-size{K,M,G,T,P} (43008-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (3 primary, 0 extended, 1 free)
+ e extended (container for logical partitions)
+Select (default e):
+Selected partition 4
+First sector (63488-102399, default 63488): Last sector, +/-sectors or +/-size{K,M,G,T,P} (63488-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 5
+First sector (65536-102399, default 65536): Last sector, +/-sectors or +/-size{K,M,G,T,P} (65536-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 6
+First sector (77824-102399, default 77824): Last sector, +/-sectors or +/-size{K,M,G,T,P} (77824-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 7
+First sector (90112-102399, default 90112): Last sector, +/-sectors or +/-size{K,M,G,T,P} (90112-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Disk model: scsi_debug
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 22527 20480 10M 83 Linux
+<removed>2 22528 43007 20480 10M 83 Linux
+<removed>3 43008 63487 20480 10M 83 Linux
+<removed>4 63488 102399 38912 19M 5 Extended
+<removed>5 65536 75775 10240 5M 83 Linux
+<removed>6 77824 88063 10240 5M 83 Linux
+<removed>7 90112 102399 12288 6M 83 Linux
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+Alignment offsets:
+0
+0
+0
+0
+0
+0
+0
diff --git a/tests/expected/fdisk/align-512-4K-63 b/tests/expected/fdisk/align-512-4K-63
new file mode 100644
index 0000000..f7a0c9f
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K-63
@@ -0,0 +1,81 @@
+Create partitions
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+
+Command (m for help): Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (7-102399, default 7): Last sector, +/-sectors or +/-size{K,M,G,T,P} (7-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (20487-102399, default 20487): Last sector, +/-sectors or +/-size{K,M,G,T,P} (20487-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (2 primary, 0 extended, 2 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (3,4, default 3): First sector (40967-102399, default 40967): Last sector, +/-sectors or +/-size{K,M,G,T,P} (40967-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (3 primary, 0 extended, 1 free)
+ e extended (container for logical partitions)
+Select (default e):
+Selected partition 4
+First sector (61447-102399, default 61447): Last sector, +/-sectors or +/-size{K,M,G,T,P} (61447-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 5
+First sector (61454-102399, default 63487): Last sector, +/-sectors or +/-size{K,M,G,T,P} (63487-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 6
+First sector (61454-102399, default 75775): Last sector, +/-sectors or +/-size{K,M,G,T,P} (75775-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 7
+First sector (61454-102399, default 88063): Last sector, +/-sectors or +/-size{K,M,G,T,P} (88063-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Disk model: scsi_debug
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
+Alignment offset: 3584 bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 7 20486 20480 10M 83 Linux
+<removed>2 20487 40966 20480 10M 83 Linux
+<removed>3 40967 61446 20480 10M 83 Linux
+<removed>4 61447 102399 40953 20M 5 Extended
+<removed>5 63487 73726 10240 5M 83 Linux
+<removed>6 75775 86014 10240 5M 83 Linux
+<removed>7 88063 102399 14337 7M 83 Linux
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+Alignment offsets:
+0
+0
+0
+0
+0
+0
+0
diff --git a/tests/expected/fdisk/align-512-4K-md b/tests/expected/fdisk/align-512-4K-md
new file mode 100644
index 0000000..d8ca0d7
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K-md
@@ -0,0 +1,80 @@
+Create partitions
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+
+Command (m for help): Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (51199-102399, default 51200): Last sector, +/-sectors or +/-size{K,M,G,T,P} (51200-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Disk model: scsi_debug
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 51198 49151 24M 83 Linux
+<removed>2 51200 100350 49151 24M 83 Linux
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+Alignment offsets:
+0
+0
+Create partitions (MD)
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (2048-97791, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-97791, default 97791):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (22528-97791, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-97791, default 97791):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 47.75 MiB, 50069504 bytes, 97792 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 4096 bytes
+I/O size (minimum/optimal): 65536 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>p1 2048 22527 20480 10M 83 Linux
+<removed>p2 22528 43007 20480 10M 83 Linux
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+Alignment offsets (MD):
+0
+0
diff --git a/tests/expected/fdisk/align-512-512 b/tests/expected/fdisk/align-512-512
new file mode 100644
index 0000000..782beca
--- /dev/null
+++ b/tests/expected/fdisk/align-512-512
@@ -0,0 +1,68 @@
+Create partitions
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+
+Command (m for help): Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (22528-102399, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (2 primary, 0 extended, 2 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (3,4, default 3): First sector (43008-102399, default 43008): Last sector, +/-sectors or +/-size{K,M,G,T,P} (43008-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (3 primary, 0 extended, 1 free)
+ e extended (container for logical partitions)
+Select (default e):
+Selected partition 4
+First sector (63488-102399, default 63488): Last sector, +/-sectors or +/-size{K,M,G,T,P} (63488-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 5
+First sector (65536-102399, default 65536): Last sector, +/-sectors or +/-size{K,M,G,T,P} (65536-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 6
+First sector (77824-102399, default 77824): Last sector, +/-sectors or +/-size{K,M,G,T,P} (77824-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 7
+First sector (90112-102399, default 90112): Last sector, +/-sectors or +/-size{K,M,G,T,P} (90112-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>p1 2048 22527 20480 10M 83 Linux
+<removed>p2 22528 43007 20480 10M 83 Linux
+<removed>p3 43008 63487 20480 10M 83 Linux
+<removed>p4 63488 102399 38912 19M 5 Extended
+<removed>p5 65536 75775 10240 5M 83 Linux
+<removed>p6 77824 88063 10240 5M 83 Linux
+<removed>p7 90112 102399 12288 6M 83 Linux
+
+Command (m for help):
diff --git a/tests/expected/fdisk/align-512-512-topology b/tests/expected/fdisk/align-512-512-topology
new file mode 100644
index 0000000..2ca9893
--- /dev/null
+++ b/tests/expected/fdisk/align-512-512-topology
@@ -0,0 +1,80 @@
+Create partitions
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+Device does not contain a recognized partition table.
+
+Command (m for help): Created a new disklabel.
+
+Command (m for help): Partition type
+ p primary (0 primary, 0 extended, 4 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (22528-102399, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (2 primary, 0 extended, 2 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (3,4, default 3): First sector (43008-102399, default 43008): Last sector, +/-sectors or +/-size{K,M,G,T,P} (43008-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Partition type
+ p primary (3 primary, 0 extended, 1 free)
+ e extended (container for logical partitions)
+Select (default e):
+Selected partition 4
+First sector (63488-102399, default 63488): Last sector, +/-sectors or +/-size{K,M,G,T,P} (63488-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 5
+First sector (65536-102399, default 65536): Last sector, +/-sectors or +/-size{K,M,G,T,P} (65536-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 6
+First sector (77824-102399, default 77824): Last sector, +/-sectors or +/-size{K,M,G,T,P} (77824-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): All primary partitions are in use.
+Adding logical partition 7
+First sector (90112-102399, default 90112): Last sector, +/-sectors or +/-size{K,M,G,T,P} (90112-102399, default 102399):
+Created a new partition <removed>.
+
+Command (m for help): Disk <removed>: 50 MiB, 52428800 bytes, 102400 sectors
+Disk model: scsi_debug
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 22527 20480 10M 83 Linux
+<removed>2 22528 43007 20480 10M 83 Linux
+<removed>3 43008 63487 20480 10M 83 Linux
+<removed>4 63488 102399 38912 19M 5 Extended
+<removed>5 65536 75775 10240 5M 83 Linux
+<removed>6 77824 88063 10240 5M 83 Linux
+<removed>7 90112 102399 12288 6M 83 Linux
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
+
+Alignment offsets:
+0
+0
+0
+0
+0
+0
+0
diff --git a/tests/expected/fdisk/bsd_0_64.BE b/tests/expected/fdisk/bsd_0_64.BE
new file mode 100644
index 0000000..4f41d03
--- /dev/null
+++ b/tests/expected/fdisk/bsd_0_64.BE
@@ -0,0 +1,213 @@
+BSD_LABELSECTOR=0
+BSD_LABELOFFSET=64
+BSD_EXTRA=
+BYTE_ORDER=BE
+
+Initialize empty image
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Create new DOS partition table
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
+000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
+Create 1st primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 00 |!..A............|
+000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+-------------------
+
+Create 2nd primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Set 2nd partition type
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
+-------------------
+
+Create default BSD
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 82 56 45 57 00 06 00 00 00 00 00 00 00 00 00 00 |.VEW............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 3f |...............?|
+00200070 00 00 00 ff 00 00 00 01 00 00 3e c1 00 00 3e c1 |..........>...>.|
+00200080 00 00 00 00 00 00 00 00 0e 10 00 01 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....|
+002000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 82 56 45 57 62 33 00 04 00 00 20 00 |.....VEWb3.... .|
+002000d0 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 |.. .............|
+002000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 |......@.........|
+00200100 00 00 00 00 00 00 3e c1 00 00 00 00 00 00 00 00 |......>.........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 82 56 45 57 00 06 00 00 00 00 00 00 00 00 00 00 |.VEW............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 3f |...............?|
+00200070 00 00 00 ff 00 00 00 01 00 00 3e c1 00 00 3e c1 |..........>...>.|
+00200080 00 00 00 00 00 00 00 00 0e 10 00 01 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....|
+002000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 82 56 45 57 7d 32 00 04 00 00 20 00 |.....VEW}2.... .|
+002000d0 00 00 20 00 00 00 08 01 00 00 10 00 00 00 00 00 |.. .............|
+002000e0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 |......@.........|
+00200100 00 00 00 00 00 00 3e c1 00 00 00 00 00 00 00 00 |......>.........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+a 4096 6144 2049 1M 4.2BSD 0 0 0
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help):
+00 unused 05 4.1BSD 09 4.4LFS 0d boot
+01 swap 06 Eighth Edition 0a unknown 0e ADOS
+02 Version 6 07 4.2BSD 0b HPFS 0f HFS
+03 Version 7 08 MS-DOS 0c ISO-9660 10 AdvFS
+04 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/bsd_0_64.LE b/tests/expected/fdisk/bsd_0_64.LE
new file mode 100644
index 0000000..9663f16
--- /dev/null
+++ b/tests/expected/fdisk/bsd_0_64.LE
@@ -0,0 +1,213 @@
+BSD_LABELSECTOR=0
+BSD_LABELOFFSET=64
+BSD_EXTRA=
+BYTE_ORDER=LE
+
+Initialize empty image
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Create new DOS partition table
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
+000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
+Create 1st primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 00 |!..A............|
+000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+-------------------
+
+Create 2nd primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Set 2nd partition type
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
+-------------------
+
+Create default BSD
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200070 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200080 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 |........ .......|
+002000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 57 45 56 82 33 62 04 00 00 20 00 00 |....WEV.3b... ..|
+002000d0 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |. ..............|
+002000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+00200100 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200070 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200080 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 |........ .......|
+002000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 57 45 56 82 35 7a 04 00 00 20 00 00 |....WEV.5z... ..|
+002000d0 00 20 00 00 01 08 00 00 00 10 00 00 00 00 00 00 |. ..............|
+002000e0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+00200100 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+a 4096 6144 2049 1M 4.2BSD 0 0 0
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help):
+00 unused 05 4.1BSD 09 4.4LFS 0d boot
+01 swap 06 Eighth Edition 0a unknown 0e ADOS
+02 Version 6 07 4.2BSD 0b HPFS 0f HFS
+03 Version 7 08 MS-DOS 0c ISO-9660 10 AdvFS
+04 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/bsd_0_64_alpha.LE b/tests/expected/fdisk/bsd_0_64_alpha.LE
new file mode 100644
index 0000000..ab39149
--- /dev/null
+++ b/tests/expected/fdisk/bsd_0_64_alpha.LE
@@ -0,0 +1,217 @@
+BSD_LABELSECTOR=0
+BSD_LABELOFFSET=64
+BSD_EXTRA=_alpha
+BYTE_ORDER=LE
+
+Initialize empty image
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Create new DOS partition table
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
+000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
+Create 1st primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 00 |!..A............|
+000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+-------------------
+
+Create 2nd primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
+000001d0 01 3e 83 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Set 2nd partition type
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
+000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+<removed>2 4096 20479 16384 8M a5 FreeBSD
+-------------------
+
+Create default BSD
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
+000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200070 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200080 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 57 45 56 82 13 62 04 00 00 20 00 00 |....WEV..b... ..|
+002000d0 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |. ..............|
+002000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+00200100 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002001f0 00 00 00 00 00 00 00 00 3a 27 5c 82 1f 23 57 82 |........:'\..#W.|
+00200200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
+000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200040 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200060 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200070 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200080 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002000c0 00 00 00 00 57 45 56 82 15 7a 04 00 00 20 00 00 |....WEV..z... ..|
+002000d0 00 20 00 00 01 08 00 00 00 10 00 00 00 00 00 00 |. ..............|
+002000e0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002000f0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+00200100 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+00200110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+002001f0 00 00 00 00 00 00 00 00 43 4f 5c 82 20 2b 57 82 |........CO\. +W.|
+00200200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+a 4096 6144 2049 1M 4.2BSD 0 0 0
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help):
+00 unused 05 4.1BSD 09 4.4LFS 0d boot
+01 swap 06 Eighth Edition 0a unknown 0e ADOS
+02 Version 6 07 4.2BSD 0b HPFS 0f HFS
+03 Version 7 08 ext2 0c ISO-9660 10 AdvFS
+04 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/bsd_1_0.BE b/tests/expected/fdisk/bsd_1_0.BE
new file mode 100644
index 0000000..4c201b0
--- /dev/null
+++ b/tests/expected/fdisk/bsd_1_0.BE
@@ -0,0 +1,213 @@
+BSD_LABELSECTOR=1
+BSD_LABELOFFSET=0
+BSD_EXTRA=
+BYTE_ORDER=BE
+
+Initialize empty image
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Create new DOS partition table
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
+000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
+Create 1st primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 00 |!..A............|
+000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+-------------------
+
+Create 2nd primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Set 2nd partition type
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
+-------------------
+
+Create default BSD
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200200 82 56 45 57 00 06 00 00 00 00 00 00 00 00 00 00 |.VEW............|
+00200210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200220 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 3f |...............?|
+00200230 00 00 00 ff 00 00 00 01 00 00 3e c1 00 00 3e c1 |..........>...>.|
+00200240 00 00 00 00 00 00 00 00 0e 10 00 01 00 00 00 00 |................|
+00200250 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....|
+00200260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200280 00 00 00 00 82 56 45 57 62 33 00 04 00 00 20 00 |.....VEWb3.... .|
+00200290 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 |.. .............|
+002002a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002002b0 00 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 |......@.........|
+002002c0 00 00 00 00 00 00 3e c1 00 00 00 00 00 00 00 00 |......>.........|
+002002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200200 82 56 45 57 00 06 00 00 00 00 00 00 00 00 00 00 |.VEW............|
+00200210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200220 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 3f |...............?|
+00200230 00 00 00 ff 00 00 00 01 00 00 3e c1 00 00 3e c1 |..........>...>.|
+00200240 00 00 00 00 00 00 00 00 0e 10 00 01 00 00 00 00 |................|
+00200250 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....|
+00200260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200280 00 00 00 00 82 56 45 57 7d 32 00 04 00 00 20 00 |.....VEW}2.... .|
+00200290 00 00 20 00 00 00 08 01 00 00 10 00 00 00 00 00 |.. .............|
+002002a0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002002b0 00 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 |......@.........|
+002002c0 00 00 00 00 00 00 3e c1 00 00 00 00 00 00 00 00 |......>.........|
+002002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+a 4096 6144 2049 1M 4.2BSD 0 0 0
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help):
+00 unused 05 4.1BSD 09 4.4LFS 0d boot
+01 swap 06 Eighth Edition 0a unknown 0e ADOS
+02 Version 6 07 4.2BSD 0b HPFS 0f HFS
+03 Version 7 08 MS-DOS 0c ISO-9660 10 AdvFS
+04 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/bsd_1_0.LE b/tests/expected/fdisk/bsd_1_0.LE
new file mode 100644
index 0000000..3f14e8e
--- /dev/null
+++ b/tests/expected/fdisk/bsd_1_0.LE
@@ -0,0 +1,213 @@
+BSD_LABELSECTOR=1
+BSD_LABELOFFSET=0
+BSD_EXTRA=
+BYTE_ORDER=LE
+
+Initialize empty image
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Create new DOS partition table
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
+000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
+Create 1st primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 00 |!..A............|
+000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+-------------------
+
+Create 2nd primary partition
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+Set 2nd partition type
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
+-------------------
+
+Create default BSD
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200200 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200220 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200230 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200240 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200250 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 |........ .......|
+00200260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200280 00 00 00 00 57 45 56 82 33 62 04 00 00 20 00 00 |....WEV.3b... ..|
+00200290 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |. ..............|
+002002a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002002b0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+002002c0 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+002002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
+000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
+00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200200 57 45 56 82 06 00 00 00 00 00 00 00 00 00 00 00 |WEV.............|
+00200210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+00200220 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
+00200230 ff 00 00 00 01 00 00 00 c1 3e 00 00 c1 3e 00 00 |.........>...>..|
+00200240 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
+00200250 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 |........ .......|
+00200260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00200280 00 00 00 00 57 45 56 82 35 7a 04 00 00 20 00 00 |....WEV.5z... ..|
+00200290 00 20 00 00 01 08 00 00 00 10 00 00 00 00 00 00 |. ..............|
+002002a0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+002002b0 00 00 00 00 00 40 00 00 00 10 00 00 00 00 00 00 |.....@..........|
+002002c0 00 00 00 00 c1 3e 00 00 00 00 00 00 00 00 00 00 |.....>..........|
+002002d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+*
+00a00000
+
+---layout----------
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help): Disk <removed>2: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1 cylinders
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: bsd
+
+Slice Start End Sectors Size Type Fsize Bsize Cpg
+a 4096 6144 2049 1M 4.2BSD 0 0 0
+c 4096 20479 16384 8M unused 0 0 0
+d 0 16064 16065 7.8M unused 0 0 0
+
+Partition table entries are not in disk order.
+
+Command (m for help): Leaving nested disklabel.
+
+Command (m for help):
+-------------------
+
+
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Entering nested BSD disklabel.
+
+Command (m for help):
+00 unused 05 4.1BSD 09 4.4LFS 0d boot
+01 swap 06 Eighth Edition 0a unknown 0e ADOS
+02 Version 6 07 4.2BSD 0b HPFS 0f HFS
+03 Version 7 08 MS-DOS 0c ISO-9660 10 AdvFS
+04 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/gpt b/tests/expected/fdisk/gpt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/gpt
diff --git a/tests/expected/fdisk/gpt-change-type-by-number b/tests/expected/fdisk/gpt-change-type-by-number
new file mode 100644
index 0000000..33a6630
--- /dev/null
+++ b/tests/expected/fdisk/gpt-change-type-by-number
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>2 4096 6143 2048 1M Linux filesystem
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux filesystem
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-change-type-by-uuid b/tests/expected/fdisk/gpt-change-type-by-uuid
new file mode 100644
index 0000000..34b7919
--- /dev/null
+++ b/tests/expected/fdisk/gpt-change-type-by-uuid
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>2 4096 6143 2048 1M Linux filesystem
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux swap
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-corrupt-backup-table b/tests/expected/fdisk/gpt-corrupt-backup-table
new file mode 100644
index 0000000..34b7919
--- /dev/null
+++ b/tests/expected/fdisk/gpt-corrupt-backup-table
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>2 4096 6143 2048 1M Linux filesystem
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux swap
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-corrupt-primary-table b/tests/expected/fdisk/gpt-corrupt-primary-table
new file mode 100644
index 0000000..34b7919
--- /dev/null
+++ b/tests/expected/fdisk/gpt-corrupt-primary-table
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>2 4096 6143 2048 1M Linux filesystem
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux swap
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-create-again-partition b/tests/expected/fdisk/gpt-create-again-partition
new file mode 100644
index 0000000..34b7919
--- /dev/null
+++ b/tests/expected/fdisk/gpt-create-again-partition
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>2 4096 6143 2048 1M Linux filesystem
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux swap
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-create-partitions b/tests/expected/fdisk/gpt-create-partitions
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/gpt-create-partitions
diff --git a/tests/expected/fdisk/gpt-delete-partition b/tests/expected/fdisk/gpt-delete-partition
new file mode 100644
index 0000000..ed6cfa0
--- /dev/null
+++ b/tests/expected/fdisk/gpt-delete-partition
@@ -0,0 +1,19 @@
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>1 2048 4095 2048 1M EFI System
+<removed>3 6144 8191 2048 1M Linux filesystem
+<removed>4 8192 10239 2048 1M Linux filesystem
+<removed>5 10240 12287 2048 1M Linux swap
+<removed>6 12288 14335 2048 1M Linux filesystem
+<removed>7 14336 16383 2048 1M Linux filesystem
+<removed>8 16384 18431 2048 1M Linux filesystem
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-empty-pt b/tests/expected/fdisk/gpt-empty-pt
new file mode 100644
index 0000000..788aa65
--- /dev/null
+++ b/tests/expected/fdisk/gpt-empty-pt
@@ -0,0 +1,12 @@
+Initialize empty image
+Create new GPT partition table
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/gpt-resize b/tests/expected/fdisk/gpt-resize
new file mode 100644
index 0000000..d6a331a
--- /dev/null
+++ b/tests/expected/fdisk/gpt-resize
@@ -0,0 +1,43 @@
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+
+>>> Created a new disklabel.
+<removed>p1: Created a new partition <removed>.
+<removed>p2: Done.
+
+New situation:
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>p1 2048 18431 16384 8M Linux filesystem
+
+The partition table has been altered.
+----- fixing after resize: -----
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Partition number (2-128, default 2): First sector (18432-40926, default 18432): Last sector, +/-sectors or +/-size{K,M,G,T,P} (18432-40926, default 38911):
+Created a new partition <removed>.
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+
+The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).
+
+----- list result: -----
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>p1 2048 18431 16384 8M Linux filesystem
+<removed>p2 18432 38911 20480 10M Linux filesystem
diff --git a/tests/expected/fdisk/gpt-resize.err b/tests/expected/fdisk/gpt-resize.err
new file mode 100644
index 0000000..8c89224
--- /dev/null
+++ b/tests/expected/fdisk/gpt-resize.err
@@ -0,0 +1,4 @@
+----- fixing after resize: -----
+GPT PMBR size mismatch (20479 != 40959) will be corrected by write.
+The backup GPT table is not on the end of the device. This problem will be corrected by write.
+Re-reading the partition table failed.: Invalid argument
diff --git a/tests/expected/fdisk/id b/tests/expected/fdisk/id
new file mode 100644
index 0000000..960bb6b
--- /dev/null
+++ b/tests/expected/fdisk/id
@@ -0,0 +1 @@
+Initialize empty image
diff --git a/tests/expected/fdisk/id-create-mbr-with-id-0x1 b/tests/expected/fdisk/id-create-mbr-with-id-0x1
new file mode 100644
index 0000000..a9527e4
--- /dev/null
+++ b/tests/expected/fdisk/id-create-mbr-with-id-0x1
@@ -0,0 +1 @@
+Disk identifier: 0x00000001
diff --git a/tests/expected/fdisk/id-create-mbr-with-id-0x1.sparc b/tests/expected/fdisk/id-create-mbr-with-id-0x1.sparc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/id-create-mbr-with-id-0x1.sparc
diff --git a/tests/expected/fdisk/id-create-mbr-with-id-0x2 b/tests/expected/fdisk/id-create-mbr-with-id-0x2
new file mode 100644
index 0000000..a0a9884
--- /dev/null
+++ b/tests/expected/fdisk/id-create-mbr-with-id-0x2
@@ -0,0 +1 @@
+Disk identifier: 0x00000002
diff --git a/tests/expected/fdisk/id-create-mbr-with-id-0x2.sparc b/tests/expected/fdisk/id-create-mbr-with-id-0x2.sparc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/id-create-mbr-with-id-0x2.sparc
diff --git a/tests/expected/fdisk/id.sparc b/tests/expected/fdisk/id.sparc
new file mode 100644
index 0000000..960bb6b
--- /dev/null
+++ b/tests/expected/fdisk/id.sparc
@@ -0,0 +1 @@
+Initialize empty image
diff --git a/tests/expected/fdisk/mbr-dos-mode b/tests/expected/fdisk/mbr-dos-mode
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode
diff --git a/tests/expected/fdisk/mbr-dos-mode-create-another-log-par b/tests/expected/fdisk/mbr-dos-mode-create-another-log-par
new file mode 100644
index 0000000..61f04c0
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-create-another-log-par
@@ -0,0 +1,20 @@
+9589eaaed698d2402945ab3e513c1eb4 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+<removed>2 2 12 12 5 Extended 1/0/1 11/254/63
+<removed>5 6 7 2 83 Linux 5/1/1 6/254/63
+<removed>6 2 3 2 83 Linux 1/1/1 2/254/63
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-create-extended-par b/tests/expected/fdisk/mbr-dos-mode-create-extended-par
new file mode 100644
index 0000000..3c2229b
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-create-extended-par
@@ -0,0 +1,16 @@
+76987a00b353687cd1dba3ddea9d66f9 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+<removed>2 2 12 12 5 Extended 1/0/1 11/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-create-logical-par b/tests/expected/fdisk/mbr-dos-mode-create-logical-par
new file mode 100644
index 0000000..e37c296
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-create-logical-par
@@ -0,0 +1,20 @@
+a1cd6708e4a6d2e5f6bc9d5c0da0cf3b mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+<removed>2 2 12 12 5 Extended 1/0/1 11/254/63
+<removed>5 2 3 2 83 Linux 1/1/1 2/254/63
+<removed>6 4 5 2 83 Linux 3/1/1 4/254/63
+<removed>7 6 7 2 83 Linux 5/1/1 6/254/63
+<removed>8 8 9 2 83 Linux 7/1/1 8/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-create-primary-partition b/tests/expected/fdisk/mbr-dos-mode-create-primary-partition
new file mode 100644
index 0000000..ac8fb0f
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-create-primary-partition
@@ -0,0 +1,15 @@
+ae4f9b12f4a768849f72ea36938c30c7 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-delete-extended-par b/tests/expected/fdisk/mbr-dos-mode-delete-extended-par
new file mode 100644
index 0000000..0fbff6e
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-delete-extended-par
@@ -0,0 +1,12 @@
+fc3cdb12326656d7996b09b6f76973e7 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-delete-logical-par b/tests/expected/fdisk/mbr-dos-mode-delete-logical-par
new file mode 100644
index 0000000..cdae97e
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-delete-logical-par
@@ -0,0 +1,17 @@
+4c6937d529ace5661fb82efb9394154a mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+<removed>2 2 12 12 5 Extended 1/0/1 11/254/63
+<removed>5 6 7 2 83 Linux 5/1/1 6/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-delete-primary-par b/tests/expected/fdisk/mbr-dos-mode-delete-primary-par
new file mode 100644
index 0000000..1b9f0a3
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-delete-primary-par
@@ -0,0 +1,19 @@
+1e6d646e5df66a2664cfbbb13fa9a08a mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.91 MiB, 57577472 bytes, 112456 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>2 2 12 12 5 Extended 1/0/1 11/254/63
+<removed>5 6 7 2 83 Linux 5/1/1 6/254/63
+<removed>6 2 3 2 83 Linux 1/1/1 2/254/63
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-empty-pt b/tests/expected/fdisk/mbr-dos-mode-empty-pt
new file mode 100644
index 0000000..ecb5e4c
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-empty-pt
@@ -0,0 +1,13 @@
+f1c9645dbc14efddc7d8a322685f26eb mbr-dos-mode.img
+57e721e38d1266c2df055067c18f2cf9 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-re-create-primary-par b/tests/expected/fdisk/mbr-dos-mode-re-create-primary-par
new file mode 100644
index 0000000..ac8fb0f
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-re-create-primary-par
@@ -0,0 +1,15 @@
+ae4f9b12f4a768849f72ea36938c30c7 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 83 Linux 0/1/1 0/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-set-partition-type b/tests/expected/fdisk/mbr-dos-mode-set-partition-type
new file mode 100644
index 0000000..2a1aacb
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-set-partition-type
@@ -0,0 +1,15 @@
+4a5dba818f9962a82a086d8b99b89a17 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 1 1 1 bf Solaris 0/1/1 0/254/63
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-dos-mode-set-primary-par-active b/tests/expected/fdisk/mbr-dos-mode-set-primary-par-active
new file mode 100644
index 0000000..5c77ea3
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode-set-primary-par-active
@@ -0,0 +1,15 @@
+c30e9c761b71cf95c67e758b93706ac5 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 255 heads, 63 sectors/track, 1024 cylinders
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Cylinders Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 * 1 1 1 bf Solaris 0/1/1 0/254/63 80
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete b/tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete
new file mode 100644
index 0000000..a639244
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete
@@ -0,0 +1,19 @@
+Delete primary partition
+7b29a3cda33e990e8a7877b81988b933 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+<removed>5 26624 30719 4096 83 Linux 1/167/39 1/232/39
+<removed>6 14336 18431 4096 83 Linux 0/227/36 1/37/36
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-active b/tests/expected/fdisk/mbr-nondos-mode-1st-active
new file mode 100644
index 0000000..564c043
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-1st-active
@@ -0,0 +1,15 @@
+Set primary partition active
+47f024f3b406598a0159400af7382e2c mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 * 2048 8191 6144 83 Linux 0/32/33 0/130/2 80
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary b/tests/expected/fdisk/mbr-nondos-mode-1st-primary
new file mode 100644
index 0000000..8747bb9
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-1st-primary
@@ -0,0 +1,15 @@
+Create 1st primary partition
+e21e16b7452d82e2a2810a1de8c3db05 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete
new file mode 100644
index 0000000..8aaaa1c
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete
@@ -0,0 +1,20 @@
+Delete primary partition
+0b3611fc71ef2d02842feb621077767e mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+<removed>5 26624 30719 4096 83 Linux 1/167/39 1/232/39
+<removed>6 14336 18431 4096 83 Linux 0/227/36 1/37/36
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate
new file mode 100644
index 0000000..c359608
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate
@@ -0,0 +1,15 @@
+Re-create 1st primary partition
+e21e16b7452d82e2a2810a1de8c3db05 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-2nd-primary b/tests/expected/fdisk/mbr-nondos-mode-2nd-primary
new file mode 100644
index 0000000..c3693bf
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-2nd-primary
@@ -0,0 +1,16 @@
+Create 2nd primary partition
+3e928fabe884f6d4906b4d9335e7c6a3 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-empty-pt b/tests/expected/fdisk/mbr-nondos-mode-empty-pt
new file mode 100644
index 0000000..bc18a70
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-empty-pt
@@ -0,0 +1,14 @@
+Initialize empty image
+8f4e33f3dc3e414ff94e5fb6905cba8c mbr-nondos-mode.img
+Create new DOS partition table
+4e23561dcb81678bb1bd678722c7cbb7 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-extended b/tests/expected/fdisk/mbr-nondos-mode-extended
new file mode 100644
index 0000000..ba16770
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-extended
@@ -0,0 +1,17 @@
+Create extended partition
+eed98bd91ea08e63ab6cd9aa18ce544e mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-extended-delete b/tests/expected/fdisk/mbr-nondos-mode-extended-delete
new file mode 100644
index 0000000..b467274
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-extended-delete
@@ -0,0 +1,12 @@
+Delete extended partition
+e1ef48d3d42f4ebcfd5bf4baf5e370e9 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end b/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end
new file mode 100644
index 0000000..3656a0b
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end
@@ -0,0 +1,47 @@
+Create new DOS partition table (again)
+Create 1st primary at the end of device
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 20000 40959 20960 83 Linux 1/62/30 2/140/10
+-------------------
+
+Create 2nd primary at the begin of device
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (2048-19999, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-19999, default 19999):
+Created a new partition <removed>.
+
+Command (m for help): The partition table has been altered.
+Syncing disks.
+
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 20000 40959 20960 83 Linux 1/62/30 2/140/10
+<removed>2 2048 19999 17952 83 Linux 0/32/33 1/62/29
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical b/tests/expected/fdisk/mbr-nondos-mode-logical
new file mode 100644
index 0000000..9987693
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-logical
@@ -0,0 +1,21 @@
+Create logical partitions
+7fda11a0988bcb4822105c70cf75c1f2 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+<removed>5 14336 18431 4096 83 Linux 0/227/36 1/37/36
+<removed>6 20480 24575 4096 83 Linux 1/70/6 1/135/6
+<removed>7 26624 30719 4096 83 Linux 1/167/39 1/232/39
+<removed>8 32768 36863 4096 83 Linux 2/10/9 2/75/9
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical-delete b/tests/expected/fdisk/mbr-nondos-mode-logical-delete
new file mode 100644
index 0000000..c875b4a
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-logical-delete
@@ -0,0 +1,18 @@
+Delete logical partitions
+e2b25d19e00bfe88ed44ca4ac9216c39 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+<removed>5 26624 30719 4096 83 Linux 1/167/39 1/232/39
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical-recreate b/tests/expected/fdisk/mbr-nondos-mode-logical-recreate
new file mode 100644
index 0000000..764404b
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode-logical-recreate
@@ -0,0 +1,21 @@
+Create another logical partition
+640065c08c007d78166954475cd08ff8 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 8191 6144 83 Linux 0/32/33 0/130/2
+<removed>2 8192 12287 4096 83 Linux 0/130/3 0/195/3
+<removed>3 12288 40959 28672 5 Extended 0/195/4 2/140/10
+<removed>5 26624 30719 4096 83 Linux 1/167/39 1/232/39
+<removed>6 14336 18431 4096 83 Linux 0/227/36 1/37/36
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-sort b/tests/expected/fdisk/mbr-sort
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort
diff --git a/tests/expected/fdisk/mbr-sort-create-logical-partitions b/tests/expected/fdisk/mbr-sort-create-logical-partitions
new file mode 100644
index 0000000..9bf6cf5
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort-create-logical-partitions
@@ -0,0 +1,22 @@
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 4096 6143 2048 83 Linux 0/65/2 0/97/33
+<removed>2 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>3 6144 8191 2048 83 Linux 0/97/34 0/130/2
+<removed>4 8192 40959 32768 5 Extended 0/130/3 2/140/10
+<removed>5 14336 16383 2048 83 Linux 0/227/36 1/5/4
+<removed>6 22528 24575 2048 83 Linux 1/102/38 1/135/6
+<removed>7 18432 20479 2048 83 Linux 1/37/37 1/70/5
+<removed>8 10240 12287 2048 83 Linux 0/162/35 0/195/3
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-sort-create-primary-partitions b/tests/expected/fdisk/mbr-sort-create-primary-partitions
new file mode 100644
index 0000000..0fc5098
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort-create-primary-partitions
@@ -0,0 +1,18 @@
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 4096 6143 2048 83 Linux 0/65/2 0/97/33
+<removed>2 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>3 6144 8191 2048 83 Linux 0/97/34 0/130/2
+<removed>4 8192 40959 32768 5 Extended 0/130/3 2/140/10
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-sort-empty-pt b/tests/expected/fdisk/mbr-sort-empty-pt
new file mode 100644
index 0000000..338ac65
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort-empty-pt
@@ -0,0 +1,10 @@
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-sort-fix-order b/tests/expected/fdisk/mbr-sort-fix-order
new file mode 100644
index 0000000..8802009
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort-fix-order
@@ -0,0 +1,20 @@
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 6143 2048 83 Linux 0/65/2 0/97/33
+<removed>3 6144 8191 2048 83 Linux 0/97/34 0/130/2
+<removed>4 8192 40959 32768 5 Extended 0/130/3 2/140/10
+<removed>5 10240 12287 2048 83 Linux 0/162/35 0/195/3
+<removed>6 14336 16383 2048 83 Linux 0/227/36 1/5/4
+<removed>7 18432 20479 2048 83 Linux 1/37/37 1/70/5
+<removed>8 22528 24575 2048 83 Linux 1/102/38 1/135/6
+-------------------
+
diff --git a/tests/expected/fdisk/oddinput b/tests/expected/fdisk/oddinput
new file mode 100644
index 0000000..3391422
--- /dev/null
+++ b/tests/expected/fdisk/oddinput
@@ -0,0 +1,7 @@
+---Initialize empty image
+f1c9645dbc14efddc7d8a322685f26eb oddinput.img
+---Empty image listing
+Disk testimage: 10 MiB, 10485760 bytes, 20480 sectors
+Units: cylinders of 16065 * 512 = 8225280 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
diff --git a/tests/expected/fdisk/oddinput.err b/tests/expected/fdisk/oddinput.err
new file mode 100644
index 0000000..c39b607
--- /dev/null
+++ b/tests/expected/fdisk/oddinput.err
@@ -0,0 +1,4 @@
+---Nonexistent file
+fdisk: cannot open _a_file_that_does_not_exist_: ENOENT
+---Too small file
+fdisk: cannot open oddinput.toosmall: EINVAL
diff --git a/tests/expected/fdisk/oddinput.toosmall b/tests/expected/fdisk/oddinput.toosmall
new file mode 100644
index 0000000..06c75ed
--- /dev/null
+++ b/tests/expected/fdisk/oddinput.toosmall
@@ -0,0 +1 @@
+This file is too small
diff --git a/tests/expected/fdisk/sunlabel b/tests/expected/fdisk/sunlabel
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel
diff --git a/tests/expected/fdisk/sunlabel-create-first-partition b/tests/expected/fdisk/sunlabel-create-first-partition
new file mode 100644
index 0000000..61fecac
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-create-first-partition
@@ -0,0 +1,16 @@
+e730c7ec8208601f41963f0485147248 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4128768 83 Linux native
diff --git a/tests/expected/fdisk/sunlabel-create-second-partition b/tests/expected/fdisk/sunlabel-create-second-partition
new file mode 100644
index 0000000..f6442d3
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-create-second-partition
@@ -0,0 +1,29 @@
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Partition number (2-8, default 2): First cylinder (128-325, default 128): Last cylinder or +/-cylinders or +/-size{K,M,G,T,P} (128-325, default 325):
+Created a new partition <removed>.
+
+Command (m for help): The partition table has been altered.
+Syncing disks.
+
+a87e80830aa13d2d68b766962f052750 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4128768 4 SunOS usr ur
+<removed>2 129 325 198 6354432 83 Linux native
diff --git a/tests/expected/fdisk/sunlabel-delete-all-partitions b/tests/expected/fdisk/sunlabel-delete-all-partitions
new file mode 100644
index 0000000..0dee636
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-delete-all-partitions
@@ -0,0 +1 @@
+502ba7a0cfdce2849c3a99881f0590c3 sunlabel.img
diff --git a/tests/expected/fdisk/sunlabel-empty-sun-pt b/tests/expected/fdisk/sunlabel-empty-sun-pt
new file mode 100644
index 0000000..0d38bd7
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-empty-sun-pt
@@ -0,0 +1,14 @@
+f1c9645dbc14efddc7d8a322685f26eb sunlabel.img
+f050fd2beb99f8d968bf17450f655f06 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
diff --git a/tests/expected/fdisk/sunlabel-set-first-par-mountable b/tests/expected/fdisk/sunlabel-set-first-par-mountable
new file mode 100644
index 0000000..610dfa1
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-set-first-par-mountable
@@ -0,0 +1,16 @@
+3ab76e8491b103eab52b2ae1856c1e30 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4128768 4 SunOS usr ur
diff --git a/tests/expected/fdisk/sunlabel-set-first-par-readonly b/tests/expected/fdisk/sunlabel-set-first-par-readonly
new file mode 100644
index 0000000..042ba76
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-set-first-par-readonly
@@ -0,0 +1,16 @@
+da23f66698d9a553162887621d4c7490 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4128768 4 SunOS usr r
diff --git a/tests/expected/fdisk/sunlabel-set-partition-sysid b/tests/expected/fdisk/sunlabel-set-partition-sysid
new file mode 100644
index 0000000..b664433
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel-set-partition-sysid
@@ -0,0 +1,16 @@
+df75defdb97fbd56222aed18631a22d0 sunlabel.img
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Geometry: 1 heads, 63 sectors/track, 325 cylinders
+Units: cylinders of 63 * 512 = 32256 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: sun
+Label ID: Linux cyl 325 alt 0 hd 1 sec 63
+Rpm: 5400
+Alternate cylinders: 0
+Physical cylinders: 325
+Extra sects/cyl: 0
+Interleave: 1
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4128768 4 SunOS usr