hal8000
Posts: 184
Joined: Fri Oct 04, 2013 5:22 pm

Why is the /boot partition a FAT filesystem?

Thu Oct 17, 2013 7:39 pm

Why on an embedded linux system is the /boot partition a FAT filesystem ?
I can only think this is for windows users so that /boot/config.txt may be
edited more easily.

Apart from fragmentation, FAT filesystems are weak and easily corrupted
if the partition is not cleanly unmounted, or power supply disconnects
suddenly.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Why is the /boot partition a FAT filesystem?

Thu Oct 17, 2013 7:40 pm

FAT is the only fs understood by the SOC's bootloader.

I.e., it has to be thus.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Why is the /boot partition a FAT filesystem?

Thu Oct 17, 2013 8:51 pm

afaik
problems may occur in the conditions you describe only if the fs is being modified somehow
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

User avatar
DavidS
Posts: 3009
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 1:54 am

hal8000 wrote:Why on an embedded linux system is the /boot partition a FAT filesystem ?
I can only think this is for windows users so that /boot/config.txt may be
edited more easily.
Unfortunately the FAT file system is very universaly supported. The SoCs built in loader only knows how to read from FAT, so it must at least load its firmware from FAT.
Apart from fragmentation, FAT filesystems are weak and easily corrupted
if the partition is not cleanly unmounted, or power supply disconnects
suddenly.
There is not much concern because: The only time that anything on the FAT partition is accessed in normal operation is to load the firmware, read the config.txt, and load the OS into SDRAM. These are read only operations (even in Linux).

The only write operations are: Modifying the config.txt, Updating the OS kernel or ROM image, or updating the firmware.

In Linux loading the OS means loading the kernel image into RAM at 0x8000, loading the Intrid RAM image into RAM at a known location, and then pass control to the kernel.

In RISC OS it means loading the RISC OS ROM image into RAM at 0x8000 and passing control to there. The RISC OS ROM will then relocate it self.

In other OSes the initial process is the same.

While Linux is the most used OS on the RPi it is not the only one, RISC OS is also quite popular, and there are others. And FAT is the only FS that all of the main OSes for the RPi natively support.

Do remember that at this time for non n*x OSes at this time on the RPi there is a native version of AROS, we have Plan9, as well as QNX (simi-n*x), and of cource RISC OS the original ARM based OS. So at this point if there were to be a change to the core loader (not possible as it is in ROM on the SoC) we would have to write drivers for many OSes.
ARM BASIC: For the love of Simplicity, Fast Interpreted BASIC, and Assembly Language.
Always KISS Keep It Simple Silly.

User avatar
BluDragon
Posts: 83
Joined: Thu Sep 05, 2013 7:32 am
Location: 127.0.0.1

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 7:53 am

DavidS wrote:we have Plan9...
what happened to the plans one through eight? ;)
"Whenever a separation is made between liberty and justice, neither, in my opinion, is safe." - Edmund Burke
"Men make counterfeit money; in many more cases, money makes counterfeit men." - Sydney J. Harris

User avatar
Burngate
Posts: 4919
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 9:33 am

DavidS wrote:... The only time that anything on the FAT partition is accessed in normal operation is to load the firmware, read the config.txt, and load the OS into SDRAM. These are read only operations (even in Linux).

The only write operations are: Modifying the config.txt, Updating the OS kernel or ROM image, or updating the firmware.
...In RISC OS ...
To be pedantic, in RISC OS, the ROM image (kernel) is rewritten at shut-down.
But if you pull the power without shutting down, nothing in the FAT partition is rewritten

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 9:52 am

Burngate wrote:To be pedantic, in RISC OS, the ROM image (kernel) is rewritten at shut-down.
realy ?!. i did not know ,..
any idea
why ROM image is rewritten
:?:
i would guess the R and O in ROM is Read-only , so it is not expected to change ..
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

User avatar
Burngate
Posts: 4919
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 4:52 pm

