--- /dev/null
+Checking that no-one is using this disk right now ... OK
+
+Disk <removed>: 100 MiB, 104857600 bytes, 204800 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
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 3048 23527 20480 10M 83 Linux
+
+<removed>1:
+New situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2548 23027 20480 10M 83 Linux
+
+Data move:
+ typescript file <removed>.
+ old start: 3048, new start: 2548 (move 20480 sectors)
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
--- /dev/null
+Checking that no-one is using this disk right now ... OK
+
+Disk <removed>: 100 MiB, 104857600 bytes, 204800 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
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2548 23027 20480 10M 83 Linux
+
+<removed>1:
+New situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 63988 84467 20480 10M 83 Linux
+
+Data move:
+ typescript file <removed>.
+ old start: 2548, new start: 63988 (move 20480 sectors)
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
--- /dev/null
+Checking that no-one is using this disk right now ... OK
+
+Disk <removed>: 100 MiB, 104857600 bytes, 204800 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
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 2048 22527 20480 10M 83 Linux
+
+<removed>1:
+New situation:
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 3048 23527 20480 10M 83 Linux
+
+Data move:
+ typescript file <removed>.
+ old start: 2048, new start: 3048 (move 20480 sectors)
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
# remove non comparable parts of fdisk output
if [ x"${DEVNAME}" != x"" ]; then
- sed -i -e "s:${DEVNAME}:<removed>:g" $TS_OUTPUT
+ sed -i -e "s:${DEVNAME}:<removed>:g;" $TS_OUTPUT
fi
sed -i -e 's/Disk identifier:.*/Disk identifier: <removed>/g' \
-e 's/^Device[[:blank:]]*Boot/Device Boot/g' \
-e 's/^Device[[:blank:]]*Flag/Device Flag/g' \
-e 's/Welcome to fdisk.*/Welcome to fdisk <removed>./g' \
+ -e 's/typescript file.*/typescript file <removed>./g' \
$TS_OUTPUT
}
--- /dev/null
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# 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.
+#
+
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="movedata"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_SFDISK"
+
+ts_skip_nonroot
+
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=100 sector_size=512
+
+# create a partition
+echo ',10M,L' | $TS_CMD_SFDISK ${TS_DEVICE} &> /dev/null
+udevadm settle
+
+mkfs.ext4 ${TS_DEVICE}1 &> /dev/null
+udevadm settle
+CHECKSUM=$(md5sum ${TS_DEVICE}1 | awk '{print $1}')
+
+function checksum() {
+ local dev="$1"
+ CHECK=$(md5sum ${dev} | awk '{print $1}')
+ if [ "$CHECKSUM" != "$CHECK" ]; then
+ echo "Checksum does not match!" >> $TS_OUTPUT
+ fi
+}
+
+ts_init_subtest "up"
+echo '+1000,' | $TS_CMD_SFDISK --move-data=$TS_OUTPUT.log -N1 ${TS_DEVICE} >> $TS_OUTPUT 2>&1
+ts_fdisk_clean $TS_DEVICE
+udevadm settle
+checksum ${TS_DEVICE}1
+ts_finalize_subtest
+
+udevadm settle
+
+ts_init_subtest "down"
+echo "-500," | $TS_CMD_SFDISK --move-data=$TS_OUTPUT.log -N1 ${TS_DEVICE} >> $TS_OUTPUT 2>&1
+ts_fdisk_clean $TS_DEVICE
+udevadm settle
+checksum ${TS_DEVICE}1
+ts_finalize_subtest
+
+udevadm settle
+
+ts_init_subtest "non-overlay"
+echo "+30M," | $TS_CMD_SFDISK --move-data=$TS_OUTPUT.log -N1 ${TS_DEVICE} >> $TS_OUTPUT 2>&1
+ts_fdisk_clean $TS_DEVICE
+udevadm settle
+checksum ${TS_DEVICE}1
+ts_finalize_subtest
+
+
+rmmod scsi_debug
+ts_finalize