fsck the destination boot partition after dd

This commit is contained in:
Bill Wilson
2014-03-18 12:39:22 -05:00
parent d10b873d2f
commit eb7721e0ea

View File

@@ -27,11 +27,22 @@ if ! rsync --version > /dev/null
then
echo -e "\nOoops! rpi-clone needs the rsync program but cannot run it."
echo "Make sure rsync is installed:"
echo " $ apt-get update"
echo -e " $ apt-get install rsync\n"
echo " $ sudo apt-get update"
echo -e " $ sudo apt-get install rsync\n"
exit 0
fi
if test -e /sbin/fsck.vfat
then
HAVE_FSCK_VFAT="yes"
else
echo "[Note] fsck.vfat was not found."
echo "It is recommended to install dosfstools:"
echo " $ sudo apt-get update"
echo " $ sudo apt-get install dosfstools"
fi
usage()
{
echo ""
@@ -250,8 +261,17 @@ then
echo ""
echo "Imaging the partition structure, copying $DD_COUNT megabytes..."
sync
dd if=/dev/mmcblk0 of=/dev/$DST_DISK bs=1M count=$DD_COUNT
# Partition was copied live so fsck to clean up for possible future
# "Volume was not properly unmounted" warnings.
if [ "$HAVE_FSCK_VFAT" = "yes" ]
then
echo "Running fsck on $DST_BOOT_PARTITION..."
fsck -p $DST_BOOT_PARTITION &> /dev/null
fi
# But, though Partion 1 is now imaged, partition 2 is incomplete and
# maybe the wrong size for the destination SD card. So fdisk it to
# make it fill the rest of the disk and mkfs it to clean it out.