From 6a4ea132ac61a74e6c066d44cdb077ec47164d4b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 6 Mar 2008 19:35:47 -0500 Subject: [PATCH] Fixes to avoid problems on VFAT usb sticks If we're using a VFAT formatted stick, don't allow an overlay > 2 GB to avoid corruption. Also, VFAT doesn't really allow for sparse files and the kernel gets unhappy when you try to make one. --- tools/livecd-iso-to-disk.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 00465e3..5aeeca7 100644 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -197,6 +197,11 @@ checkPartActive $USBDEV checkMBR $USBDEV [ -n $resetmbr ] && resetMBR $USBDEV +if [ -n "$overlaysizemb" -a "$USBFS" = "vfat" -a "$overlaysizemb" -gt 2047 ]; then + echo "Can't have an overlay greater than 2048MB on VFAT" + exitclean +fi + # FIXME: would be better if we had better mountpoints CDMNT=$(mktemp -d /media/cdtmp.XXXXXX) mount -o loop $ISO $CDMNT || exitclean @@ -238,8 +243,12 @@ sed -i -e "s/CDLABEL=[^ ]*/$USBLABEL/" -e "s/rootfstype=[^ ]*/rootfstype=$USBFS/ if [ -n "$overlaysizemb" ]; then echo "Initializing persistent overlay file" OVERFILE="overlay-$( /lib/udev/vol_id -l $USBDEV )-$( /lib/udev/vol_id -u $USBDEV )" - dd if=/dev/null of=$USBMNT/LiveOS/$OVERFILE \ - count=1 bs=1M seek=$overlaysizemb + if [ "$USBFS" = "vfat" ]; then + # vfat can't handle sparse files + dd if=/dev/zero of=$USBMNT/LiveOS/$OVERFILE count=$overlaysizemb bs=1M + else + dd if=/dev/null of=$USBMNT/LiveOS/$OVERFILE count=1 bs=1M seek=$overlaysizemb + fi sed -i -e "s/liveimg/liveimg overlay=${USBLABEL}/" \ $USBMNT/$SYSLINUXPATH/isolinux.cfg sed -i -e "s/\ ro\ /\ rw\ /" \ -- 2.11.4.GIT