# GRUB install on FAT16



## durant125 (Aug 15, 2004)

I cannot get GRUB to install on my FAT16 2GB partition. I am using Parted Magic Live CD. I went into the terminal and mounted my Fat16 part. Then i tried installing 3 different ways. 1st I created the boot/grub directory on my FAT16, 2nd I let GRUB create the directories itself which it did. But GRUB said it did not recognize the format of the device. Here is the command i used:

grub-install --root-directory=/mnt/mnt/ (where i mounted my FAT16) --no-floppy (i tried with and without this option since i do not have a floppy drive)

Grub does throw a device.map file in /mnt/mnt/boot/grub/ that reads hd0 is sda1 which is the correct partition.

The 3rd way was grubconfig, when i try to make a header, which is the 1st thing GRUB wants u to do pre install, in my FAT16, grub returns with an error that this is not a Linux Filesystem, no crap! 

Oh I've also tried installing from Mandriva with no avail. Threw Stage* files in the /boot/grub/ on my FAT16 and then tried running them ./Stage*.

I guess my question is can GRUB be installed on FAT16? and if so how?
If not I guess ill make an ext2 part and that should work, correct?


----------



## saikee (Jun 11, 2004)

This is how

The distro you source Grub from has /boot/grub directory, right?

Just replicate the entire directory into the fat16 partition, which I assume to be say the 3rd partition of the 1st disk, know to Grub as (hd0,2). In Linux it would be called something like hda3.

You fire up a Grub shell in the Linux and type

```
root (hd0,2)
setup (hd0,2)
```
You will find Grub reported successfully installed into the fat16 partition.

Your grub-install would have worked out if fat16 partition were hda3 and you issued the command

```
grub-install /dev/hda3
```
Grub-install should be to the raw device and not a mounted directory.

Grub can be installed into a fat16 partition because in the /boot/grub directory you will have

(1) stage1 (a binary file system independent)
(2) stage2 (ditto)
(3) a vfat version of stage1.5 (specific for fat16 partition)

which are the essential files Grub needs to install itself into the boot sector of the fat16 partition.

You do realise the fat16 partition itself is not bootable except for hosting Grub. You can edit the menu.lst there any way you wish.

Grub can be installed into any partition that has a boot sector. A few odd Linux filing systems have no boot sector.

The advantage of placing Grub into a fat16 partition is you can let a MS Windows boot loader to boot Grub and then use Grub to boot other systems in a relay. MS MBR boots whatever primary partition marked active and Grub will be fired up if your fat16 partition has been marked bootable (or active in MS Windows term). I advocate it as one of the method to install Linux while keeping Windows MBR untouched like a virgin.


----------



## durant125 (Aug 15, 2004)

OK here i am. sda1 or hd0,0 is my vFAT or FAT16 partition. I am still trying to use Parted Magic, oh by the way how do u do that neat little Code Box? 

grub-install /dev/sda1
cannot mkdir /boot Read Only Filesystem

grub-install --root-directory=/mnt/mnt/ /dev/sda1
/dev/sda1 does not have a corresponding BIOS drive

And I cannot find the stage* files to do the setup from a GRUB shell. Would you happen to know what folder they are in the Parted Magic CD?

Let me see if I understand, to do it in Mandriva, the easiest way would be to copy the boot/ to my FAT16 partition. OR I can make a boot/grub/ on my FAT16 and throw stage1, 1_5, and 2 in that folder. Then invoke a Grub Shell run the 2 commands root (hd0,0) setup (hd0,0)?


----------



## saikee (Jun 11, 2004)

Think you are confusing yourself.

You should not put Parted Magic's Grub in a hard disk partition like that. When Parted Magic booted it uses isolinux and there may not even be anything in the /boot. In any case the root or "/" of Parted Magic is from a CD so it is a read-only system. Think there may be a bug that Parted Magic does not like user to mount things on its root.

You can boot up any Live CD, fire up a Grub shell and put Grub in the way I suggested by copying the /boot/grub from a mounted Mandriva into the mounted sda1 and then using root+setup as per Post #3


----------



## durant125 (Aug 15, 2004)

Whats the difference between setting up GRUB on sda1 in Mandriva or doing it from a live cd?


----------



## saikee (Jun 11, 2004)

You install a working copy of Grub from an installed Linux system. If it is Mandriva then you will have Mandiva's version of the menu.lst inside. Live CD does not conform to the same standard as same distro installed inside a hard disk because the filing system tree could be read-only. Nobody expects to alter the internal working of a burnt CD.

A Live CD is traditionally booted by isolinux, a famous software written by Pater Anvin, specifically written for such a device. Grub boots from a partition off a hard disk, a USB drive or a floppy etc. In a boot-up Linux Live CD you will not find partitions inside and so no grub in its /boot. 

