Better Bookmarks, Plain and Simple.
Jeteye helps you create libraries of bookmarks called Jetpaks®.
Make Jetpaks for yourself, research & collaborate with friends, or share with the world.
A Public Jetpak® by yichenye

shell,cmd,ref


How to make a GRUB_II USB



How to make a GRUB_II USB


GRUB 2 could be very handy in a USB. You can use it for an emergency boot disk.
You can play with it and use it for  doing interesting experiments with to learn more about GRUB without compromising your real GRUB. It's okay to edit the grub.cfg directly when GRUB 2 isn't part of an operating system.

1. Choose an USB drive with at least about 60 MiB of space in the partition for grub 2 files, but a little more room than that might be advisable. It can be formated with any file system, it doesn't mattter if there are already some files in it.

2. Plug in your USB drive  while Ubuntu is running, it should be automatically mounted in a few seconds and an icon should appear for it on your desktop.

3.  Find out what is the real mount point name, (if you don't already know), this step is important because the actual mount point in /media can have another name than the name you see for the icon on your Desktop.
Code:
ls /media/

example output
cdrom  cdrom0  Verbatim
The resulting feedback shows that my USB drive's file system is mounted as /media/Verbatim, because it has 'Verbatim' set as the freindly file system label.
If yours comes up as a file system UUID number, I recommend you set your own user freindly file system label to make things easier for yourself now and in the future. How To Set File System Labels With GParted.

5. Find out what is the /dev/number for the file system (or partition),
sudo blkid

example output
sudo blkid
/dev/sda1: LABEL="ACER" UUID="320D-180E" TYPE="vfat"
/dev/sda2: LABEL="ACERDATA" UUID="04A6-B8C3" TYPE="vfat"
/dev/sda5: LABEL="KARMIC" UUID="53640b23-7f97-46a7-b939-b5aedd5097c1" TYPE="ext4"
/dev/sda6: UUID="88115692-4578-47b5-89ae-dcc3720d95e4" TYPE="swap"
/dev/sdb1: LABEL="Verbatim" UUID="1fdc26cf-43ad-40b9-95fa-6d64196513f2" TYPE="reiserfs"
Here you can see that the target file system in my USB disk is called 'Verbatim' and it is listed as /dev/sdb1.

6. Run grub-install ,
sudo grub-install --root-directory=/media/verbatim /dev/sdb
Where: the mount point is /media/verbatim
Where: The MBR to install GRUB to is /dev/sdb (the USB drive).
NOTE: I didn't install GRUB to /dev/sdb1, because that's the partition boot sector. I need GRUB in the USB disk's MBR, which is called /dev/sdb in this case, since the partition is /dev/sdb1.

Watch the thumb drive's LED blink for a few seconds.

Now you have a bootable GRUB 2 USB Rescue disk.

But it has no grub.cfg

7. Run grub-mkconfig
sudo grub-mkconfig -o /media/Verbatim/boot/grub/grub.cfg

8. Relax the file permissions to make it easily editable from GUI mode, (user freindly).
Let's make it editable so we can play with it.
sudo chmod 777 -R /media/verbatim /boot

Now we can open it in GUI mode even if we want and edit the grub.cfg file to our heart's content.


Links:
Use cases - Ubuntu 8.10 on USB device - GRUB Wiki

How to add GRUB to your USB thumb drive - (GRUB Legacy)