Hi, On Sat, July 30, 2011 6:40 am, Camaleón wrote: >>>> One of my (home made) overnight cron jobs does this: >>>> >>>> dd if=/dev/sda \ >>>> of=$DST/mbr_backup.bin \ >>>> bs=512 \ >>>> count=1 >> $LOG 2>&1
Okay, well this script isn't perfect and it sure won't help after the problem, but it will save all possible MBRs and fdisk output for a bunch of candidate disks: #!/bin/bash AWK=/usr/bin/awk BASENAME=/usr/bin/basename CAT=/bin/cat DD=/bin/dd FDISK=/sbin/fdisk GREP=/bin/grep LS=/bin/ls SORT=/usr/bin/sort TEE=/usr/bin/tee SAVE_MBR_DIR=/backup/mbr-save SAVE_FDISK_DIR=/backup/fdisk-save function save_mbr () { CMD="$DD if=/dev/$DRV \ of=$SAVE_MBR_DIR/mbr_backup_${DRV}.bin \ bs=512 \ count=1" echo $CMD eval $CMD echo } function save_fdisk () { OUTFILE=$SAVE_FDISK_DIR/fdisk_backup_${DRV}.out CMD="$FDISK -l /dev/$DRV > $OUTFILE" echo $CMD eval $CMD echo $CAT $OUTFILE echo "======================" echo } ( if [ ! -d $SAVE_MBR_DIR ]; then mkdir -p $SAVE_MBR_DIR; fi if [ ! -d $SAVE_FDISK_DIR ]; then mkdir -p $SAVE_FDISK_DIR; fi for DRV in $($LS -lart /dev/disk/by-id/|$GREP -e \/sd[a-f]$ -e \/hd[a-f]$|$AWK -F \/ '{print $NF}'|$SORT -u) do save_mbr save_fdisk done ) 2>&1 |$TEE /var/log/$($BASENAME $0).out -- Kind Regards AndrewM Andrew McGlashan Broadband Solutions now including VoIP -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/bb61793e91c4d0e511b3c7829bd8fb54.squir...@www.affinityvision.com.au