[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GRUB can't read FAT file system
From: |
Jordan Uggla |
Subject: |
Re: GRUB can't read FAT file system |
Date: |
Sun, 8 Dec 2013 22:32:06 -0800 |
On Sun, Dec 8, 2013 at 10:46 AM, SevenBits <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> I've been having a rather strange problem with GRUB, one that I have
> been encountering for a while. For some reason, GRUB cannot read
> partitioned FAT file systems on my, as well as others', USB drives.
> This occurs on all GRUB releases I have tried, including the
> development version through git.
>
> I have a standalone GRUB for EFI image that I generated with the
> grub-mkimage tool as follows. Notice that I have included the FAT
> module as part as PART_FAT:
>
> ../grub-mkimage -d . --format x86_64-efi --config
> '/home/username/Desktop/grub.cfg' -o ~/Desktop/boot.efi boot linux
> ext2 normal configfile lspci ls loadenv help echo fat exfat multiboot
> multiboot2 terminal sleep loopback normal fixvideo iso9660 loadbios
Using grub-mkimage directly is almost always a mistake, in most
people's cases it makes much more sense to use grub-install, and in
your case grub-mkstandalone is ideal, as it will include all modules
(and any other files you want) in a memdisk so that you can insmod as
needed from your grub.cfg rather than having them baked in, and you
don't have to worry so much about missing modules (though partition
modules, which are the ones you're missing, are among the few that
need to be loaded manually).
>
> When I boot into GRUB and go into the normal prompt, trying to list
> list devices works, as I'll type verbatim here:
>
> grub> ls
> (hd0) (hd1) (cd0)
You may understand this from the comments people have made previously,
but this is *not* a proper listing if any of those devices are
partitioned (which they are). You should be seeing partition devices
like (hd0,msdos1) or (hd1,gpt5). seeing only (hd0) from ls is a little
like running "ls /dev/sd*" in GNU/Linux and only seeing "sda" but not
"sda1". The reason that you're not seeing partition devices is that
you haven't included the needed partition modules (as stated by others
already).
>
> Typing the following should work, but doesn't.
>
> grub> ls (hd0)/
> error: unknown filesystem.
The above should *not* work, as it is akin to trying to run "mound
/dev/sda /mnt/" when what you actually want is "mount /dev/sda1
/mnt/". So even after inserting the proper modules, "ls (hd0)/" will
not work (and rightfully so), but "ls (hd0,msdos1)/" will work
(assuming that what you're trying to access is the first partition on
an msdos labeled drive).
>
> I know that (hd0) is the identifier for my USB drive, because the
> access indicator light flashes while that operation is being performed.
>
> Now, if I format the USB drive to have a FAT filesystem but no
> partitions, the operation works. For instance, this command:
>
> sudo mkfs.vfat -I /dev/sdX -n LINUX
>
> produces a drive that functions as expected.
And produces a drive where "mount /dev/sda /mnt/" functions "as
expected". Note that I highly recommend against ever creating a
filesystem on a "raw" drive. You should always have a partition table
on all your drives.
So in summary, use grub-mkstandalone instead of grub-mkimage, and
include "insmod part_msdos; insmod part_gpt" in your grub.cfg (do
*not* use the --modules option of grub-mkstandalone).
--
Jordan Uggla