From: Karel Zak Date: Tue, 9 Feb 2010 14:47:32 +0000 (+0100) Subject: tests: add fdisk alignment tests X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef53439815c7ff18e5d916d81f357ce2de9d2089;p=util-linux tests: add fdisk alignment tests Signed-off-by: Karel Zak --- diff --git a/tests/expected/fdisk/align-512-4K b/tests/expected/fdisk/align-512-4K new file mode 100644 index 00000000..68676796 --- /dev/null +++ b/tests/expected/fdisk/align-512-4K @@ -0,0 +1,78 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +The device presents a logical sector size that is smaller than +the physical sector size. Aligning to a physical sector (or optimal +I/O) size boundary is recommended, or performance may be impacted. + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (64-102399, default 64): Using default value 64 +Last sector, +sectors or +size{K,M,G} (64-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (20544-102399, default 20544): Using default value 20544 +Last sector, +sectors or +size{K,M,G} (20544-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (41024-102399, default 41024): Using default value 41024 +Last sector, +sectors or +size{K,M,G} (41024-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Selected partition 4 +First sector (61504-102399, default 61504): Using default value 61504 +Last sector, +sectors or +size{K,M,G} (61504-102399, default 102399): Using default value 102399 + +Command (m for help): First sector (61568-102399, default 61568): Using default value 61568 +Last sector, +sectors or +size{K,M,G} (61568-102399, default 102399): +Command (m for help): First sector (71872-102399, default 71872): Using default value 71872 +Last sector, +sectors or +size{K,M,G} (71872-102399, default 102399): +Command (m for help): First sector (82176-102399, default 82176): Using default value 82176 +Last sector, +sectors or +size{K,M,G} (82176-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/sdb: 52 MB, 52428800 bytes +32 heads, 32 sectors/track, 100 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 bytes / 32768 bytes + + + Device Boot Start End Blocks Id System +/dev/sdb1 64 20543 10240 83 Linux +/dev/sdb2 20544 41023 10240 83 Linux +/dev/sdb3 41024 61503 10240 83 Linux +/dev/sdb4 61504 102399 20448 5 Extended +/dev/sdb5 61568 71807 5120 83 Linux +/dev/sdb6 71872 82111 5120 83 Linux +/dev/sdb7 82176 102399 10112 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 00000000..e54faf48 --- /dev/null +++ b/tests/expected/fdisk/align-512-4K-63 @@ -0,0 +1,79 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +The device presents a logical sector size that is smaller than +the physical sector size. Aligning to a physical sector (or optimal +I/O) size boundary is recommended, or performance may be impacted. + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (7-102399, default 7): Using default value 7 +Last sector, +sectors or +size{K,M,G} (7-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (20479-102399, default 20479): Using default value 20479 +Last sector, +sectors or +size{K,M,G} (20479-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (40959-102399, default 40959): Using default value 40959 +Last sector, +sectors or +size{K,M,G} (40959-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Selected partition 4 +First sector (61439-102399, default 61439): Using default value 61439 +Last sector, +sectors or +size{K,M,G} (61439-102399, default 102399): Using default value 102399 + +Command (m for help): First sector (61446-102399, default 61503): Using default value 61503 +Last sector, +sectors or +size{K,M,G} (61503-102399, default 102399): +Command (m for help): First sector (61446-102399, default 71807): Using default value 71807 +Last sector, +sectors or +size{K,M,G} (71807-102399, default 102399): +Command (m for help): First sector (61446-102399, default 82111): Using default value 82111 +Last sector, +sectors or +size{K,M,G} (82111-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/sdb: 52 MB, 52428800 bytes +32 heads, 32 sectors/track, 100 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 bytes / 32768 bytes +Alignment offset: 3584 bytes + + + Device Boot Start End Blocks Id System +/dev/sdb1 7 20478 10236 83 Linux +/dev/sdb2 20479 40958 10240 83 Linux +/dev/sdb3 40959 61438 10240 83 Linux +/dev/sdb4 61439 102399 20480+ 5 Extended +/dev/sdb5 61503 71742 5120 83 Linux +/dev/sdb6 71807 82046 5120 83 Linux +/dev/sdb7 82111 102399 10144+ 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 00000000..b6330ab9 --- /dev/null +++ b/tests/expected/fdisk/align-512-4K-md @@ -0,0 +1,99 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +The device presents a logical sector size that is smaller than +the physical sector size. Aligning to a physical sector (or optimal +I/O) size boundary is recommended, or performance may be impacted. + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (64-102399, default 64): Using default value 64 +Last sector, +sectors or +size{K,M,G} (64-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (41024-102399, default 41024): Using default value 41024 +Last sector, +sectors or +size{K,M,G} (41024-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/sdb: 52 MB, 52428800 bytes +32 heads, 32 sectors/track, 100 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 bytes / 32768 bytes + + + Device Boot Start End Blocks Id System +/dev/sdb1 64 41023 20480 83 Linux +/dev/sdb2 41024 102399 30688 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) +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +The device presents a logical sector size that is smaller than +the physical sector size. Aligning to a physical sector (or optimal +I/O) size boundary is recommended, or performance may be impacted. + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (256-102015, default 256): Using default value 256 +Last sector, +sectors or +size{K,M,G} (256-102015, default 102015): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (20736-102015, default 20736): Using default value 20736 +Last sector, +sectors or +size{K,M,G} (20736-102015, default 102015): +Command (m for help): +Disk /dev/md8: 52 MB, 52232192 bytes +2 heads, 4 sectors/track, 12752 cylinders, total 102016 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 65536 bytes / 131072 bytes + + + Device Boot Start End Blocks Id System +/dev/md8p1 256 20735 10240 83 Linux +/dev/md8p2 20736 41215 10240 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-4K-topology b/tests/expected/fdisk/align-512-4K-topology new file mode 100644 index 00000000..8901cc6f --- /dev/null +++ b/tests/expected/fdisk/align-512-4K-topology @@ -0,0 +1,78 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel +Building a new DOS disklabel with disk identifier 0x817cb84a. +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +The device presents a logical sector size that is smaller than +the physical sector size. Aligning to a physical sector (or optimal +I/O) size boundary is recommended, or performance may be impacted. + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (64-102399, default 64): Using default value 64 +Last sector, +sectors or +size{K,M,G} (64-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (20544-102399, default 20544): Using default value 20544 +Last sector, +sectors or +size{K,M,G} (20544-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (41024-102399, default 41024): Using default value 41024 +Last sector, +sectors or +size{K,M,G} (41024-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Selected partition 4 +First sector (61504-102399, default 61504): Using default value 61504 +Last sector, +sectors or +size{K,M,G} (61504-102399, default 102399): Using default value 102399 + +Command (m for help): First sector (61568-102399, default 61568): Using default value 61568 +Last sector, +sectors or +size{K,M,G} (61568-102399, default 102399): +Command (m for help): First sector (71872-102399, default 71872): Using default value 71872 +Last sector, +sectors or +size{K,M,G} (71872-102399, default 102399): +Command (m for help): First sector (82176-102399, default 82176): Using default value 82176 +Last sector, +sectors or +size{K,M,G} (82176-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/sdb: 52 MB, 52428800 bytes +32 heads, 32 sectors/track, 100 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 bytes / 32768 bytes +Disk identifier: 0x817cb84a + + Device Boot Start End Blocks Id System +/dev/sdb1 64 20543 10240 83 Linux +/dev/sdb2 20544 41023 10240 83 Linux +/dev/sdb3 41024 61503 10240 83 Linux +/dev/sdb4 61504 102399 20448 5 Extended +/dev/sdb5 61568 71807 5120 83 Linux +/dev/sdb6 71872 82111 5120 83 Linux +/dev/sdb7 82176 102399 10112 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-512 b/tests/expected/fdisk/align-512-512 new file mode 100644 index 00000000..d39127ea --- /dev/null +++ b/tests/expected/fdisk/align-512-512 @@ -0,0 +1,63 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (2048-102399, default 2048): Using default value 2048 +Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (22528-102399, default 22528): Using default value 22528 +Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (43008-102399, default 43008): Using default value 43008 +Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Selected partition 4 +First sector (63488-102399, default 63488): Using default value 63488 +Last sector, +sectors or +size{K,M,G} (63488-102399, default 102399): Using default value 102399 + +Command (m for help): First sector (65536-102399, default 65536): Using default value 65536 +Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399): +Command (m for help): First sector (77824-102399, default 77824): Using default value 77824 +Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399): +Command (m for help): First sector (90112-102399, default 90112): Using default value 90112 +Last sector, +sectors or +size{K,M,G} (90112-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/loop0: 52 MB, 52428800 bytes +255 heads, 63 sectors/track, 6 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + + Device Boot Start End Blocks Id System +/dev/loop0p1 2048 22527 10240 83 Linux +/dev/loop0p2 22528 43007 10240 83 Linux +/dev/loop0p3 43008 63487 10240 83 Linux +/dev/loop0p4 63488 102399 19456 5 Extended +/dev/loop0p5 65536 75775 5120 83 Linux +/dev/loop0p6 77824 88063 5120 83 Linux +/dev/loop0p7 90112 102399 6144 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 00000000..5ccbc626 --- /dev/null +++ b/tests/expected/fdisk/align-512-512-topology @@ -0,0 +1,74 @@ +Create partitions +Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel + +Changes will remain in memory only, until you decide to write them. +After that, of course, the previous content won't be recoverable. + +Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) + +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to + switch off the mode (command 'c') and change display units to + sectors (command 'u'). + +Command (m for help): DOS Compatibility flag is not set + +Command (m for help): Changing display/entry units to sectors + +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (64-102399, default 64): Using default value 64 +Last sector, +sectors or +size{K,M,G} (64-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (20544-102399, default 20544): Using default value 20544 +Last sector, +sectors or +size{K,M,G} (20544-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Partition number (1-4): First sector (41024-102399, default 41024): Using default value 41024 +Last sector, +sectors or +size{K,M,G} (41024-102399, default 102399): +Command (m for help): Command action + e extended + p primary partition (1-4) +Selected partition 4 +First sector (61504-102399, default 61504): Using default value 61504 +Last sector, +sectors or +size{K,M,G} (61504-102399, default 102399): Using default value 102399 + +Command (m for help): First sector (61568-102399, default 61568): Using default value 61568 +Last sector, +sectors or +size{K,M,G} (61568-102399, default 102399): +Command (m for help): First sector (71872-102399, default 71872): Using default value 71872 +Last sector, +sectors or +size{K,M,G} (71872-102399, default 102399): +Command (m for help): First sector (82176-102399, default 82176): Using default value 82176 +Last sector, +sectors or +size{K,M,G} (82176-102399, default 102399): Using default value 102399 + +Command (m for help): +Disk /dev/sdb: 52 MB, 52428800 bytes +32 heads, 32 sectors/track, 100 cylinders, total 102400 sectors +Units = sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 32768 bytes + + + Device Boot Start End Blocks Id System +/dev/sdb1 64 20543 10240 83 Linux +/dev/sdb2 20544 41023 10240 83 Linux +/dev/sdb3 41024 61503 10240 83 Linux +/dev/sdb4 61504 102399 20448 5 Extended +/dev/sdb5 61568 71807 5120 83 Linux +/dev/sdb6 71872 82111 5120 83 Linux +/dev/sdb7 82176 102399 10112 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/functions.sh b/tests/functions.sh index eb9a878d..9e66e432 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -255,7 +255,7 @@ function ts_image_init { } function ts_device_init { - local img=$(ts_image_init) + local img=$(ts_image_init $1 $2) local dev=$($TS_CMD_LOSETUP -s -f "$img") if [ -z "$dev" ]; then diff --git a/tests/ts/fdisk/align-512-4K b/tests/ts/fdisk/align-512-4K new file mode 100755 index 00000000..0bbd8a73 --- /dev/null +++ b/tests/ts/fdisk/align-512-4K @@ -0,0 +1,91 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + + +# +# Test alignment for 512/512 disk *with* topology -- aligned to optimal +# I/O size (32KiB) +# + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="align 512/4K" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +modprobe --dry-run --quiet scsi_debug +[ "$?" == 0 ] || ts_skip "missing scsi_debug module" + +rmmod scsi_debug &> /dev/null +modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3 +[ "$?" == 0 ] || ts_die "Cannot init device" + +sleep 3 + +DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') +[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device" + +DEVICE="/dev/${DEVNAME}" + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 + +sleep 3 +rmmod scsi_debug + +# remove disk ID +sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT +sed -i -e 's/Building a new.*//g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/fdisk/align-512-4K-63 b/tests/ts/fdisk/align-512-4K-63 new file mode 100755 index 00000000..e577d744 --- /dev/null +++ b/tests/ts/fdisk/align-512-4K-63 @@ -0,0 +1,91 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + + +# +# Test alignment for 512/512 disk *with* topology -- aligned to optimal +# I/O size (32KiB) +# + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="align 512/4K +alignment_offset" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +modprobe --dry-run --quiet scsi_debug +[ "$?" == 0 ] || ts_skip "missing scsi_debug module" + +rmmod scsi_debug &> /dev/null +modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7 +[ "$?" == 0 ] || ts_die "Cannot init device" + +sleep 3 + +DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') +[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device" + +DEVICE="/dev/${DEVNAME}" + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 + +sleep 3 +rmmod scsi_debug + +# remove disk ID +sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT +sed -i -e 's/Building a new.*//g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md new file mode 100755 index 00000000..310bb3a8 --- /dev/null +++ b/tests/ts/fdisk/align-512-4K-md @@ -0,0 +1,104 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + + +# +# Test alignment for 512/512 disk *with* topology -- aligned to optimal +# I/O size (32KiB) +# + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="align 512/4K +MD" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +modprobe --dry-run --quiet scsi_debug +[ "$?" == 0 ] || ts_skip "missing scsi_debug module" +[ -x /sbin/mdadm ] || ts_skip "missing mdadm" + +rmmod scsi_debug &> /dev/null +modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3 +[ "$?" == 0 ] || ts_die "Cannot init device" + +sleep 3 + +DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') +[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device" + +DEVICE="/dev/${DEVNAME}" + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 + +sleep 3 +MD_DEVNAME=md8 +MD_DEVICE=/dev/${MD_DEVNAME} + +/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null +/sbin/mdadm -q --create ${MD_DEVICE} --level=0 --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1 + +ts_log "Create partitions (MD)" +$TS_CMD_FDISK ${MD_DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 + +sleep 3 +/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1 +rmmod scsi_debug + +# remove disk ID +sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT +sed -i -e 's/Building a new.*//g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/fdisk/align-512-512 b/tests/ts/fdisk/align-512-512 new file mode 100755 index 00000000..f96e6a5f --- /dev/null +++ b/tests/ts/fdisk/align-512-512 @@ -0,0 +1,74 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +# +# Test default 1MiB (2048 sectors) alignment for 512/512 disk *without* +# topology. +# + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="align 512/512" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +DEVICE=$(ts_device_init 50) +[ "$?" == 0 ] || ts_die "Cannot init device" + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 < /dev/null +modprobe scsi_debug dev_size_mb=50 sector_size=512 +[ "$?" == 0 ] || ts_die "Cannot init device" + +sleep 3 + +DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') +[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device" + +DEVICE="/dev/${DEVNAME}" + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 + +sleep 3 +rmmod scsi_debug + +# remove disk ID +sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT +sed -i -e 's/Building a new.*//g' $TS_OUTPUT + +ts_finalize