Commit 838f63bb authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix BSD to Linux partition mapping

The mapping we used would fail in some cases. If a BSD partition
has the same boundaries with an MBR one, the kernel will not map it
onto a different block device. As a result, partition 'a' is sometimes
mapped onto /dev/sda1 and sometimes onto /dev/sda5.
parent 55d9caa8
......@@ -487,22 +487,19 @@ get_unattend() {
echo "$exists"
disklabel2linux() {
local partition i p
bsd2linux() {
local partition device
# Partition 'c' traditionally used to describe the entire disk is not
# mapped to /dev/sda7 by the kernel
for p in a b {d..p}; do
let i++
if [ "$p" = "$partition" ]; then
echo "$i"
return 0
linux_part=$(@scriptsdir@/ --get-partitions-mapping "$device" | grep ^"$partition": | cut -d" " -f2)
if [[ "$linux_part" =~ ^[1-9][0-9]*$ ]]; then
echo "$linux_part"
return 0
log_error "Invalid BSD partition label: \`$partition'"
log_error "Couldn't find out mapping for BSD partition: \`$partition' in \`$device'"
mount_all() {
......@@ -43,7 +43,7 @@ if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = openbsd ]; then
exit 0
part="${SNF_IMAGE_DEV}$(disklabel2linux "$bsd_part")"
part="${SNF_IMAGE_DEV}$(bsd2linux "$bsd_part" "$SNF_IMAGE_DEV")"
$DUMPFS_OPENBSD "$part" > /dev/null ||
{ warn "Filesystem is not UFS. Resizing ommited"; exit 0; }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment