Thursday 11 February 2016

Q4OS with persistence on E2B

Q4OS is a rather nice, clean debian-based linux OS. The LiveCD ISO will boot directly from E2B.




If you want persistence with the LiveCD version, you can use the same method of creating a persistence file that we use for many other linux live ISOs.
I used an NTFS E2B USB hard disk and the q4os-live-2.0.2-i686pae.iso ISO file in the \_ISO\LINUX\MNU folder for testing.
The .mnu file I used is shown below. It will be in v1.77 Sample mnu files folder.

# For persistence: (File Name=q4os-rw  Volume Name=persistence)
# 1. click 'Create ext2/ext3 FS' in RMPrepUSB
# 2. Set the FILENAME     to:  q4os-rw
# 3. Set the VOLUME LABEL to:  persistence      <------ VERY IMPORTANT
# 4. Set amount of space you would like allowed to persist - use ext3 as it is less likely to be corrupted in use

#The persistence 'volume' needs a persistence.conf file added to it
# Boot to linux, right-click - Open Terminal window here..., and then type following 5 lines in the terminal console
#    sudo mkdir /mnt/usb
#    df               (to see which is the USB device e.g. sd3 - partition 4 should always be listed - try also sudo fdisk -l)
#    sudo mount /dev/sdb3 /mnt/usb      (always use 3)
#    echo "/ union" > /mnt/usb/persistence.conf   or try   sudo bash -c "echo '/ union' > /mnt/usb/persistence.conf"
#    sudo umount /mnt/usb

# now reboot 

iftitle [if exist $HOME$/q4os-live-2.0.2-i686pae.iso] q4os-live-2.0.2-i686pae iso PERSISTENT\n Boot using .mnu file with persistence
set ISO=$HOME$/q4os-live-2.0.2-i686pae.iso
set PF=/q4os-rw

if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
#enable parttype output
debug 1
# make empty table entry in 3rd position in ptn table
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE - PERSISTENCE MAY NOT WORK! && pause
debug 1
if not exist %PF% echo WARNING: %PF% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PF%
errorcheck on
#map ptn 4 to ISO
partnew (%E2BDEV%,3) 0x0 %ISO%
map %ISO% (0xff)
map --hook
root (0xff)
# default username usually  user
kernel /live/vmlinuz boot=live persistence components quiet splash label username=adminq
initrd /live/initrd.img

Follow the instructions carefully when creating a persistence file, in particular note the spaces in the echo "/ union" > /mnt/usb  line.

I have not done much testing and be careful to always shut down the linux session using the Shutdown button to avoid corrupting the persistence file. It is worth taking a backup of the \q4os-rw file. If you find that q4os does not boot one day due to a corrupt \q4os-rw file, you can replace the q4os-rw file with the backup file.

2 comments:

  1. Hello,
    I understood this part "# For persistence: (File Name=q4os-rw Volume Name=persistence)
    # 1. click 'Create ext2/ext3 FS' in RMPrepUSB
    # 2. Set the FILENAME to: q4os-rw
    # 3. Set the VOLUME LABEL to: persistence <------ VERY IMPORTANT
    # 4. Set amount of space you would like allowed to persist - use ext3 as it is less likely to be corrupted in use

    #The persistence 'volume' needs a persistence.conf file added to it
    # Boot to linux, right-click - Open Terminal window here..., and then type following 5 lines in the terminal console
    # sudo mkdir /mnt/usb
    # df (to see which is the USB device e.g. sd3 - partition 4 should always be listed - try also sudo fdisk -l)
    # sudo mount /dev/sdb3 /mnt/usb (always use 3)
    # echo "/ union" > /mnt/usb/persistence.conf or try sudo bash -c "echo '/ union' > /mnt/usb/persistence.conf"
    # sudo umount /mnt/usb

    # now reboot "

    but whats the content after that? looks like some sort of code (presence of if else structure) but I cant understand whtat is this for.

    I'm simply looking to find a general/genric way to make an OS persistent.

    ReplyDelete
    Replies
    1. It says 'The .mnu file I used is shown below.'
      So its all text lines in the menu file.
      See my eBooks for more info (e.g. #1 or the grub4dos eBook).
      There is no generic way to boot an ISO with persistence. They are all written by different linux developers and they all use their own different ways.
      See also my rmprepusb.com site.

      Delete