]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/oldusb/partition_usb_key
Move usb to oldusb
[bacula/rescue] / rescue / linux / oldusb / partition_usb_key
diff --git a/rescue/linux/oldusb/partition_usb_key b/rescue/linux/oldusb/partition_usb_key
new file mode 100755 (executable)
index 0000000..6af5f5e
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# Partition the USB stick -- the stick is assumed to be at least 3GB in size
+#
+# First delete all existing partitions
+#
+. ./config
+
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this shell script"
+  echo ""
+  exit 1
+fi
+if [ "x$USB_DEV" = "x" ] ; then
+  if [ "x$1" = "x" ] ; then
+     echo "You must supply the USB device name on the command line or in USB_DEV"
+     exit 1
+  else
+     USB_DEV=$1
+  fi
+fi
+echo "This script will distroy everything on $dev"
+fdisk -l $USB_DEV
+echo " "
+echo "Answer yes to continue "
+read a
+if [ "$a" != "yes" ] ; then
+  echo "Device $USB_DEV unchanged"
+  exit 1
+fi
+sfdisk -l $USB_DEV >original-partitioning.txt
+fdisk $USB_DEV <<EOF
+d
+4
+d
+3
+d
+2
+d
+1
+n
+p
+1
+
+${SIZE_PART1}
+t
+6
+a
+1
+n
+p
+2
+
+${SIZE_PART2}
+n
+p
+3
+
+
+p
+w
+EOF
+umount ${USB_DEV}1
+mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1
+umount ${USB_DEV}2
+mkfs.ext3 -j -b 4096 -L casper-rw ${USB_DEV}2
+# Do fs checking every 100 mounts or 360 days
+tune2fs -c 100 -i 360 ${USB_DEV}2
+umount ${USB_DEV}3
+mkfs.ext3 -j -b 4096 -L home-rw ${USB_DEV}3
+tune2fs -c 100 -i 360 ${USB_DEV}3
+sync
+
+echo "New partitioning is:"
+fdisk -l ${USB_DEV}