Ventoy with image files

Want to put a copy of your entire installed Linux in its current state onto a Ventoy flash drive? I tried it, and it is possible. Here are the steps I took

  • Download Ventoy
  • Use to copy Ventoy to a usb flash drive. Needs to be at least 32Gb and better if it is usb3.0
  • Ventoy makes 2 partitions
/dev/sdc1 Ventoy vfat 28Gb
/dev/sdc2 VTOUEFI fat16 32Mb

I dont like that, so I used gparted to change the first partition to ext3

  • Make a squashfs file of the entire root filesystem of your installed Linux.
    I chose to use my Void/Lumina installation which is on one of my HD partitions called LinuxRoot2.
    I did this from another installation (MX) so I had to make sure LinuxRoot2 was mounted and the Ventoy partition called Ventoyext3 was mounted
$ df
Filesystem      1K-blocks      Used Available Use% Mounted on
/dev/sdb5       100206420  32495592  62574444  35% /media/nevj/LinuxRoot2
/dev/sdc1        29625480  24843344   3268308  89% /media/nevj/Ventoyext3

Then issue the command to make the squashfs file and let it write it directly to the usb drive Ventoyext3 partition

root@trinity:/home/nevj# mksquashfs /media/nevj/LinuxRoot2/ /media/nevj/Ventoyext3/voidlumina.img
Parallel mksquashfs: Using 12 processors
Creating 4.0 filesystem on /media/nevj/Ventoyext3/voidlumina.img, block size 131072.
[=============================================================\] 613051/613051 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 24818918.79 Kbytes (24237.23 Mbytes)
	78.99% of uncompressed filesystem size (31418705.08 Kbytes)
Inode table size 4662558 bytes (4553.28 Kbytes)
	25.52% of uncompressed inode table size (18270391 bytes)
Directory table size 5502033 bytes (5373.08 Kbytes)
	38.26% of uncompressed directory table size (14379345 bytes)
Xattr table size 42 bytes (0.04 Kbytes)
	52.50% of uncompressed xattr table size (80 bytes)
Number of duplicate files found 157136
Number of inodes 528252
Number of files 471252
Number of fragments 30572
Number of symbolic links  14866
Number of device nodes 0
Number of fifo nodes 4
Number of socket nodes 1
Number of directories 42129
Number of ids (unique uids + gids) 13
Number of uids 6
	root (0)
	unknown (994)
	unknown (997)
	unknown (993)
	nevj (1000)
	unknown (99)
Number of gids 11
	root (0)
	uucp (10)
	unknown (997)
	unknown (991)
	nevj (1000)
	tty (5)
	systemd-journal (101)
	unknown (14)
	voice (22)
	unknown (996)
	unknown (99)
  • Done. First time I tried it ran out of space… I had other stuff on the Ventoy flash drive. Use a new empty drive! It uses 24Gb for my Voidlumina OS.
  • Reboot, go to the BIOS, and boot from the usb drive.
    It works. I get the Ventoy boot menu, and it offers voidlumina.img so I choose it and it boots Void with the Lumina desktop. As it is booting it flashes a grub menu across the screen , so it is using grub to boot the .img file. Everything is there, my login and password are intact.

So it is possible to make a bootable copy of an entire Linux in its current installed state. The .img file is compressed, so Ventoy must be able to boot compressed images. My guess is that Ventoy boots a .img file with a loop mount, the same way you boot a .iso file. I tried it by hand with grub… I can boot a .iso file with grub, but so far my efforts with .img files are failures.

I made the squashfs file from outside of the OS. I am not sure how squashfs would perform if you asked it to make an image file of the OS you were logged into?
Also there may be complications if your home directory is on a separate partition.