2013-Jun-16, Sunday

Conveniently timed to my previous entry I recently upgraded my laptop to Debian Wheezy. This involved redoing my backup boot drive to contain bootloader updates, so I can detail the process I used.

Partition the USB drive

Use whatever partition manager you're comfortable with. cfdisk, fdisk, gparted, whatever.

# cfdisk /dev/sdb

If you want to use the USB stick on Windows normally, note that Windows will only see the first partition of a thumbdrive. This is great for hiding the fact it's a bootable drive!

# fdisk -lu /dev/sdb
Sector size (logical/physical): 512 bytes / 512 bytes
/dev/sdb18064142598157125876bW95 FAT32

Don't start the first partition at the very beginning. Here I've got it started about 4k in. This gap is important: grub will install itself into the gap--if there isn't enough room, grub won't install.

You'll also notice that I've allocated 512MB to what will become /boot (sdb2). This is serious overkill, but also means I don't have to be particularly cautious about uninstalling old kernel versions to avoid running out of room.

Format the Partitions

Naturally, we should format these partitions:

# mkfs -t vfat /dev/sdb1
# mkfs -t ext3 /dev/sdb2

Install grub

Then mount our soon-to-be /boot drive into /boot (if you're familiar with grub-install, you can mount it elsewhere):

# mount /dev/sdb2 /boot

And install grub:

# grub-install /dev/sdb

Naturally, your next step should be to test that it boots. And maybe even test that it appears as a normal thumbdrive on a Windows computer.

When Doing a Fresh Install

NB: This is from-memory. I have not done this recently.

If you're doing a fresh install, partition the USB drive from another computer. Make sure the thumbdrive is plugged in during the install process, and when configuring drive partitions and directory locations, simply select /dev/sdb2 (or whichever is appropriate for the USB drive's second partition) as the device on to which to put /boot.

May 2017

14 151617181920

Most Popular Tags