However, there is a small number of Live CD that use Grub too but the implementation is not yet popular. Mind you Grub uses a special stage2 file called stage2_eltorito for booting from a CD. The stage2 file for a hard disk is different. 

In general you can install Grub using the information from /boot/grub of a Live CD if the Grub files of stage1, stage1.5 and stage2 are inside but you will have to live with whatever menu.lst left by the Live CD, which is not intended to be edited, may have the menu hidden and provides no access to a Grub prompt. 

If you are thinking of hecking a Live CD to boot from a hard disk by putting its Grub in a fat16 partition then it is the wrong way to go about it. The correct way is 

(1) Mount the CD or its iso on a loopback device
(2) Copy the information onto a separate partition.
(3) Install Grub into this partition
(4) Create a menu.lst using the same parameters as per the original isolinux.cfg 

Effectively you boot up the content of a Live CD from a hard disk partition by replacing isolinux with Grub.

The above method can break down if the Live CD Linux has been written to fetch files only from the CD rom. About 40% of the Live CD does that. In such a case the Live CD Linux doesn't boot and claims "files not found".


----------



## durant125 (Aug 15, 2004)

K I'm having a hard time getting a Live CD to work on my PC. I have a SATA CDROM, which my BIOS recognizes , so the live cd begins to boot but halts when it says cannot find IDE to access filesystem or something along those lines. Than it brings me to a console to fix bugs yeah right. I tried doing a search for live cds that will boot on SATA, but so far no success. Do you know of any?

Also I did try installing GRUB on the FAT16 partition from Mandriva:

root (hd0,0)
Recognized the FAT partition

setup (hd0,0)
found stage1
found stage 2
Installed both successfully but could not embed the fat_stage1.5 GRUB said the error was not fatal

On ur last post could I copy the files from say DSL into a partition and boot it from my Mandriva Grub, or is installation more complicated than that?


----------



## saikee (Jun 11, 2004)

I have a difficulty in answering your post as I do not known your motive.

Nearly all recent Live CD support Sata. You only have a problem with Sata if sticking with old Live CD and small-foot print distros.

Grub only needs stage1 and stage2 for booting but stage1.5 is also used in certain situation. 

DSL can be installed to a hard disk as a normal distro. You need an above-average skill to heck it to boot as a Live CDway or just following the DSL instruction of installing into a pen drive. 

The method of copying the files directly across is for booting from a fat16 partition using the syslinux boot loader which is a Dos-based program. DSL may has a restriction that there should only be one partition in the disk. Also fat16 partition is not supposed to be bigger than 2Gb beyond which the addressibility of fat16 ceases.


----------



## durant125 (Aug 15, 2004)

Im just trying to install GRUB on a FAT16 partition and use that grub as my bootloader. So my Mandriva 1 should work with SATA fine? I will make my FAT16 partition a little smaller just in case. When and If I finally get it to work, I'll give all my steps so you know what i was trying to do.


----------



## saikee (Jun 11, 2004)

Your fat16 Grub is working now if you boot to (hd0,2)

If you want it fire up from the MBR just use a Grub shell to type

```
root (hd0,2)
setup (hd0)
```
that effectively as Grub from fat16 partition to take over the MBR.

I thought you know how to put 2 and 2 together to make 4. As far as I am aware you are there already.

You do realise too that you can boot Mandriva in exactly the same way by naming the root of Mandriva and setup in (hd0). That makes Mandriva boots directly from MBR without dropping into a fat16 partition.


----------



## durant125 (Aug 15, 2004)

Had to go away for a day to clear my head. Your 1st post gave me what i wanted. But i believe GRUB had troubles installing on the FAT16 partition. I'm going to reformat the partition with Mandriva this time (since im using the Mandriva GRUB), and see if stage1.5 succeeds this time. Now on the MBR, I do not have Windows right now is there any tools i can use in linux that would be the same as fixmbr? Also what tool would u recommend in linux to reformat a partition, sfdisk, chfdisk, fdisk, etc?
By the way thanks for your patience.


----------



## saikee (Jun 11, 2004)

To format a fat16 partition, say in hda1, in Linux the command in root console is

```
mkdosfs -F16 /dev/hda1
```
hda1 needs to be 2Gb or under in order to be readable by a MS system.

You can download any Dos 6 or above bootable floppy, say from bootdisk.com, to do "fdisk /mbr". It can fix all Windows MBR, except Vista which has its own version.


----------



## durant125 (Aug 15, 2004)

I dont have a floppy drive : ( 
Any alternative method, I can burn CDs.


----------



## saikee (Jun 11, 2004)

Download "FeeDos" which is available in a bootable CD iso. It has fdisk.exe inside.


----------



## durant125 (Aug 15, 2004)

Did you mean "FreeDos"? I couldn't find any info on "FeeDos".


----------



## saikee (Jun 11, 2004)

Sorry. You are right.


----------

