]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/partitionusb
Update
[bacula/rescue] / rescue / linux / usb / partitionusb
1 #!/bin/sh
2 #
3 # Partition the USB stick -- the stick is assumed to be at least 3GB in size
4 #
5 # First delete all existing partitions
6 #
7
8 if [ ! `whoami` = "root" ] ; then
9   echo ""
10   echo "You need to be root to run this shell script"
11   echo ""
12   exit 1
13 fi
14 if [ "x$USB_DEVICE" = "x" ] ; then
15   if [ "x$1" = "x" ] ; then
16      echo "You must supply the USB device name on the command line or in USB_DEVICE"
17      exit 1
18   else
19      dev=$1
20   fi
21 else
22   dev=$USB_DEVICE
23 fi
24 echo "This script will distroy everything on $dev"
25 echo "Answer yes to continue "
26 read a
27 if [ "$a" != "yes" ] ; then
28   echo "Device $dev unchanged"
29   exit 1
30 fi
31
32 fdisk $dev <<EOF
33 d
34 4
35 d
36 3
37 d
38 2
39 d
40 1
41 n
42 p
43 1
44
45 +900M
46 t
47 1
48 6
49 a
50 1
51 n
52 p
53 2
54
55 +1000M
56 n
57 p
58 3
59
60
61 p
62 w
63 EOF
64 umount ${dev}1
65 mkfs.vfat -F 16 -n kubuntu8 ${dev}1
66 umount ${dev}2
67 mkfs.ext2 -j -b 4096 -L casper-rw ${dev}2
68 umount ${dev}3
69 mkfs.ext2 -j -b 4096 -L home-rw ${dev}3
70 sync