diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-01-25 08:13:11 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-01-25 08:13:15 +0100 |
commit | b02c381b4b817e22a36ce5b2155e9eebcc77e312 (patch) | |
tree | 2197eeb2a1a4f6e8b3d1e23bf2323d4363b809ff /target/linux/x86/base-files | |
parent | d872b732e7e58f14cdbb9c43b2493afc050371bc (diff) | |
download | upstream-b02c381b4b817e22a36ce5b2155e9eebcc77e312.tar.gz upstream-b02c381b4b817e22a36ce5b2155e9eebcc77e312.tar.bz2 upstream-b02c381b4b817e22a36ce5b2155e9eebcc77e312.zip |
x86: fix sysupgrades on disks with 4k block size
Even when the disk uses 4k blocks, the partition table still uses units
of 512 byte sectors. Always use ibs=512 for the offsets
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/x86/base-files')
-rw-r--r-- | target/linux/x86/base-files/lib/upgrade/platform.sh | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 8850917062..d3e9f360aa 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -21,20 +21,13 @@ platform_copy_config() { } platform_do_upgrade() { - local diskdev partdev ibs diff + local diskdev partdev diff if export_bootdevice && export_partdevice diskdev 0; then sync if [ "$SAVE_PARTITIONS" = "1" ]; then get_partitions "/dev/$diskdev" bootdisk - #get block size - if [ -f "/sys/block/$diskdev/queue/physical_block_size" ]; then - ibs="$(cat "/sys/block/$diskdev/queue/physical_block_size")" - else - ibs=512 - fi - #extract the boot sector from the image get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b @@ -54,7 +47,7 @@ platform_do_upgrade() { while read part start size; do if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." - get_image "$@" | dd of="/dev/$partdev" ibs="$ibs" obs=1M skip="$start" count="$size" conv=fsync + get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync else echo "Unable to find partition $part device, skipped." fi |