Skip to content

Mass Storage Device

MSD (Mass Storage Drive) is a powerful feature that allows One-KVM to emulate a virtual CD/DVD or flash drive. This enables using live media in BIOS/UEFI to recover or reinstall operating systems.

MSD notes

  • CD-ROM images are limited to 2.2 GB by the Linux kernel. Specially adapted Linux builds (currently OneCloud and Cumebox 2) do not have this limit
  • Flash images have no size limit

Caution

On OneCloud, do not disconnect the USB dual-headed (OTG) cable from the host or power off the host when using the unmount (disconnect) function. Otherwise, the kernel will continuously log errors due to the OTG port being unavailable. This causes the logging service to consume 100% CPU and the system to become unstable. MSD will remain unavailable until the USB OTG connection returns to normal.


Using MSD

Basic configuration

Since version 20241004, MSD is enabled by default and uses the /var/lib/kvmd/msd directory (no longer a mounted partition).

Upload images manually

One-KVM stores images in /var/lib/kvmd/msd. Upload your image file to this directory.

Change MSD path

Since integrated image 201204, MSD can use any directory specified in /etc/kvmd/override.yaml. If permission is denied, run chown kvmd -R /var/lib/kvmd/msd/ to make it writable.

1
2
3
kvmd:
    msd:
        msd_path: /var/lib/kvmd/msd

Writable flash drive

When emulating a flash drive on One-KVM, you can allow the target machine to write files to the image. After stopping the drive, download and open the image locally. This is useful for retrieving files from the target.

Create a ventoy bootable image

For versions earlier than 20241004, run kvmd-helper-otgmsd-remount rw first to remount internal storage as read-write before manipulating files.

  1. Create an empty image file in /var/lib/kvmd/msd with the required size. In this example, file is flash.img with 4096MB.

    dd if=/dev/zero of=/var/lib/kvmd/msd/flash.img bs=1M count=4096 status=progress
    
  2. In the web UI, choose Drive -> Image -> flash.img, switch the drive mode from cd-rom to flash, then connect MSD to the host.

  3. On the target, open ventoy and select the virtual disk to install. ventoy

  4. Put ISO images into the ventoy partition folder. ventoy iso

After completion, the flash image is ready for boot whenever needed.

ventoy 0 ventoy 1

msd

File exchange

Demo video recorded by a community member:

Related options:

1
2
3
4
# Folder under the MSD directory
normalfiles_path: NormalFiles
# Generated image size in MB
normalfiles_size: 256

Appendix: MSD partition mount (legacy)

MSD partition mount (before 20241004)

If you still need to use a mounted partition, in /etc/kvmd/override.yaml comment out the msd sub-option remount_cmd: /bin/true to #remount_cmd: /bin/true so the MSD partition gets correct permissions.

Choose any one of the following three methods. For beginners, the third method (virtual disk image) is recommended. It requires no physical partitioning and is safer and simpler.

Use OneCloud eMMC space

A prepared Armbian with tools is provided in the cloud drive (path: /One-KVM 相关/gparted_on_armbain_usbdisk.zip). Flash it to a USB drive, plug it into the USB port next to OneCloud’s Ethernet port, power on, connect via SSH (root/1234), and run gparted.

If the GParted UI does not appear, check whether your SSH terminal supports X11 forwarding.

In GParted, right-click /dev/mmcblp1p2 -> Resize/Move, set Free space following (e.g., 4096), format the new space as ext4, and click the check mark to apply.

img

img

Use an SD card

Avoid no-name cards (many appear fine in Windows, recognizable in Linux but not readable/writable).

1
2
3
4
# Locate TF card
fdisk -l
# Format as ext4 (replace sdx with your device)
mkfs.ext4 /dev/sdx
Use a virtual disk file

Create a new img file as the MSD filesystem; this method has been tested.

1
2
3
# Example; the 512 count is in MiB; adjust as needed
dd if=/dev/zero of=/root/diska.img bs=1M count=512
mkfs.ext4 /root/diska.img

Mount the partition

Confirm the correct path to mount (e.g., /dev/mmcblk1, /dev/mmcblk0p3, /root/diska.img). The following uses /dev/mmcblk0 as an example.

# List all partitions
df -h

# Append the following entry in /etc/fstab (replace /dev/mmcblk0 accordingly)
nano /etc/fstab

/dev/mmcblk0p3 /var/lib/kvmd/msd  ext4  nofail,nodev,nosuid,noexec,rw,errors=remount-ro,data=journal,X-kvmd.otgmsd-root=/var/lib/kvmd/msd,X-kvmd.otgmsd-user=kvmd  0 0

# If mounting fails, check and fix errors
mount /dev/mmcblk0p3

# Enable MSD and set msd mode to otg in /etc/kvmd/override.yaml
nano /etc/kvmd/override.yaml
systemctl restart kvmd-otg kvmd

Upload images manually

One-KVM stores images in a special partition mounted at /var/lib/kvmd/msd. If it is read-only, run:

1
2
3
4
5
6
7
# Remount MSD partition as read-write
sudo kvmd-helper-otgmsd-remount rw

# Upload image files to /var/lib/kvmd/msd

# Remount as read-only
sudo kvmd-helper-otgmsd-remount ro