[PC-BSD Commits] r4091 - pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts
svn at pcbsd.org
svn at pcbsd.org
Wed Jun 10 12:21:19 PDT 2009
Author: kris
Date: 2009-06-10 12:21:18 -0700 (Wed, 10 Jun 2009)
New Revision: 4091
Modified:
pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh
Log:
Some fixes for ZFS upgrades. We need to be careful how we copy /boot around, since our zfs cache data lives there.
Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh 2009-06-10 18:56:06 UTC (rev 4090)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh 2009-06-10 19:21:18 UTC (rev 4091)
@@ -169,38 +169,36 @@
BASENAME="`echo $ZFSROOT | cut -d '/' -f 3`"
ZFSBOOTPART="`cat /uzip/ZFS-bootpart`"
- if [ ! -e "/tmp/upgradeZFS" ]
- then
- # Setup our loader.conf entries for ZFS
- echo 'zfs_load="YES"' >> ${FSMNT}/boot/loader.conf
- echo "vfs.root.mountfrom=\"zfs:${BASENAME}/root\"" >> ${FSMNT}/boot/loader.conf
- echo 'vm.kmem_size="512M"' >>${FSMNT}/boot/loader.conf
- echo 'vm.kmem_size_max="512M"' >>${FSMNT}/boot/loader.conf
+ # Setup our loader.conf entries for ZFS
+ echo 'zfs_load="YES"' >> ${FSMNT}/boot/loader.conf
+ echo "vfs.root.mountfrom=\"zfs:${BASENAME}/root\"" >> ${FSMNT}/boot/loader.conf
+ echo 'vm.kmem_size="512M"' >>${FSMNT}/boot/loader.conf
+ echo 'vm.kmem_size_max="512M"' >>${FSMNT}/boot/loader.conf
- # Enable zfs in /etc/rc.conf
- echo 'zfs_enable="YES"' >> ${FSMNT}/etc/rc.conf
+ # Enable zfs in /etc/rc.conf
+ echo 'zfs_enable="YES"' >> ${FSMNT}/etc/rc.conf
+ if [ ! -e "/tmp/upgradeZFS" ]
+ then
# Copy over the /etc/hostid from our install CD to the HD
cp /etc/hostid ${FSMNT}/etc/hostid
-
- # Reset our mount points for any extra ZFS partitions
- cd /uzip/zfsmnts/
- for i in `ls`
- do
- # Only set the mounts on partitions besides root
- if [ "${i}" != "${BASENAME}" ]
- then
- zfs set mountpoint=`cat ${i}` ${i}`cat ${i}`
- umount `cat ${i}`
- fi
- done
-
+ else
+ # Lets save the ZFS cache data
+ mkdir /uzip/zfs-save
+ mv ${FSMNT}/bootdir/zfs /uzip/zfs-save/
fi
# Move the kernel to /bootdir so we can bootup properly
rm -rf ${FSMNT}/bootdir/boot >/dev/null 2>/dev/null
mv -f ${FSMNT}/boot ${FSMNT}/bootdir/
+
+ if [ -e "/tmp/upgradeZFS" ]
+ then
+ # Copy back the saved ZFS cache data
+ rm -rf ${FSMNT}/bootdir/boot/zfs >/dev/null 2>/dev/null
+ mv /uzip/zfs-save/zfs ${FSMNT}/bootdir/
+ fi
# Create our link to /boot on the ZFS partition
ln -s /bootdir/boot ${FSMNT}/boot
@@ -217,18 +215,23 @@
# Unmount the root partition
umount ${FSMNT}
- # Set our root partition that it needs not be automounted
- zfs set mountpoint=legacy ${BASENAME}/root
+ # If we are not doing an upgrade, lets copy over the cache data this time
+ if [ ! -e "/tmp/upgradeZFS" ]
+ then
+ # Set our root partition that it needs not be automounted
+ zfs set mountpoint=legacy ${BASENAME}/root
- # Remount the bootdir to /mnt
- mount ${ZFSBOOTPART} ${FSMNT}
+ # Remount the bootdir to /mnt
+ mount ${ZFSBOOTPART} ${FSMNT}
- # Copy over our ZFS cache data
- cp /boot/zfs/* ${FSMNT}/boot/zfs/
+ # Copy over our ZFS cache data
+ cp /boot/zfs/* ${FSMNT}/boot/zfs/
- # Unmount the /bootdir partition again
- umount ${FSMNT}
+ # Unmount the /bootdir partition again
+ umount ${FSMNT}
+ fi
+
else
# We are not using ZFS, finish the unmounting now
More information about the Commits
mailing list