|s i s t e m a o p e r a c i o n a l m a g n u x l i n u x||~/ · documentação · suporte · sobre|
First I will describe some of the general principles that are used in the setting up of a loopback filesystem as the root device.
A loopback device in Linux is a virtual device that can be used like any other media device.
Examples of normal media devices are hard disk partitions like
The loopback filesystem associates a file on another filesystem as a complete
device. This can then be formatted and mounted just like any of the other
devices listed above. To do this the device called
In Linux it is also possible to have another type of virtual device mounted as a filesystem, this is the ramdisk device.
In this case the device does not refer to any physical hardware, but to a portion of memory that is set aside for the purpose. The memory that is allocated is never swapped out to disk, but remains in the disk cache.
A ramdisk can be created at any time by writing to the ramdisk device
When a ramdisk is used to boot from (as is often done on Linux installation disks or rescue disks) then the disk image (the entire contents of the disk as a single file) can be stored on the boot floppy in a compressed form. This is automatically recognised by the kernel when it boots and is uncompressed into the ramdisk before it is mounted.
The initial ramdisk device in Linux is another important mechanism that we need to be able to use a loopback device as a the root filesystem.
When the initial ramdisk is used the filesystem image is copied into memory and
mounted so that the files on it can be accessed. A program on this ramdisk
This is unusual behaviour since the normal boot sequence boots from the designated root partition and keeps on running. With the initial ramdisk option the root partition is allowed to change before the main boot sequence is started.
The root filesystem is the device that is mounted first so that it appears as
the directory called
There are a number of complications about the root filesystem that are due to
the fact that it contains all files. When booting the
When the system has booted it is not possible to unmount the root partition or change it since all programs will be using it to some extent. This is why the initial ramdisk is so useful because it can be used so that the final root partition is not the same as the one that is loaded at boot time.
To show how the initial ramdisk operates in the boot sequence, the order of events is listed below.
This is just a simplified version of what happens, but is sufficient to explain how the kernel starts up and where the initial ramdisk is used.
Next Previous Contents