Today I encounter an interesting task about system administration:
Configure your system to automatically loop-mount the ISO of the installation disk on the directory /repo. Configure your system to remove this loop-mounted ISO as the only repository that is used for installation. Do not register your system with subscription-manager, and remove all reference to external repositories that may already exist.
This is a common issue when you set up the VM: After you finish installing Linux, you want to boot the Linux normally, rather than running into the installation disk again. So when you install Linux, you attach the iso image. Later detach the iso so that Linux can boot normally.
This could be easily done from virtualization software such as VirtualBox, VMWare Workstation, thanks to their user-friendly UI. However, this task asks you to do it through automation. In system admin books, this is barely mentioned. But it's still worth digging: in the scenario where you're setting up bunches of VMs, it's necessary to learn how this is done through automation.
To tackle the task, we'll need to understand the term "loop mount" from the question.
The definition from the doc is a bit awkward to read. Googling around I realize there's better material. Here's how I'm gonna rephrase it.
Why do you want to "loop-mount" the ISO? In my opinion, this is the only way to mount the ISO.
mount -o loop disk1.iso /mnt/disk
This validates my understanding. "Loop-mount" takes the local filesystem + the ISO image to do the work. Because it attaches the ISO image to the filesystem.
We also call the ISO image the "loop device". The loop device is "loop-mounted" to the filesystem.
Now go back to the official doc, it makes more sense.
The loop device is a block device that maps its data blocks not to a physical device such as a hard disk or optical disk drive, but to the blocks of a regular file in a filesystem or to another block device. This can be useful for example to provide a block device for a filesystem image stored in a file, so that it can be mounted with the mount command.
So the ISO image is also a block device. I may come back to this later.
Comments
Post a Comment