Difference between revisions of "What is a SYSLINUX disk ?"

From Syslinux Wiki
Jump to: navigation, search
(New Article "What is a SYSLINUX disk ?")
 
(Add internal links. Minor text modifications. Wiki formatting.)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==What is a SYSLINUX disk ?==
+
Throughout the Syslinux wiki, the term "'''disk'''"
 +
is used for a storage medium which can host a random-access
 +
read-write filesystem.
  
Throughout the SYSLINUX wiki, the term '''disk''' is used for
+
For SYSLINUX, frequently the filesystem is  
a storage medium which can host a random-access read-write
+
some variant of FAT, e.g. {{nowrap|FAT32/16/12.}}
filesystem. Some variant of FAT, to be specific. E.g. FAT32 or FAT16.
+
SYSLINUX can also be installed on NTFS, and
See also the articles about
+
EXTLINUX supports some additional [[filesystem]]s,
[[User:Scdbackup#Preparing_a_normal_disk|Preparing a normal disk]]
+
such as {{nowrap|ext2/3/4}} and btrfs.
and [[User:Scdbackup#mkdiskimage|mkdiskimage]].
+
  
Nevertheless there is one class of media, which a PC-BIOS will
+
There are optical disc (not "disk") families of CD, DVD, and  
normally not operate as SYSLINUX disk, even if they could host
+
BD (Blu-ray). Optical media uses the ISO9660 filesystem, and can
a FAT filesystem. These are the optical disc families of CD, DVD,
+
boot by means of "The El Torito" specification, which includes 3
and BD (Blu-ray). PC-BIOS will look on them for an ISO 9660
+
alternative boot modes:
filesystem with additional equipment as provided by [[ISOLINUX]].
+
* floppy emulation (using SYSLINUX)
 +
* hard disk emulation (using SYSLINUX)
 +
* no emulation (using ISOLINUX)
  
On the other hand, regular data files qualify as SYSLINUX disks
+
In addition to real media, regular data files qualify as SYSLINUX  
if they get prepared with a partition table and a FAT filesystem.
+
disks if they get prepared with a supported filesystem, typically
After the preparation, such a data file is called '''disk image'''.
+
FAT. It can include MBR, or GPT, or otherwise be a "partitionless"
For booting it with real hardware, it usually has to be copied
+
media (e.g. floppy).
onto a real storage device. E.g. onto a USB pen drive attached
+
 
to a Linux system as /dev/sdc. (Make sure you use the
+
After its preparation, such a data file is called a '''disk image'''.  
right device address and backup any valuable content
+
For booting it with real hardware, it usually has to be written onto  
of the pen drive.)
+
a real storage device. e.g. onto a USB pen drive attached to a  
 +
Linux system as "{{nowrap|<tt>/dev/sd''X''</tt>".}} (Make sure to use  
 +
the right device address and to backup any valuable content of the pen  
 +
drive before proceeding.)
 +
 
 +
One possible method to write "my_disk.img" to the "sdc" device is:
 +
 
 +
{|
 +
|
 
<pre>
 
<pre>
 
dd if=my_disk.img of=/dev/sdc conv=fdatasync
 
dd if=my_disk.img of=/dev/sdc conv=fdatasync
 
</pre>
 
</pre>
 +
|}
  
Nevertheless, there are occasions where disk images files are
+
Nevertheless, there are occasions where disk image files are part  
part of a boot process, without occupying a whole own storage
+
of a boot process, without occupying a whole own storage device.
device.
+
Such case is out of the scope of this article.
  
=== Populating disk images by program syslinux on Linux ===
+
== Installing SYSLINUX on disk images under Linux ==
  
For populating a disk image file by help of the Linux version of
+
The following procedures refer to a disk image with MBR.
the syslinux command, you need to know the start address of the
+
 
partition with the FAT filesystem. Let
+
We need to know the ''start'' address of the partition with the FAT  
 +
filesystem:
 +
 
 +
{|
 +
|
 
<pre>
 
<pre>
 
/sbin/fdisk -lu my_disk.img
 
/sbin/fdisk -lu my_disk.img
 
</pre>
 
</pre>
tell it by the number underneath "Start". E.g. here it is 32:
+
|}
<pre>
+
 
      Device Boot      Start        End      Blocks  Id  System
+
which displays a result similar to:
my_disk.img1  *          32      511999      255984    6  FAT16
+
 
</pre>
+
{|
Multiply it by 512. Use the result with mount option -o offset= and with
+
|
syslinux option -t . In this example that would be:
+
Units = sectors of 1 * <font color="purple">512</font> = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
 +
      Device Boot      Start        End      Blocks  Id  System
 +
my_disk.img1  *          <font color="teal">32</font>     511999      255984    6  FAT16
 +
|}
 +
 
 +
In the above result, note the ''start'' address by the number
 +
underneath "<tt>Start</tt>" (<font color="teal">32</font> sectors in the above example).
 +
 
 +
Multiply it by <font color="purple">512</font> bytes.  
 +
The result can be used with mount option  
 +
{{nowrap|1="<tt>-o offset=</tt>"}}
 +
and with the {{nowrap|"<tt>-t</tt>"}} (aka {{nowrap|"<tt>--offset</tt>")}}
 +
option of the SYSLINUX [[install]]er.
 +
 
 +
In this example the respective commands would be:
 +
 
 +
{|
 +
|
 
<pre>
 
<pre>
 
mount -o loop,offset=16384 my_disk.img /mnt/my_disk_root
 
mount -o loop,offset=16384 my_disk.img /mnt/my_disk_root
 
</pre>
 
</pre>
 +
|}
 
and
 
and
 +
{|
 +
|
 
<pre>
 
<pre>
 
syslinux --directory /boot/syslinux/ -t 16384 --install my_disk.img
 
syslinux --directory /boot/syslinux/ -t 16384 --install my_disk.img
 
</pre>
 
</pre>
An example of disk image production is the
+
|}
[[Hard_disk_images|Howto for hard disk images]]. It uses other means
+
 
to apply the offset to mount, though. It lets losetup create
+
== See Also ==
a loop device for the image and another one for the partition.
+
 
A run of syslinux would have to happen on the partition device.
+
An example of disk image production is the  
 +
[[Hard_disk_images|Howto for hard disk images]]. It uses other means  
 +
to apply the offset to mount, though. It lets <tt>losetup</tt> create a loop  
 +
device for the image and another one for the partition in it.  
 +
As always, the SYSLINUX installer operates on the partition device.
 +
 
 +
See also the articles about
 +
[[Common_Problems#Preparing_a_normal_disk|preparing a normal disk]]
 +
and [[Common_Problems#mkdiskimage|mkdiskimage]].

Latest revision as of 07:18, 1 May 2020

Throughout the Syslinux wiki, the term "disk" is used for a storage medium which can host a random-access read-write filesystem.

For SYSLINUX, frequently the filesystem is some variant of FAT, e.g. FAT32/16/12. SYSLINUX can also be installed on NTFS, and EXTLINUX supports some additional filesystems, such as ext2/3/4 and btrfs.

There are optical disc (not "disk") families of CD, DVD, and BD (Blu-ray). Optical media uses the ISO9660 filesystem, and can boot by means of "The El Torito" specification, which includes 3 alternative boot modes:

  • floppy emulation (using SYSLINUX)
  • hard disk emulation (using SYSLINUX)
  • no emulation (using ISOLINUX)

In addition to real media, regular data files qualify as SYSLINUX disks if they get prepared with a supported filesystem, typically FAT. It can include MBR, or GPT, or otherwise be a "partitionless" media (e.g. floppy).

After its preparation, such a data file is called a disk image. For booting it with real hardware, it usually has to be written onto a real storage device. e.g. onto a USB pen drive attached to a Linux system as "/dev/sdX". (Make sure to use the right device address and to backup any valuable content of the pen drive before proceeding.)

One possible method to write "my_disk.img" to the "sdc" device is:

dd if=my_disk.img of=/dev/sdc conv=fdatasync

Nevertheless, there are occasions where disk image files are part of a boot process, without occupying a whole own storage device. Such case is out of the scope of this article.

Installing SYSLINUX on disk images under Linux

The following procedures refer to a disk image with MBR.

We need to know the start address of the partition with the FAT filesystem:

/sbin/fdisk -lu my_disk.img

which displays a result similar to:

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

      Device Boot      Start         End      Blocks   Id  System
my_disk.img1   *          32      511999      255984    6  FAT16

In the above result, note the start address by the number underneath "Start" (32 sectors in the above example).

Multiply it by 512 bytes. The result can be used with mount option "-o offset=" and with the "-t" (aka "--offset") option of the SYSLINUX installer.

In this example the respective commands would be:

mount -o loop,offset=16384 my_disk.img /mnt/my_disk_root

and

syslinux --directory /boot/syslinux/ -t 16384 --install my_disk.img

See Also

An example of disk image production is the Howto for hard disk images. It uses other means to apply the offset to mount, though. It lets losetup create a loop device for the image and another one for the partition in it. As always, the SYSLINUX installer operates on the partition device.

See also the articles about preparing a normal disk and mkdiskimage.