All pastes #394205 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-14 03:17 UTC
rendered paste body
#/bin/bash

#make sure usb drives are unmounted
umount /dev/sdb1 &&
true && echo "unmounting /dev/sdb1..." &&
umount /dev/sdb2 &&
echo "unmounting /dev/sdb2..." &&
umount /dev/sdb3 &&
echo "unmounting /dev/sdb3..." &&
umount /dev/sdb4 &&
echo "unmounting /dev/sdb4..." &&

#1. zero out mbr: 
dd if=/dev/zero bs=512 skip=1 count=62 of=/dev/sdb &&
echo "zeroed out mbr on /dev/sdb ..." &&

#2. write out new mbr: 
dd if=100.mbr of=/dev/sdb bs=512 count=100 &&
echo "recreated mbr on /dev/sdb ..." &&

#3. mkfs partitions
mkfx.ext3 /dev/sdb1 &&
echo "formated /dev/sdb1 as ext3 ..." &&

mkfx.ext3 /dev/sdb3 &&
echo "formated /dev/sdb3 as ext3 ..." &&

mkfx.ext3 /dev/sdb4 &&
echo "formated /dev/sdb4 as ext3 ..." &&

#4. set /sdb2 to swap area
mkswap /dev/sdb2 &&
echo "set /dev/sdb2 as swap area ..."

#5. image back partitions
#partimage restore /dev/sdb1 1.partition-root-10gb.000
#partimage restore /dev/sdb3 2.partition-var-5gb.000
#partimage restore /dev/sdb4 3.partition-home-10gb.000