Grow the MBR partition table entry for the BSD partition before
growing the disklabel.
This commit is contained in:
parent
32859d4ec3
commit
fa18b035dc
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: resize_disklabel,v 1.1 2015/04/06 20:19:28 jmcneill Exp $
|
||||
# $NetBSD: resize_disklabel,v 1.2 2017/04/14 13:47:21 jmcneill Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: resize_disklabel
|
||||
|
@ -33,6 +33,30 @@ get_rawpart_sectors()
|
|||
/sbin/disklabel $disk | grep "^ $rawpart:" | awk '{ print $2; }'
|
||||
}
|
||||
|
||||
grow_mbrpart()
|
||||
{
|
||||
disk=$1
|
||||
rawpart=$(get_rawpart)
|
||||
|
||||
eval $(/sbin/fdisk -S $disk)
|
||||
if [ ! "$PART1ID" = "169" ]; then
|
||||
warn "No NetBSD partition found in MBR partition #1"
|
||||
return
|
||||
fi
|
||||
|
||||
ts=$(($(get_total_sectors $disk) - ${PART1START}))
|
||||
rs=${PART1SIZE}
|
||||
|
||||
if [ "$ts" = "$rs" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
oldsize=$(($rs * 512 / 1024 / 1024))
|
||||
newsize=$(($ts * 512 / 1024 / 1024))
|
||||
echo "Growing $disk MBR partition #1 (${oldsize}MB -> ${newsize}MB)"
|
||||
/sbin/fdisk -f -u -1 -s 169/${PART1START}/${ts} ${disk}
|
||||
}
|
||||
|
||||
grow_disklabel()
|
||||
{
|
||||
disk=$1
|
||||
|
@ -64,6 +88,7 @@ resize_disklabel_start()
|
|||
return
|
||||
fi
|
||||
|
||||
grow_mbrpart "${resize_disklabel_disk}"
|
||||
grow_disklabel "${resize_disklabel_disk}" "${resize_disklabel_part}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue