Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Wednesday, March 23, 2011

Script to take MBR backup

xxxxxxxxxxxx BASH To Take MBR BAckup -- Shirish Shukla xxxxxxxxxxxxx

#!/bin/bash
hdds=$(echo /dev/[hs]d?)

for hdd in $hdds
do
      ## take only last name of dir
        base=$(basename $hdd)
      ##take MBR Backup 0-512 bytes
        dd if=$hdd of=/tmp/$base.mbr count=1 bs=512
 echo $hdd
done


4 comments:

  1. ### read multiple file at a time
    exec 7<$1
    exec 8<$2
    #for [[ read ln1 <&7 && read ln2 <&8 ]]
    while read ln1 <&7 && read ln2 <&8
    #`cat $2`
    #while IFS=" " read ln1 <&`cat $1`
    do
    echo $ln1
    echo $ln2
    done
    -- Shirish

    ReplyDelete
  2. it is top linux side i had surfed ever

    ReplyDelete

Write Here .. your comments are always wellcome ..but no spam please !!

Followers

Pls LIKE my Story !!!