summaryrefslogtreecommitdiffstats
path: root/tests/expected/fdisk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/expected/fdisk/align-512-4K79
-rw-r--r--tests/expected/fdisk/align-512-4K-6380
-rw-r--r--tests/expected/fdisk/align-512-4K-md79
-rw-r--r--tests/expected/fdisk/align-512-51267
-rw-r--r--tests/expected/fdisk/align-512-512-topology79
-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/gpt138
-rw-r--r--tests/expected/fdisk/gpt-resize54
-rw-r--r--tests/expected/fdisk/id5
-rw-r--r--tests/expected/fdisk/id.sparc3
-rw-r--r--tests/expected/fdisk/mbr-dos-mode189
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode203
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode.sparc189
-rw-r--r--tests/expected/fdisk/mbr-sort75
-rw-r--r--tests/expected/fdisk/oddinput11
-rw-r--r--tests/expected/fdisk/oddinput.toosmall1
-rw-r--r--tests/expected/fdisk/sunlabel80
21 files changed, 2401 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..e6aa145
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K
@@ -0,0 +1,79 @@
+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.
+Created a new <removed>.
+
+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 <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 <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 <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 <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 <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 <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 <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..831e7dc
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K-63
@@ -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.
+Created a new <removed>.
+
+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 <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 <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 <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 <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 <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 <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 <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..10f3ca6
--- /dev/null
+++ b/tests/expected/fdisk/align-512-4K-md
@@ -0,0 +1,79 @@
+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.
+Created a new <removed>.
+
+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 <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 (43008-102399, default 43008): Last sector, +/-sectors or +/-size{K,M,G,T,P} (43008-102399, default 102399):
+Created a new <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 43007 40960 20M 83 Linux
+<removed>2 43008 102399 59392 29M 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 <removed>.
+
+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-100095, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-100095, default 100095):
+Created a new <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-100095, default 22528): Last sector, +/-sectors or +/-size{K,M,G,T,P} (22528-100095, default 100095):
+Created a new <removed>.
+
+Command (m for help): Disk <removed>: 48.9 MiB, 51249152 bytes, 100096 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..083641f
--- /dev/null
+++ b/tests/expected/fdisk/align-512-512
@@ -0,0 +1,67 @@
+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.
+Created a new <removed>.
+
+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 <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 <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 <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 <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 <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 <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 <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..65420b6
--- /dev/null
+++ b/tests/expected/fdisk/align-512-512-topology
@@ -0,0 +1,79 @@
+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.
+Created a new <removed>.
+
+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 <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 <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 <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 <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 <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 <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 <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..3a79c49
--- /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 Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+-------------------
+
+Create 2st 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 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.9M 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 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.9M 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):
+ 0 unused 5 4.1BSD 9 4.4LFS d boot
+ 1 swap 6 Eighth Edition a unknown e ADOS
+ 2 Version 6 7 4.2BSD b HPFS f HFS
+ 3 Version 7 8 MS-DOS c ISO-9660 10 AdvFS
+ 4 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..d673d04
--- /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 Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+-------------------
+
+Create 2st 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 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.9M 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 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.9M 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):
+ 0 unused 5 4.1BSD 9 4.4LFS d boot
+ 1 swap 6 Eighth Edition a unknown e ADOS
+ 2 Version 6 7 4.2BSD b HPFS f HFS
+ 3 Version 7 8 MS-DOS c ISO-9660 10 AdvFS
+ 4 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..1c2a368
--- /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 2st 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.9M 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.9M 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):
+ 0 unused 5 4.1BSD 9 4.4LFS d boot
+ 1 swap 6 Eighth Edition a unknown e ADOS
+ 2 Version 6 7 4.2BSD b HPFS f HFS
+ 3 Version 7 8 ext2 c ISO-9660 10 AdvFS
+ 4 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..2c46abd
--- /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 Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+-------------------
+
+Create 2st 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 |................|
+*
+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.9M 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 |................|
+*
+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.9M 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):
+ 0 unused 5 4.1BSD 9 4.4LFS d boot
+ 1 swap 6 Eighth Edition a unknown e ADOS
+ 2 Version 6 7 4.2BSD b HPFS f HFS
+ 3 Version 7 8 MS-DOS c ISO-9660 10 AdvFS
+ 4 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..5f3b838
--- /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 Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+-------------------
+
+Create 2st 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 |................|
+*
+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.9M 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 |................|
+*
+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.9M 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):
+ 0 unused 5 4.1BSD 9 4.4LFS d boot
+ 1 swap 6 Eighth Edition a unknown e ADOS
+ 2 Version 6 7 4.2BSD b HPFS f HFS
+ 3 Version 7 8 MS-DOS c ISO-9660 10 AdvFS
+ 4 System V
+
+Command (m for help):
diff --git a/tests/expected/fdisk/gpt b/tests/expected/fdisk/gpt
new file mode 100644
index 0000000..3244874
--- /dev/null
+++ b/tests/expected/fdisk/gpt
@@ -0,0 +1,138 @@
+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>
+-------------------
+
+Create partitions
+Change partition type by number
+
+---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
+-------------------
+
+Change partition type by UUID
+
+---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
+-------------------
+
+Delete partition
+
+---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
+-------------------
+
+Create again partition
+
+---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
+-------------------
+
+Corrupt primary 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>
+
+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
+-------------------
+
+Corrupt backup 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>
+
+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-resize b/tests/expected/fdisk/gpt-resize
new file mode 100644
index 0000000..0b3c25a
--- /dev/null
+++ b/tests/expected/fdisk/gpt-resize
@@ -0,0 +1,54 @@
+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 <removed>.
+<removed>p1: Created a new <removed>.
+<removed>p2: Done.
+
+New situation:
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device Start End Sectors Size Type
+<removed>p1 2048 20446 18399 9M 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.
+
+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.
+
+Command (m for help): Partition number (2-128, default 2): First sector (20447-40926, default 20480): Last sector, +/-sectors or +/-size{K,M,G,T,P} (20480-40926, default 40926):
+Created a new <removed>.
+
+Command (m for help): The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Re-reading the partition table failed.: Invalid argument
+
+The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(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 20446 18399 9M Linux filesystem
+<removed>p2 20480 40926 20447 10M Linux filesystem
diff --git a/tests/expected/fdisk/id b/tests/expected/fdisk/id
new file mode 100644
index 0000000..4801f81
--- /dev/null
+++ b/tests/expected/fdisk/id
@@ -0,0 +1,5 @@
+Initialize empty image
+Create MBR with ID=0x1
+Disk identifier: 0x00000001
+Create MBR with ID=0x2
+Disk identifier: 0x00000002
diff --git a/tests/expected/fdisk/id.sparc b/tests/expected/fdisk/id.sparc
new file mode 100644
index 0000000..aa3f407
--- /dev/null
+++ b/tests/expected/fdisk/id.sparc
@@ -0,0 +1,3 @@
+Initialize empty image
+Create MBR with ID=0x1
+Create MBR with ID=0x2
diff --git a/tests/expected/fdisk/mbr-dos-mode b/tests/expected/fdisk/mbr-dos-mode
new file mode 100644
index 0000000..657fbdc
--- /dev/null
+++ b/tests/expected/fdisk/mbr-dos-mode
@@ -0,0 +1,189 @@
+Initialize empty image
+f1c9645dbc14efddc7d8a322685f26eb mbr-dos-mode.img
+Create new DOS partition table
+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>
+-------------------
+
+Create primary partition
+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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+-------------------
+
+Set partition type
+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 Size Id Type
+<removed>1 1 1 1 7.8M bf Solaris
+-------------------
+
+Set primary partition active
+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 Size Id Type
+<removed>1 * 1 1 1 7.8M bf Solaris
+-------------------
+
+Re-create primary partition
+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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+-------------------
+
+Create extended partition
+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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+<removed>2 2 12 12 86.3M 5 Extended
+-------------------
+
+Create logical partitions
+a1cd6708e4a6d2e5f6bc9d5c0da0cf3b mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.9 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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+<removed>2 2 12 12 86.3M 5 Extended
+<removed>5 2 3 2 15.7M 83 Linux
+<removed>6 4 5 2 15.7M 83 Linux
+<removed>7 6 7 2 15.7M 83 Linux
+<removed>8 8 9 2 15.7M 83 Linux
+-------------------
+
+Delete logical partitions
+4c6937d529ace5661fb82efb9394154a mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.9 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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+<removed>2 2 12 12 86.3M 5 Extended
+<removed>5 6 7 2 15.7M 83 Linux
+-------------------
+
+Create another logical partition
+9589eaaed698d2402945ab3e513c1eb4 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.9 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 Size Id Type
+<removed>1 1 1 1 7.8M 83 Linux
+<removed>2 2 12 12 86.3M 5 Extended
+<removed>5 6 7 2 15.7M 83 Linux
+<removed>6 2 3 2 15.7M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+Delete primary partition
+1e6d646e5df66a2664cfbbb13fa9a08a mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.9 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 Size Id Type
+<removed>2 2 12 12 86.3M 5 Extended
+<removed>5 6 7 2 15.7M 83 Linux
+<removed>6 2 3 2 15.7M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+Delete extended partition
+fc3cdb12326656d7996b09b6f76973e7 mbr-dos-mode.img
+
+---layout----------
+Disk <removed>: 54.9 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-nondos-mode b/tests/expected/fdisk/mbr-nondos-mode
new file mode 100644
index 0000000..8833baa
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode
@@ -0,0 +1,203 @@
+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>
+-------------------
+
+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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+-------------------
+
+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 Size Id Type
+<removed>1 * 2048 8191 6144 3M 83 Linux
+-------------------
+
+Re-create 1st primary partition
+a5543ee1e3d2cf79913a56bae893a0f0 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+-------------------
+
+Create 2nd primary partition
+9d31ee977e26e72ebce78e8e543cd4ce 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+<removed>2 8192 12287 4096 2M 83 Linux
+-------------------
+
+Create extended partition
+9528631b198e44564f67f8ca97fa51b8 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+<removed>2 8192 12287 4096 2M 83 Linux
+<removed>3 12288 40959 28672 14M 5 Extended
+-------------------
+
+Create logical partitions
+db4406e7bc0773f234fd1db1b58b5997 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+<removed>2 8192 12287 4096 2M 83 Linux
+<removed>3 12288 40959 28672 14M 5 Extended
+<removed>5 14336 18431 4096 2M 83 Linux
+<removed>6 20480 24575 4096 2M 83 Linux
+<removed>7 26624 30719 4096 2M 83 Linux
+<removed>8 32768 36863 4096 2M 83 Linux
+-------------------
+
+Delete logical partitions
+de85b8d74f52f307b9467ea4c33438cb 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+<removed>2 8192 12287 4096 2M 83 Linux
+<removed>3 12288 40959 28672 14M 5 Extended
+<removed>5 26624 30719 4096 2M 83 Linux
+-------------------
+
+Create another logical partition
+28d0cbe795535ee025dc7a4781516965 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 Size Id Type
+<removed>1 2048 8191 6144 3M 83 Linux
+<removed>2 8192 12287 4096 2M 83 Linux
+<removed>3 12288 40959 28672 14M 5 Extended
+<removed>5 26624 30719 4096 2M 83 Linux
+<removed>6 14336 18431 4096 2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+Delete primary partition
+6f1b62718cf8d83602d51de8944cee51 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 Size Id Type
+<removed>2 8192 12287 4096 2M 83 Linux
+<removed>3 12288 40959 28672 14M 5 Extended
+<removed>5 26624 30719 4096 2M 83 Linux
+<removed>6 14336 18431 4096 2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+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 Size Id Type
+<removed>3 12288 40959 28672 14M 5 Extended
+<removed>5 26624 30719 4096 2M 83 Linux
+<removed>6 14336 18431 4096 2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+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.sparc b/tests/expected/fdisk/mbr-nondos-mode.sparc
new file mode 100644
index 0000000..ffbbd80
--- /dev/null
+++ b/tests/expected/fdisk/mbr-nondos-mode.sparc
@@ -0,0 +1,189 @@
+Initialize empty image
+8f4e33f3dc3e414ff94e5fb6905cba8c mbr-nondos-mode.img
+Create new DOS partition table
+8f4e33f3dc3e414ff94e5fb6905cba8c 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
+-------------------
+
+Create 1st primary partition
+d5ad6d4e743430c2a61e558bb3319175 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Set primary partition active
+d59bb4ba5914242f9a63a2d13fb68752 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Re-create 1st primary partition
+d8ba04bdd46cec690fa672ac8fcaf387 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+-------------------
+
+Create 2nd primary partition
+d8ba04bdd46cec690fa672ac8fcaf387 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+-------------------
+
+Create extended partition
+d59bb4ba5914242f9a63a2d13fb68752 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Create logical partitions
+d59bb4ba5914242f9a63a2d13fb68752 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Delete logical partitions
+d59bb4ba5914242f9a63a2d13fb68752 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Create another logical partition
+d59bb4ba5914242f9a63a2d13fb68752 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>1 0 16064 16065 7.9M 83 Linux native r
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Delete primary partition
+0bd87175c4c5c3ef9a46595027b6369c mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>2 16065 32129 16065 7.9M 82 Linux swap u
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Delete primary partition
+33f6e541ddcafed65d231ce3f2b76a59 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+
+Device Start End Sectors Size Id Type Flags
+<removed>3 0 32129 32130 15.7M 5 Whole disk
+-------------------
+
+Delete extended partition
+e923755cbc0054eb85341fe119be07f9 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Geometry: 255 heads, 63 sectors/track, 2 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: sun
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-sort b/tests/expected/fdisk/mbr-sort
new file mode 100644
index 0000000..e97e3b4
--- /dev/null
+++ b/tests/expected/fdisk/mbr-sort
@@ -0,0 +1,75 @@
+Initialize empty image
+Create new DOS partition table
+
+---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>
+-------------------
+
+Create primary partitions
+
+---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 Size Id Type
+<removed>1 4096 6143 2048 1M 83 Linux
+<removed>2 2048 4095 2048 1M 83 Linux
+<removed>3 6144 8191 2048 1M 83 Linux
+<removed>4 8192 40959 32768 16M 5 Extended
+
+Partition table entries are not in disk order.
+-------------------
+
+Create logical partitions
+
+---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 Size Id Type
+<removed>1 4096 6143 2048 1M 83 Linux
+<removed>2 2048 4095 2048 1M 83 Linux
+<removed>3 6144 8191 2048 1M 83 Linux
+<removed>4 8192 40959 32768 16M 5 Extended
+<removed>5 14336 16383 2048 1M 83 Linux
+<removed>6 22528 24575 2048 1M 83 Linux
+<removed>7 18432 20479 2048 1M 83 Linux
+<removed>8 10240 12287 2048 1M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
+Fix order.
+
+---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 Size Id Type
+<removed>1 2048 4095 2048 1M 83 Linux
+<removed>2 4096 6143 2048 1M 83 Linux
+<removed>3 6144 8191 2048 1M 83 Linux
+<removed>4 8192 40959 32768 16M 5 Extended
+<removed>5 10240 12287 2048 1M 83 Linux
+<removed>6 14336 16383 2048 1M 83 Linux
+<removed>7 18432 20479 2048 1M 83 Linux
+<removed>8 22528 24575 2048 1M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/oddinput b/tests/expected/fdisk/oddinput
new file mode 100644
index 0000000..2fccc6c
--- /dev/null
+++ b/tests/expected/fdisk/oddinput
@@ -0,0 +1,11 @@
+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
+Nonexistent file
+fdisk: cannot open _a_file_that_does_not_exist_: No such file or directory
+Too small file
+fdisk: cannot open oddinput.toosmall: Inappropriate ioctl for device
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..47b5e75
--- /dev/null
+++ b/tests/expected/fdisk/sunlabel
@@ -0,0 +1,80 @@
+Initialize empty image
+f1c9645dbc14efddc7d8a322685f26eb sunlabel.img
+Create new SUN partition table
+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
+Create first partition
+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
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4M 83 Linux native
+Set partition sysid
+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
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4M 4 SunOS usr
+Set first partition readonly
+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
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4M 4 SunOS usr r
+Set first partition mountable
+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
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4M 4 SunOS usr ur
+Create second partition
+
+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 <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
+
+Device Start End Cylinders Size Id Type Flags
+<removed>1 1 128 129 4M 4 SunOS usr ur
+<removed>2 129 325 198 6.1M 83 Linux native
+Delete all partitions
+502ba7a0cfdce2849c3a99881f0590c3 sunlabel.img