summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/partvi11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/partvi b/src/partvi
index 322b5ba..16e14b3 100755
--- a/src/partvi
+++ b/src/partvi
@@ -164,13 +164,22 @@ do
164 else 164 else
165 partuuid= 165 partuuid=
166 fi 166 fi
167 #stat -L --format="$part %s" "$part"
168 $sudo losetup -L -f "$part" 167 $sudo losetup -L -f "$part"
169 dev=$(losetup -j "$part" -O NAME --noheadings) 168 dev=$(losetup -j "$part" -O NAME --noheadings)
170 devsz=$($sudo blockdev --getsz $dev) 169 devsz=$($sudo blockdev --getsz $dev)
170
171 alignment_error=$((devsz % 2048))
172
171 printf '%d %d linear %s 0\n' $start $devsz "$dev" >> "$map" 173 printf '%d %d linear %s 0\n' $start $devsz "$dev" >> "$map"
172 start=$((start + devsz)) 174 start=$((start + devsz))
173 175
176 if [ $alignment_error -gt 0 ]
177 then
178 devsz=$((2048 - alignment_error))
179 printf '%d %d zero\n' $start $devsz >> "$map"
180 start=$((start + devsz))
181 fi
182
174done 183done
175$sudo dmsetup -v create "$map_name" "$map" 184$sudo dmsetup -v create "$map_name" "$map"
176$sudo dmsetup remove "$map_name" 185$sudo dmsetup remove "$map_name"