Investigate what options there are for hostfs
mount -t hostfs none / -o /mnt/hostroot
As we can see within the UML we can mount basicly any file within the host by using the -o option.
It could be a security issue. We can put it in a chroot jail to avoid this problem. Or in a way reduce the risk level.
Investigate what other ways to create filesystems there are
We can also create a file image to be used by UML. With dd we can create a file image, like the one we created for Xen. And we can also use certain tools to help us creating the disk image, like:
mkfs.xfs umlubuntu.img
Can two instances use the same root filesystem?
Yes, we can run multiple instances use the same root filesystem. There is no error seen in the system. I started two instances at the same time. Everything seems to be fine.
There is one separate process on the host machine for each UML instance. The memory and process management are hence separated. However, we might get file inconsistency problem due to multiple access/edit to the same file.
What happens if you write to the same file, or open one for editing?
There are indeed problems. If UMLA create a file or folder on the filesystem, UMLB can also see it. But If they both edit the same file, only the later change will be write back to the disk.
Investigate the use of the above utilities and then set up the simple network depicted in figure 1 (S1 is a UML switch), so that both instances can ping each other successfully. See hint below. . .
uml mconsole
The UML management console is a low-level interface to the kernel. I see this line in my init log
[42949373.470000] mconsole (version 2) initialized on /home/vic/.uml/kNrS6A/mconsole
This file is the socket that uml_mconsole will use to communicate with UML guest. By sending command to the interface from the host, UML guest can be monitored and configured, new devices can be add/modify/remove.
uml switch
It can create a software switch to be used by the UML instances. UML instances can communicate with each other through the switch.
uml_switch -daemon -unix /home/vic/umlswitch/sw1.ctl
This will start a uml switch as a service in file sw1.ctl. In order to start it as a service we have to give root permission to the command.
In addition -hub option can be used to start the switch in hub mode.
uml watchdog
It is the process watcher of UML. If the host kernal does not “hear” from it for a certain period, it will assume the UML is hang or crash, and a UML process restart of the process will be issued.