Documenting Problems That Were Difficult To Find The Answer To

Moving Linux Boot Partition to USB Drive

I have a Xubuntu (Ubuntu) Precise 12.04.3 LTS (long term support) installation on two hard drives, each encrypted using cryptsetup (LUKS) and then mirrored using mdadm.

To date I’ve had a separate /boot partition on each magnetic spinning disk. However I wished to move that /boot partition to USB drive so I wouldn’t need to rely on booting from magnetic disk anymore.

These are the steps I took to copy the /boot partition from my existing partition (/dev/sda2) onto a new partition on a USB flash drive (/dev/sdc).

In this example I took a USB stick (8GB in size) and created a 512 megabyte boot partition formatted in ext4 (/dev/sdc1) and also created a FAT32/VFAT partition with the rest of the space on the USB drive.

Partition USB Stick

fdisk /dev/sdc (assume sdc is USB stick)

d (delete partition)

n (new partition)
  p (primary)
    1 (partition number 1)
      [enter] (first sector, default 2048)
      +512M (last sector)
a (toggle bootable flag)
  1 (parition number 1)
n (new partition)
  p (primary)
    2 (partition number 2)
      [enter] (first sector, default 1050624)
      [enter] (last sector, whole of disk)
t (change parition type)
  2 (partition number 2)
    c (W95 FAT32 LBA)
w (write partition table to disk)

Format Partitions

mkfs.ext4 -L "usb_boot" /dev/sdc1
mkfs.vfat -n "USB_FAT32" /dev/sdc2

Copy Existing Boot

mkdir /mnt/sdc1
mount /dev/sdc1 /mnt/sdc1 -t ext4
rsync -avP /boot/* /mnt/sdc1/

Install Grub

cat /boot/grub/
grub-install --recheck --debug /dev/sdc


shutdown -r now

See Also

2 responses to “Moving Linux Boot Partition to USB Drive

  1. #359 January 14, 2016 at 8:55 am

    thank you for a great explenation! this was the only manual that actually worked for me to move my /boot partition to USB.

    however, in the section “Install Grub” i had to use “grub-mkdevicemap” first, since file doesn’t exist in the latest Ubuntu versions (15.10).

    still i have a problem/question: i don’t want to have a second FAT32/VFAT partition on the USB where the /boot is. i want the rest of the space on USB to be to be unallocated to maybe (if in need) later format it as a Truecrypt partition. but whatever i tried, my computer couldn’t boot if the USB wasn’t partitioned EXACTLY how you described. if i changed second partition to cleared, unformatted, even EXT4, my computer couldn’t boot from USB – the first partition was only described as UEFI (and thus bootable) if there was also a second FAT32/VFAT partition present.

    do you have any suggestion how to solve this problem. thanks!

  2. #359 January 20, 2016 at 8:07 am

    after the latest Ubuntu kernel updates i figured that the above solution actually haven’t worked for me. i started my computer by booting from USB where i put my /boot partition according to the instructions above but when i installed the kernel updates with apt-get they went directly to the old /boot location on my hard disk and not to /mnt/sdb1

    i tested this by rebooting my computer from USB. the grub UI offered me the new kernel image that wasn’t on my USB but on the old /boot on hard disk so i’m sure that somehow i don’t boot from USB.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: