Permalink
Browse files

Make textdump work:

 - Use first swap partition for dumping.  On crash, the system will
   be able to override GELI provider and write directly on the
   underlying device.

 - When the system runs ix-fstab for the first time, do a fsck and
   mount /data read-write.  If there is any crash dump available,
   save it before proceeding to do swap, etc.
  • Loading branch information...
1 parent 67c20f7 commit 5ea1a9128e0fb825f9b3ec1f6196755868add022 @delphij delphij committed Jun 28, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 nanobsd/Files/etc/rc.d/ix-fstab
@@ -75,6 +75,9 @@ generate_fstab_swap()
devname=$(/usr/local/bin/python /usr/local/www/freenasUI/middleware/notifier.py swap_from_diskid "${diskid}")
if [ -c "/dev/${devname}" ]; then
echo "/dev/${devname}.eli none swap sw 0 0"
+ if [ ! -L /dev/dumpdev ]; then
+ /sbin/dumpon /dev/${devname} && ln -sf /dev/${devname} /dev/dumpdev
+ fi
fi
done
}
@@ -83,15 +86,20 @@ generate_fstab()
{
local _doumount=0
- # If we're running really early, then mount /data read-only
+ # Running early: check and mount /data, then try to get a crashdump
if [ ! -f ${FREENAS_CONFIG} ]; then
- mount -o ro /data
+ fsck -fy /data
+ mount /data
_doumount=1
fi
cp /conf/base/etc/fstab /etc/fstab
generate_fstab_real >> /etc/fstab
generate_fstab_swap >> /etc/fstab
if [ "${_doumount}" -eq 1 ]; then
+ if savecore -C /dev/dumpdev > /dev/null; then
+ savecore ${savecore_flags} ${dumpdir} /dev/dumpdev
+ /usr/sbin/crashinfo -d ${dumpdir}
+ fi
umount /data
fi
}

0 comments on commit 5ea1a91

Please sign in to comment.