I'm no guru, but I believe it's like this.
In the original RISC OS computers - Archimedes etc. - there was a ROM for the OS and a CMOS RAM/clock chip to store some options. (Was that also true of the 8-bit BBC micro? I can't remember!)
On boot-up, the ROM resided at the bottom of memory, to provide the reset vector at 0x00000000, and then shoved up to the top by the MMU.
The CMOS RAM was then read, and at least one bit was written as a clean/dirty shutdown flag - and cleared on a clean shutdown

Obviously the Pi has neither, but the ROM is emulated by the kernel image, so a part of that is used to emulate the CMOS RAM. And to write the clean/dirty flag, the kernel has to be written

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17759
Joined: Sat Jul 30, 2011 7:41 pm

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 6:53 pm

hal8000 wrote:Why on an embedded linux system is the /boot partition a FAT filesystem ?
I can only think this is for windows users so that /boot/config.txt may be
edited more easily.

Apart from fragmentation, FAT filesystems are weak and easily corrupted
if the partition is not cleanly unmounted, or power supply disconnects
suddenly.
A point that hasn't been mentioned, but the Raspi isn't really designed as an embedded Linux system.

Note that the boot partition is rarely written to - generally only when you want to make a config change.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

W. H. Heydt
Posts: 7307
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Why is the /boot partition a FAT filesystem?

Fri Oct 18, 2013 10:50 pm

BluDragon wrote:
DavidS wrote:we have Plan9...
what happened to the plans one through eight? ;)
They weren't from outer space.

User avatar
LemmeFatale
Posts: 254
Joined: Fri Feb 01, 2013 8:47 pm
Location: UK

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 12:20 pm

And seven ate nine. :P

Anyway, just wondering, since nobody else has mentioned this in relation to the claim about FAT filesystems being easily corrupted: Is my experience of FAT filesystems used in conjunction with SD Cards on Linux systems like the Raspberry Pi the exact opposite of everyone else's? I've found them to be considerably more hardy than ext ones, much more tolerant of the power suddenly being cut, and usually vastly easier to fix if something does befall them, too. (I use Linux exclusively, and have traditionally had nothing but problems with ext filesystems on SD Cards.)
Classic - Raspberry Pi Model B (512MB) with Motorola Atrix Lapdock
Lemcon-One - Raspberry Pi Model B (256MB) PiMAME TV-Box

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 12:41 pm

I've found them to be considerably more hardy than ext ones, much more tolerant of the power suddenly being cut, and usually vastly easier to fix if something does befall them, too. (I use Linux exclusively, and have traditionally had nothing but problems with ext filesystems on SD Cards.)
Totally agree. I think this is one of those "tribal fiction" situations, where the reality is the exact opposite of the Conventional Wisdom.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

hal8000
Posts: 184
Joined: Fri Oct 04, 2013 5:22 pm

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 4:09 pm

LemmeFatale wrote:And seven ate nine. :P

Anyway, just wondering, since nobody else has mentioned this in relation to the claim about FAT filesystems being easily corrupted: Is my experience of FAT filesystems used in conjunction with SD Cards on Linux systems like the Raspberry Pi the exact opposite of everyone else's? I've found them to be considerably more hardy than ext ones, much more tolerant of the power suddenly being cut, and usually vastly easier to fix if something does befall them, too. (I use Linux exclusively, and have traditionally had nothing but problems with ext filesystems on SD Cards.)

The opposite experience for me. I've lost data in the past many times on FAT32 on USB memory sticks, although until now I didn't have any SD cards with FAT filesystems. All my memory sticks use ext3, as I don't use windows. I've never lost data on any journalled linux filesystem, even after a power cut.

Heater
Posts: 7577
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 4:31 pm

LemmeFatale,
...and have traditionally had nothing but problems with ext filesystems on SD Cards...
Yes but you are not allowed to say that around here. You are clearly imagining it:)

For me it has been worse. Not only is the file system corrupted but the card becomes unusable.
Try to reformat it or re image it. No chance.

Do some experiments with dd and I find it is impossible to read back what I have written to the card.

OK in the bin with that one and continue with a new one. Until next time...

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 4:49 pm

Yes but you are not allowed to say that around here. You are clearly imagining it:)
Well done, sir!

Man after my own heart.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
LemmeFatale
Posts: 254
Joined: Fri Feb 01, 2013 8:47 pm
Location: UK

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 5:50 pm

Heater wrote:LemmeFatale,
...and have traditionally had nothing but problems with ext filesystems on SD Cards...
Yes but you are not allowed to say that around here. You are clearly imagining it:)

For me it has been worse. Not only is the file system corrupted but the card becomes unusable.
Try to reformat it or re image it. No chance.

Do some experiments with dd and I find it is impossible to read back what I have written to the card.

