5

A file system can be configured to span a complete disk, omitting any partition table. Notice intentionally the command to do so does not use /dev/sda1 but the raw, unpartitioned device instead.

mkfs.btrfs /dev/sda

The Idea is mentioned in the Arch Linux Wiki article about btrfs. I tried this in a virtual machine using a btrfs file system as only storage. It can even be booted from using grub, following the instruction in the wiki. ext3, ext4 and jfs also work that way. I only tested these, but most filesystem place the first block with an offset and thus leave enough space for a boot record.

Now I would like to use syslinux instead of grub. The aforementioned wiki already indicates that this makes a dedicated placement of the ldlinux.sys neccessary, but does not include instructions to solve this. I highly suspect that the usual mbr.bin file would also not be appropriate, because it is normally responsible to read the partition table and find an active bootable partition. Now, there is not partition to be found.

Does someone have any experience with using syslinux with a partitionless disk? Can a partitionless disk be booted using syslinux?

7
  • Interesting idea. Dec 3, 2013 at 15:37
  • 1
    Just as a side note: while this may be possible with MBR, systems these days are moving towards UEFI which requires partitioning, and a GPT boot partition.
    – phemmer
    Dec 3, 2013 at 16:11
  • 1
    You can have any filesystem on an unpartitioned disk. The filesystem doesn't care whether the block device you put it on is a disk, a partition or something else. It's pointless, though. Dec 3, 2013 at 22:49
  • I would not entirely agree with @Giles that it is pointless, but I agree that the performance impact is quite minimal. It saves only a few kilobytes of disk space. Nonetheless, stage 1 of the boot process is avoided completely, which would be to read the MBR and search for an active partition.
    – XZS
    Dec 3, 2013 at 23:37
  • @Patrick Indeed this is not very sensible for EFI and GPT. I incorporated a small section about this in my answer.
    – XZS
    Dec 3, 2013 at 23:39

1 Answer 1

5

MBR / BIOS

The commands issued to install syslinux to a partitioned disk are normally two.

extlinux --install /boot/syslinux

The first line installs a volume boot record, to be placed fixed at the start of the partition. It is responsible for loading the files of the bootloader from the file system. They normally reside in /boot/syslinux.

dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sda

The second line installs the master boot record, fixed at the start of the disk. Its task is to read the partition table and find the aforementioned volume boot record in a partition marked active.

In the case at hand, partition and disk are equal, so dd overwrites data extlinux has created. But a master boot record is not needed to start with. There is no partition table to read. So the magical solution is simply to leave out the dd line altogether.

Using a filesystem without a partition table thus not only saves space, but also a step in the boot process.


GPT / EFI

With EFI, this can only be used with legacy booting, which will read the MBR/VBR and boot accordingly. Doing so, most benefits of EFI are lost.

Using EFI boot with GPT, a FAT32 EFI system partition is always needed to read an executable from, which could be an EFI shell or the kernel to boot. So on a modern setup partitioning is inevitable and inherent. As EFI acts like a bootloader itself, there also is no step to be saved as with MBR.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .