]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/partition_usb_key
6ef9bb459da3bb9754d6ab2ee3d5bb5f008fac88
[bacula/rescue] / rescue / linux / usb / partition_usb_key
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 . ./config
8
9 if [ ! `whoami` = "root" ] ; then
10   echo ""
11   echo "You need to be root to run this shell script"
12   echo ""
13   exit 1
14 fi
15 if [ "x$USB_DEV" = "x" ] ; then
16   if [ "x$1" = "x" ] ; then
17      echo "You must supply the USB device name on the command line or in USB_DEV"
18      exit 1
19   else
20      USB_DEV=$1
21   fi
22 fi
23 echo "This script will distroy everything on $dev"
24 fdisk -l $USB_DEV
25 echo " "
26 echo "Answer yes to continue "
27 read a
28 if [ "$a" != "yes" ] ; then
29   echo "Device $USB_DEV unchanged"
30   exit 1
31 fi
32
33 fdisk $USB_DEV <<EOF
34 d
35 4
36 d
37 3
38 d
39 2
40 d
41 1
42 n
43 p
44 1
45
46 +750M
47 t
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 ${USB_DEV}1
65 mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1
66 umount ${USB_DEV}2
67 mkfs.ext2 -j -b 4096 -L casper-rw ${USB_DEV}2
68 umount ${USB_DEV}3
69 mkfs.ext2 -j -b 4096 -L home-rw ${USB_DEV}3
70 sync