OK in the bin with that one and continue with a new one. Until next time...
I should note that I've never experienced this with the Raspberry Pi (I can only guess that things with ext on flash-media have improved in more recent times), but I do know what you mean, here - I quickly learned my lesson about using ext on removable storage with other ARM Linux systems some time ago, after it killed two SD Cards stone cold dead and beyond recovery just as a result of said cards being connected while the hardware was being *safely* shut down. Never again. :P
Classic - Raspberry Pi Model B (512MB) with Motorola Atrix Lapdock
Lemcon-One - Raspberry Pi Model B (256MB) PiMAME TV-Box

confuseling
Posts: 144
Joined: Mon Aug 26, 2013 1:41 pm

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 5:57 pm

I've had a few USB sticks / cards go 'dead', but I've always managed to bring them back with fdisk or some other low level tool.

In my experience it's worth trying a few different tools - things can appear to be dead to one, but respond to another.
http://forums.debian.net

User avatar
LemmeFatale
Posts: 254
Joined: Fri Feb 01, 2013 8:47 pm
Location: UK

Re: Why is the /boot partition a FAT filesystem?

Sat Oct 19, 2013 11:29 pm

confuseling wrote:I've had a few USB sticks / cards go 'dead', but I've always managed to bring them back with fdisk or some other low level tool.

In my experience it's worth trying a few different tools - things can appear to be dead to one, but respond to another.
Absolutely - seconded. I've brought back one this way, too, some time back. Sometimes they do seem to just get totally wrecked, though...
Classic - Raspberry Pi Model B (512MB) with Motorola Atrix Lapdock
Lemcon-One - Raspberry Pi Model B (256MB) PiMAME TV-Box

shneor
Posts: 31
Joined: Thu Sep 26, 2013 6:44 am

Re: Why is the /boot partition a FAT filesystem?

Sun Oct 20, 2013 4:11 am

[quote="DavidS"][quote="hal8000"]Why on an embedded linux system is the /boot partition a FAT filesystem ?
[quote]There is not much concern because: The only time that anything on the FAT partition is accessed in normal operation is to load the firmware, read the config.txt, and load the OS into SDRAM. These are read only operations (even in Linux).[quote]

This is not necessarily accurate. With a dual boot, the active config.txt file is in the /BOOT directory, not in the FAT partition.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9471
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Why is the /boot partition a FAT filesystem?

Sun Oct 20, 2013 2:32 pm

shneor wrote: This is not necessarily accurate. With a dual boot, the active config.txt file is in the /BOOT directory, not in the FAT partition.
AFAIK it doesn't have anything to do with multiboot, but yes the booted OS has a /BOOT directory, which is simply the FAT partition mounted as /BOOT, or am I missing something?.

Also there is more than one version of the "ext" filesystem, and while it is true that ext2 is notoriously susceptible to file system corruption ext4 is not, and the PI uses ext4, not ext2.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17759
Joined: Sat Jul 30, 2011 7:41 pm

Re: Why is the /boot partition a FAT filesystem?

Sun Oct 20, 2013 5:14 pm

Joe Schmoe wrote:
Yes but you are not allowed to say that around here. You are clearly imagining it:)
Well done, sir!

Man after my own heart.
S'funny, 'cos I believe he said exactly that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

mikroskeem
Posts: 16
Joined: Sun Jan 27, 2013 7:23 am
Location: Estonia
Contact: Website

Re: Why is the /boot partition a FAT filesystem?

Sun Oct 27, 2013 10:36 am

Okay if you say FAT is only supported fs by SoC bootloader, then why it suddenly won't boot? Partition moved forward by some blocks? No, i'm not that noob who complains about their sd card is wrongly flashed, i complain about rpi random non-booting caused by FAT partition. I can acces it from any other computer, but no luck with rpi. If i make backup from my rootfs and reflash using latest image + flash rootfs back, then it's working. It usually happens when i run e2fsck(at lastly jfs_fsck, cuz i have jfs root now)
EDIT: If i inspect new-flashed sd card with (c)fdisk and gparted, it has empty ~1,2Mb before boot partition, and ~2mb after it(Atleast on ArchLinux-06-06-2013 image)
EDIT2: If somebody asks, linux filesystems are very easily corruptable, just short accidentally 3,3v and gnd, rootfs superblock wipes :P FAT resisted it and rpi loaded it's stuff and tried to boot :D

Return to “General discussion”

Who is online

Users browsing this forum: Bing [Bot], jojopi, mstone326, Possum and 63 guests