All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit f8533dad authored by David Johnson's avatar David Johnson

Add GPT support to Linux slicefix.

This replaces the hardcoded partition length-based detection of which
MBR "version" is on disk, when deciding whether or not to rewrite the
MBR/GPT.  Now we just check the cited MBR/GPT version file, and use that
length to compare the first partition length.

We also prefer partprobe if it's available, rather than fdisk, for
forcing a rescan of the disk partition tables.
parent 3187f1e1
This diff is collapsed.
......@@ -490,7 +490,11 @@ dofreebsd() {
fsopts=ro
elif [ $OS = Linux ]; then
echo "Reloading partition table for $disk..."
echo w | /sbin/fdisk /dev/$disk > /dev/null 2>&1
if [ -x /usr/sbin/partprobe ]; then
/usr/sbin/partprobe $disk > /dev/null 2>&1
else
echo w | /sbin/fdisk /dev/$disk > /dev/null 2>&1
fi
rootdev=/dev/`$BINDIR/check_disklabel $disk $part`
[ "$rootdev" = /dev/ ] && exit 1
fstype=ufs
......@@ -1071,7 +1075,13 @@ fixone() {
ptype=`fdisk -${part} ${disk} | grep sysid | sed 's/^sysid \([0-9][0-9]*\).*/\1/'`
elif [ $OS = Linux ]; then
echo "*** ${disk}${part}:"
ptype=`fdisk -l /dev/$disk | awk /${disk}${part}/'{sub(/\*/,""); print "0x"$5}'`
fdisk -l /dev/$disk | grep -qi 'found valid gpt'
if [ $? -eq 0 ]; then
# gdisk output converts the gpt partition ID to, e.g., 8300.
ptype=`gdisk -l /dev/$disk | awk "/^ *${part} / {print \\$6}"`
else
ptype=`fdisk -l /dev/$disk | awk /${disk}${part}/'{sub(/\*/,""); print "0x"$5}'`
fi
fi
ptype=${ptype:-0}
......@@ -1080,7 +1090,7 @@ fixone() {
dofreebsd
return $?
;;
131|0x83)
131|0x83|8300)
dolinux
return $?
;;
......
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