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

From Syslinux Wiki
Jump to: navigation, search
(Fixed two outdated links which still pointed to User:Scdbackup)
(Add internal links. Minor text modifications. Wiki formatting.)
 
Line 1: Line 1:
Throughout the SYSLINUX wiki, the term '''disk'''  
+
Throughout the Syslinux wiki, the term "'''disk'''"
 
is used for a storage medium which can host a random-access  
 
is used for a storage medium which can host a random-access  
 
read-write filesystem.
 
read-write filesystem.
  
 
For SYSLINUX, frequently the filesystem is  
 
For SYSLINUX, frequently the filesystem is  
some variant of FAT, e.g. FAT32/16/12.  
+
some variant of FAT, e.g. {{nowrap|FAT32/16/12.}}
 
SYSLINUX can also be installed on NTFS, and  
 
SYSLINUX can also be installed on NTFS, and  
EXTLINUX supports some additional filesystems,  
+
EXTLINUX supports some additional [[filesystem]]s,  
such as ext2/3/4 and btrfs.
+
such as {{nowrap|ext2/3/4}} and btrfs.
  
 
There are optical disc (not "disk") families of CD, DVD, and  
 
There are optical disc (not "disk") families of CD, DVD, and  
Line 22: Line 22:
 
media (e.g. floppy).
 
media (e.g. floppy).
  
After its preparation, such a data file is called '''disk image'''.  
+
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  
 
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  
 
a real storage device. e.g. onto a USB pen drive attached to a  
Linux system as /dev/sd''X''. (Make sure to use the right device  
+
Linux system as "{{nowrap|<tt>/dev/sd''X''</tt>".}} (Make sure to use  
address and to backup any valuable content of the pen drive before  
+
the right device address and to backup any valuable content of the pen  
proceeding.)
+
drive before proceeding.)
  
 
One possible method to write "my_disk.img" to the "sdc" device is:
 
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 image files are part  
 
Nevertheless, there are occasions where disk image files are part  
Line 46: Line 49:
 
filesystem:
 
filesystem:
  
 +
{|
 +
|
 
<pre>
 
<pre>
 
/sbin/fdisk -lu my_disk.img
 
/sbin/fdisk -lu my_disk.img
 
</pre>
 
</pre>
 +
|}
  
 
which displays a result similar to:
 
which displays a result similar to:
  
<pre>
+
{|
Units = sectors of 1 * 512 = 512 bytes
+
|
Sector size (logical/physical): 512 bytes / 512 bytes
+
Units = sectors of 1 * <font color="purple">512</font> = 512 bytes
I/O size (minimum/optimal): 512 bytes / 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
+
      Device Boot      Start        End      Blocks  Id  System
</pre>
+
my_disk.img1  *          <font color="teal">32</font>     511999      255984    6  FAT16
 +
|}
  
 
In the above result, note the ''start'' address by the number  
 
In the above result, note the ''start'' address by the number  
underneath "<tt>Start</tt>". E.g. 32 sectors.
+
underneath "<tt>Start</tt>" (<font color="teal">32</font> sectors in the above example).
  
Multiply it by 512 bytes. The result can be used with mount option  
+
Multiply it by <font color="purple">512</font> bytes.  
<tt>-o offset=</tt>  
+
The result can be used with mount option  
and with the <tt>-t</tt> option of the SYSLINUX installer.
+
{{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:
 
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>
 +
|}
  
 
== See Also ==
 
== See Also ==
Line 82: Line 97:
 
An example of disk image production is the  
 
An example of disk image production is the  
 
[[Hard_disk_images|Howto for hard disk images]]. It uses other means  
 
[[Hard_disk_images|Howto for hard disk images]]. It uses other means  
to apply the offset to mount, though. It lets losetup create a loop  
+
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.  
 
device for the image and another one for the partition in it.  
 
As always, the SYSLINUX installer operates on the partition device.
 
As always, the SYSLINUX installer operates on the partition device.
  
See also the articles about
+
See also the articles about  
[[Common_Problems#Preparing_a_normal_disk|Preparing a normal disk]]
+
[[Common_Problems#Preparing_a_normal_disk|preparing a normal disk]]  
 
and [[Common_Problems#mkdiskimage|mkdiskimage]].
 
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.