Some issues with the clone script
Posted: Sat Oct 18, 2008 12:21 am
Its failure modes aren't really very good.
For instance, if the system doesn't recognize that the /dev/sdb device is not available, it will copy the entire /data partition over to /mnt on the root filesystem of the main memory stick, potentially filling it up and wedging things.
The clone script should, at least, check to be sure that the mount of /dev/sdb3 onto /mnt succeeded, perhaps by parsing the /etc/fstab or df output, before proceeding with the tar.
Better yet, it should check if /dev/sdb is actually attached before doing anything.
Also, it'd be useful if the clone function could use /usr/bin/logger or some such to provide some more detailed information on how the clone process is working at each step of the way.
Also, there appears to be two copies of the /data:
(/bin/dd if=/dev/sda1 of=/dev/sdb1 bs=1M;
/bin/mount /dev/sdb3 /mnt;
cd /data;
/bin/tar cplf - . | (cd /mnt; /bin/tar xfp -);
/bin/tar cplf - . | (cd /mnt; /bin/tar xfp -);
/sbin/shutdown -h now)&
Why is this?
For instance, if the system doesn't recognize that the /dev/sdb device is not available, it will copy the entire /data partition over to /mnt on the root filesystem of the main memory stick, potentially filling it up and wedging things.
The clone script should, at least, check to be sure that the mount of /dev/sdb3 onto /mnt succeeded, perhaps by parsing the /etc/fstab or df output, before proceeding with the tar.
Better yet, it should check if /dev/sdb is actually attached before doing anything.
Also, it'd be useful if the clone function could use /usr/bin/logger or some such to provide some more detailed information on how the clone process is working at each step of the way.
Also, there appears to be two copies of the /data:
(/bin/dd if=/dev/sda1 of=/dev/sdb1 bs=1M;
/bin/mount /dev/sdb3 /mnt;
cd /data;
/bin/tar cplf - . | (cd /mnt; /bin/tar xfp -);
/bin/tar cplf - . | (cd /mnt; /bin/tar xfp -);
/sbin/shutdown -h now)&
Why is this?