Creating a super-pendrive


Its been really long since I blogged. Before going ahead, want to tell you that will be posting my endeavours on running virtual machines soon.

This, however, is my experience/guide for creating a super pen drive (a.k.a. a usb disk that if booted from presents a grub menu with options – GParted, Fedora, .. and any other linux distro hopefully, and has Fedora persistence, and has a spare partition too for you to use it as a normal pen drive).

It wasn’t as straight forward as I thought (like… all other things).


  1. Decide the partitioning layout and partition the pen drive.
  2. Install grub on one partition
  3. Install GParted on another
  4. Install Fedora on another
  5. Install grub again on the partition in step 2 :P, and setup grub.conf
  6. Sit back, and enjoy (may need to crouch forward in some cases.. )

A super neat trick:

To check at any time how you pen drive would behave if you boot from it, use the command : qemu -hda /dev/sdb -m 256 -vga std

This command reduced my research time to one third.

1) Decide the partitioning layout

I used GParted on my Fedora installation (on my harddisk) to set up the partition of the pen drive.

2) Install grub on one partition

Make sure you manually mount the grub partition. The /media/something folder in which it gets mounted automatically gave me some trouble. So unmounted it from there, and mounted /dev/sdb5 to /mnt/usbgrub

grub-install –no-floppy –root-directory=/mnt/usbgrub/ /dev/sdb

3) Install GParted on another

Use UNetbootin for GParted

4) Install Fedora on another

Need to make sure that usb disk is ext3 before doing this. When I did this on a vfat disk, I got an “error 22″ when trying to boot from the usb disk.

Use liveusb-creator or live-iso-to-disk for Fedora.

Persistence is buggy according to so instead, a better solution is to directly install fedora on the pen drive on a separate partition, like in

5) Install grub again on the partition in step 2 :P, and setup grub.conf

mount /dev/sdb5 /mnt/usbgrub/

grub-install –no-floppy –root-directory=usbgrub/ /dev/sdb

Now, to setup the grub menu:

cd /mnt/usbgrub/boot/grub/

cp /boot/grub/grub.conf .

cp /boot/grub/splash.xpm.gz .

gedit grub.conf

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/mapper/VGSahil-LVRoot
#          initrd /initrd-version.img
title Fedora (
root (hd1,1)
kernel /vmlinuz- ro root=/dev/mapper/VGSahil-LVRoot rhgb quiet
initrd /initrd-

title GParted Live
root (hd0,5)
kernel /live/vmlinuz1 boot=live union=aufs    noswap noprompt acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia vga=normal
initrd /live/initrd1.img

title Omega 11 Live
root (hd0,6)
kernel /syslinux/vmlinuz0 root=/dev/sdb7  rw liveimg quiet  rhgb
initrd /syslinux/initrd0.img

About these ads

2 Responses to “Creating a super-pendrive”

  1. 1 Fifi April 10, 2010 at 11:54 pm

    I have a problem to install Grub on my pendrive.
    Here is the result of the command fdisk -l :
    Disque /dev/sdg: 8019 Mo, 8019509248 octets
    255 têtes, 63 secteurs/piste, 974 cylindres
    Unités = cylindres de 16065 * 512 = 8225280 octets
    Identifiant de disque : 0×04030201

    Périphérique Amorce Début Fin Blocs Id Système
    /dev/sdg1 1 51 409626 83 Linux
    /dev/sdg2 52 306 2048287+ 83 Linux
    /dev/sdg3 * 307 561 2048287+ 83 Linux
    /dev/sdg4 562 974 3317422+ 5 Etendue
    /dev/sdg5 562 657 771088+ 83 Linux
    /dev/sdg6 658 974 2546271 7 HPFS/NTFS
    I want to install Grub on sdg1.
    So i mount sdg1 on /mnt/usbgrub with the command : mount /dev/sdg1 /mnt/usbgrub/
    Then i run the command : grub-install –no-floppy –root-directory=usbgrub/ /dev/sdg
    but i have this result :
    [root@Fifi ~]# grub-install –no-floppy –root-directory=usbgrub/ /dev/sdg
    More than one install_devices?
    Usage: grub-install [OPTION] install_device
    Install GRUB on your drive.

    -h, –help print this message and exit
    -v, –version print the version information and exit
    –root-directory=DIR install GRUB images under the directory DIR
    instead of the root directory
    –grub-shell=FILE use FILE as the grub shell
    –no-floppy do not probe any floppy drive
    –force-lba force GRUB to use LBA mode even for a buggy
    –recheck probe a device map even if it already exists
    This flag is unreliable and its use is
    strongly discouraged.

    INSTALL_DEVICE can be a GRUB device name or a system device filename.

    grub-install copies GRUB images into the DIR/boot directory specfied by
    –root-directory, and uses the grub shell to install grub into the boot

    Report bugs to .
    Coul you help me ?

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


Get every new post delivered to your Inbox.

%d bloggers like this: