Jump to content











Photo
- - - - -

lubuntu (22.04) live USB with PERSISTENT FILE


  • Please log in to reply
No replies to this topic

#1 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 15 May 2023 - 07:50 PM

I have an existing external USB disk with partitions created using diskpart - set up for Windows To Go. 
 
My goal was to use this disk for an lubuntu live USB without making any changes to the existing partition structure - using lubuntu-22.04.2-desktop-amd64.iso. 
 
Test system is a HIKVision enclosure with 512MB NVMe drive. FAT32 partition set up to EFI boot GRUB4EFI. Partitions/setup - 
(hd#,0) - active FAT32 partition with EFI files
(hd#,1) - Windows To Go (64-bit)
(hd#,2) - target for lubuntu (originally created for Windows To Go 32-bit)
(hd#,3) - Data
 
Following added to (hd#,0)\EFI\grub\menu.lst (lubuntu will be added to partition (hd#,2) - (hd-1,2) is the boot device partition 2) -

title lubuntu 22.04 (Persistent)
graphicsmode -1 1920 1080
root (hd-1,2)
kernel /casper/vmlinuz file=/cdrom/preseed/lubuntu.seed persistent splash --- 
initrd /casper/initrd
 
title lubuntu 22.04 (Live)
graphicsmode -1 1920 1080
root (hd-1,2)
kernel /casper/vmlinuz file=/cdrom/preseed/lubuntu.seed splash --- 
initrd /casper/initrd

 
(hd#,2) formatted using FAT32 gui format (http://ridgecrop.co....m?guiformat.htm)
 
Full contents of lubuntu-22.04.2-desktop-amd64.iso copied/extracted to (hd#,2).
 
Some instructions advocate setting up a seperate partition to use for the persistent storage - as I did not want to repartition the device this is impractical. It is also possible to use a file based method for persistent storage. The persistent overlay file must be named writable (e.g. (hd#,2)/writable). NOTE that older versions of lubuntu used the filename casper-rw for the persistent file - I'm not sure in which version of ubuntu/lubuntu this changed.
 
To create a persistent file, boot to the USB device and select the lubuntu 22.04 (Live) menu entry. 
 
The following command was used in a terminal in the booted lubuntu live USB to set the backing disk for lubuntu as writable (the device /cdrom is the default mount point for (hd#,2) when lubuntu live is booted from this device) - 

sudo mount -o remount, rw /cdrom

.

The following code is used to create a 4095MB file (remember that FAT32 has a maximum file size limit of 4GB) -

sudo dd if=/dev/zero of=/cdrom/writable bs=1M count=4095

.

Now setup/format the persistent overlay file /cdrom/writable -

sudo mkfs.ext3 -L writable -F /cdrom/writable

.

NOTE that the writable file appears to be linked to the system from which it was created - likely linked to the UUID / volume ID of the lubuntu partition. 
 
Reboot the USB device and select the menu option lubuntu 22.04 (Persistent). The writable file created using the live system should have been automatically located and mounted. 
 
:cheers:
 
Misty






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users