Network Emulator for Mobile Universes

Documentation - Host File Systems (VFs)

NEmu provides some functions to manage file systems of virtual nodes.

VFs(path, type, tag, mode, **opts)

This function creates a virtual file system of type type from the path path. The default type is raw if the hdcopy session flag is activated, link in the other case. The file system will be called tag and will be setup with the mode mode (ro or rw). opts contains specific type options.
Several types are currently available:

To mount a virtio directory in the virtual host :

mount -t 9p -o trans=virtio {tag} {mount point} -oversion=9p2000.L

Example for a SSH connection, a HTTP connection (without authentication) and a HTTPS connection (with authentication):

VFs("", type="ssh", user="mylogin")
VFs("", type="http")
VFs("", type="https", user="mylogin"
                                       , password="mypassword")

EmptyFs(name, size, type, format)

Builds a new empty type file system called name with size size ({size}[K|M|G|T]) and a type QEMU image (Default: raw). format is the type of the file system, aka ext4, ntfs, etc. (Default: None). It is important to notice that you have to dispose of the mkfs suitable program for format. The new type file system is written in {session directory}/fs/. Currently, supported formats are:

Here a small example of use:

VHost('alice', hds=[VFs('/var/img/debian.img', type='cow'),
      VFs('/dev/sda7', type='raw'),
      VFs('/var/www', type='squash'),
      VFs('/var/buf', type='virtio', tag='buffer', writeout='immediate'),
      VFs('/opt/', type='ssh', user='alice', host=''),
      EmptyFs('plop.img', size='1G', type='raw', format='ext3')],
      cpu='core2duo', m=1024, localtime=None)

ExportFs(name, dest, type)

Exports a file system image called name from the current session to the file dest (default: in the current directory). The dest file can be converted into QEMU type type. File system images are located in {session directory}/fs/.

Here a small example of use:

VHost('bob', hds=[VFs('/var/img/debian.img', type='cow', tag='bobfs')],
      cpu='core2duo', m=1024, localtime=None)


# ...
# Doing something inside the virtual machine
# ...


ExportFs('bobfs', '/var/img/bob_debian.img', type='vdi')