Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/embedded/files Grow the MBR partition table en...
details: https://anonhg.NetBSD.org/src/rev/7c24bb0846c3
branches: trunk
changeset: 352919:7c24bb0846c3
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Apr 14 13:47:21 2017 +0000
description:
Grow the MBR partition table entry for the BSD partition before
growing the disklabel.
diffstat:
distrib/utils/embedded/files/resize_disklabel | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diffs (50 lines):
diff -r face23af3924 -r 7c24bb0846c3 distrib/utils/embedded/files/resize_disklabel
--- a/distrib/utils/embedded/files/resize_disklabel Fri Apr 14 10:02:49 2017 +0000
+++ b/distrib/utils/embedded/files/resize_disklabel Fri Apr 14 13:47:21 2017 +0000
@@ -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 @@
/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 @@
return
fi
+ grow_mbrpart "${resize_disklabel_disk}"
grow_disklabel "${resize_disklabel_disk}" "${resize_disklabel_part}"
}
Home |
Main Index |
Thread Index |
Old Index