Can mkdosfs create bootable FAT like file system on linux? I don't know if mkfs.fat can create bootable a FAT file-system, but the man page says that can't. The plan is to create a small basic kernel with bootable FAT 12.

The man page says for mkfs.fat: mkfs.fat can not create boot-able filesystems. This isn't as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it ;)

The options passed to format a bootable floppy:

mkdosfs -v -f 2 -F 12 -r 128 /dev/fd0

Dani AI

Generated

Short answer: mkfs.fat/mkdosfs only builds the FAT structures — it does not install a working bootloader or set up an MBR/partition table for BIOS/UEFI boot. was right to quote the mkfs.fat note: creating the filesystem is only the first step. (mkfs.fat man page). correctly pointed out that a filesystem alone is not a bootable disk.

Practical options to make a FAT-formatted medium actually boot: install a boot sector/VBR and (for disk devices) appropriate MBR code, or use a bootloader that writes the VBR and supporting files. Syslinux can install its VBR and place the needed ldlinux.sys/config on a FAT volume:

syslinux --install /dev/fd0        # floppy (example)
syslinux --install /dev/sdX1       # FAT partition on USB/hard disk

After that you usually write the Syslinux MBR with dd (example from the Syslinux docs) or use packaged tools to do the MBR step. See the Syslinux installation notes for details. (Syslinux docs, ArchWiki). For MS-DOS/Windows-compatible boot records the ms-sys tool can write MBR/BR code without copying system files — useful when restoring old DOS-style floppies. (ms-sys project).

For partitioned media make sure the partition is marked bootable/active (fdisk/parted set 1 boot on) before installing MBR/VBR code; tools like Unetbootin automate many of these steps for USB live images. (parted manual, Unetbootin). Caution: writing MBR/VBR with dd or ms-sys will destroy data if pointed at the wrong device — verify device names and back up first.

Recommended Answers

All 2 Replies

If you make the filesystem onto a floppy, you'd have to put an operating system on it to make it bootable.

If you make the filesystem onto a hard drive, flash drive, etc, you'd have to set up a basic partitioning scheme onto it, then install an operating system.

To do that would require more details, but the answer to your question is "no". Making the filesystem is only the first step in creating a bootable disk.

First, the partition that you are going to load the OS on has to be flagged as bootable (using fdisk). Next you need to install a bootable OS on that partition. See the source code for unetbootin for some good illustrations on how to do that. It will happily create a bootable USB stick from most any Linux live cd/dvd ISO file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.