Grub installation on a USB external disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux