Grub installation on a USB external disk
antonio montagnani
antonio.montagnani at gmail.com
Tue Sep 25 09:40:04 UTC 2007
2007/9/25, antonio montagnani <antonio.montagnani at gmail.com>:
> I am running Fedora 7 on an external USB disk.
> As my old laptop didn't boot out of an USB port, I didn't install
> Grub, and tanks to the help of John Austin I was able to create a boot
> CD, by using this script:
>
> #!/bin/bash
> #create_grub_cd
> #Create an enpty file floppy sized
> dd if=/dev/zero of=fd_file bs=512 count=2880
> #Write an MSDOS file system to the file
> mkfs -t msdos fd_file
> #Mount the file as a loopback device (/dev/loop0 by default)
> mount -o loop fd_file /mnt/zip
> #Create the directory structure for grub
> mkdir /mnt/zip/boot
> mkdir /mnt/zip/boot/grub
> #Copy the essential grub files
> cp /usr/share/grub/i386-redhat/* /mnt/zip/boot/grub
> #Create a prototype grub.conf file
> cat > /mnt/zip/boot/grub/grub.conf<<END_OF_CONF
> timeout=10
> default=0
> title FC7 2.6.22.5-76.fc7 14/9/2007
> kernel (hd1,0)/vmlinuz-2.6.22.5-76.fc7 ro root=/dev/VolGroup00/LogVol00
> initrd (hd1,0)/initrd-2.6.22.5-76.fc7.img
> title FC7 2.6.22.1-65.fc7 27/8/2007
> kernel (hd1,0)/vmlinuz-2.6.22.4-65.fc7 ro root=/dev/VolGroup00/LogVol00
> initrd (hd1,0)/initrd-2.6.22.4-65.fc7.img
> title FC7 2.6.22.1-27.fc7 21/7/2007
> kernel (hd1,0)/vmlinuz-2.6.22.1-27.fc7 ro root=/dev/VolGroup00/LogVol00
> initrd (hd1,0)/initrd-2.6.22.1-27.fc7.img
>
> #title Windows
> # rootnoverify (hdx,y)
> # chainloader +1
> END_OF_CONF
> #Check if /dev/fd0 exists, mv it if it does
> x=0
> if (ls -l /dev/fd0);then mv /dev/fd0 /dev/fd0_orig; x=1;fi
> #Link /dev/fd0 to /dev/loop1 to fool grub !!
> ln -s /dev/loop0 /dev/fd0
> #Run grub in batch mode
> /sbin/grub --batch <<EOF
> root (fd0)
> setup (fd0)
> quit
> EOF
> #restore fd0 if required
> rm -f /dev/fd0
> if([ $x -eq 1 ]);then mv /dev/fd0_orig /dev/fd0;fi
> umount /mnt/zip
> ######################################################
> #Now make a bootable CD ISO image
> # Make a dummy directory in /tmp
> mkdir /tmp/dummy
> #Copy the floppy image file to /tmp/dummy
> cp fd_file /tmp/dummy
> # Create the ISO image grub_image.iso
> mkisofs -b fd_file -o /tmp/grub_image.iso /tmp/dummy
> rm -rf /tmp/dummy
> ######################################################
> #cdrecord -scanbus
> #cdrecord dev=ATAPI:1,0,0 speed=8 /tmp/grub_image.iso
> ######################################################
>
>
> Of course each time that a kernel is updated I have to change the
> script, run again and burn a new CD.
>
> Now I want to install Grub on my USB disk so I can boot Linux when
> external disk is connected, otherwise Windows will start.
>
> What is the correct procedure, taking in account that I am not a
> super-expert and that my Fedora DVD is not here?? any graphical tool
> (I remember such a tool in previous Fedora releses)???
> --
> Antonio Montagnani
> Skype : antoniomontag
>
I created a grub.conf file in /boot/grub
timeout=10
default=0
splashimage=(hd1,0)/grub/splash.xpm.gz
title FC7 2.6.22.5-76.fc7 14/9/2007
kernel (hd1,0)/vmlinuz-2.6.22.5-76.fc7 ro root=/dev/VolGroup00/LogVol00
initrd (hd1,0)/initrd-2.6.22.5-76.fc7.img
title FC7 2.6.22.1-65.fc7 27/8/2007
kernel (hd1,0)/vmlinuz-2.6.22.4-65.fc7 ro root=/dev/VolGroup00/LogVol00
initrd (hd1,0)/initrd-2.6.22.4-65.fc7.img
title FC7 2.6.22.1-27.fc7 21/7/2007
kernel (hd1,0)/vmlinuz-2.6.22.1-27.fc7 ro root=/dev/VolGroup00/LogVol00
initrd (hd1,0)/initrd-2.6.22.1-27.fc7.img
#title Windows
# rootnoverify (hdx,y)
# chainloader +1
from fdisk -l, I get:
fdisk -l
Disco /dev/sda: 160.0 GB, 160041885696 byte
255 heads, 63 sectors/track, 19457 cylinders
Unità = cilindri di 16065 * 512 = 8225280 byte
Dispositivo Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 19457 156183930 8e Linux LVM
Disco /dev/sdb: 160.0 GB, 160041885696 byte
255 heads, 63 sectors/track, 19457 cylinders
Unità = cilindri di 16065 * 512 = 8225280 byte
Dispositivo Boot Start End Blocks Id System
/dev/sdb1 1 1274 10233373+ 27 Sconosciuto
/dev/sdb2 * 1275 10383 73162752 6 FAT16
/dev/sdb3 10383 19458 72892416 7 HPFS/NTFS
from a terminal I issue :
grub-install /dev/sda
Is this correct????
--
Antonio Montagnani
Skype : antoniomontag
More information about the fedora-list
mailing list