Menu

Persistence - How To

persistence (1)
Seb FAV

<-- Back to [Home]

Q4Rescue Persistence System

Thanks to the debian-live system, Q4Rescue includes a persistence feature that enables you to save parameters, installed applications, downloaded files, and more across reboots. This document explains how the persistence system works and how to set it up.

Persistence Overview

Persistence in Q4Rescue is achieved by using a partition or a file with a specific configuration. This allows you to retain data between reboots, making Q4Rescue a more versatile tool for system recovery and maintenance.

Setting Up Persistence

- Using "q4rescue usb creator" tool:

The tool "q4rescue usb creator" (linux x64 only) allow you to create a bootable device with Q4Rescue, a persistence partition and a data partition (with the filesystem of your choice). Everything described below will be done automatically by the tool.

- Creating a persistence partition:

To enable persistence using a partition, you need to have an ext4 partition with the label "persistence" on the system. This partition can be on the same media as Q4Rescue (USB, HDD, etc.) or on another storage device present on the system booted with Q4Rescue.

Steps to Create a Persistence Partition

  1. Create an ext4 Partition: Ensure you have an ext4 partition on your storage device.
  2. Label the Partition: Label the partition as "persistence". You can use tools like gparted or parted to label the partition.
    You can use too this command on linux to achieve this:
    sudo e2label /dev/$device "persistence"
    (where $device is the name of the partition device, this can be for example sda2 or sdb3 ...)

  3. Create the Configuration File: Create a file named persistence.conf at the root of the partition with the following content:
    / union
    You can for example create this file using the following command:
    sh echo '/ union' | sudo tee -a /mnt/persist/persistence.conf
    where /mnt/persist/ is the mount point of the persistence partition.

- Creating a Persistence File:

Alternatively, you can use a simple file named persistence.img (an ext4 formatted disk image) that can be placed on any writable filesystem detected on the system (USB key, or another device on the booted system).

Steps to Create a Persistence File

  1. Create the Disk Image: Create an ext4 formatted disk image. This can be done on linux using the dd command. For example:
    dd if=/dev/zero of=persistence.img bs=1M count=1024 mkfs.ext4 persistence.img
  2. Mount the Disk Image: Mount the disk image to a temporary directory, for example /mnt/persist
    sudo mkdir /mnt/persist sudo mount -o loop persistence.img /mnt/persist
  3. Create the Configuration File: Create a file named persistence.conf at the root of the mounted filesystem with the following content:
    / union
    You can create this file using the following command:
    echo '/ union' | sudo tee -a /mnt/persist/persistence.conf
  4. Unmount the Disk Image: Unmount the disk image:
    sudo umount /mnt/persist
  5. Place the Disk Image: Place the persistence.img file on any writable filesystem detected on the system.

- Persistence with ventoy:

In the case you're booting q4rescue with the help of ventoy:

  • For a persistence partition, when install Ventoy, you can enable and set the reserved space with "Option" ---> "Partition Configuration" (Windows) or "-r" option (Linux). Then, you can create a persistence partition like explained before in this free space.

  • For a persistence file, you have too the option to set reserved space at installation, format it and put the persistence file in this partition (although this is not really 'efficient', it's better in this case to directly create a persistence partition in this reserved space). If you don't have reserved space, or just want to put the persistence file in the "root" partition (ventoy), you will have to use the persistence plugin configuration for ventoy:
    First, you need to download a persistence image, here: https://github.com/ventoy/backend/releases
    Second step, create a "persistence" folder on the ventoy partition, and extract an ext4 image found in the downloaded archive with this naming schema:
    "persistence_ext4_XXX_persistence.dat.7z" where XXX can be "256MB" / "512MB" / "1GB" etc... depending on your needs. Then, decompress the chosen 7z file in the persistence folder created.
    Finally, edit the file /ventoy/ventoy.json and add these lines (for example we're using here a 1GB persistence file)
    "persistence": [ { "image": "/iso/q4rescue-livecd.iso", "backend": "/persistence/persistence_ext4_1GB_persistence.dat", "autosel": 1 } ],
    Refer to the ventoy persistence plugin documentation if you need more details: https://www.ventoy.net/en/plugin_persistence.html

Persistence Size Recommendations

The size of the persistence partition or file depends on your needs:

  • Small Size (256MB): If you only need to save parameters like Wi-Fi configurations or a few other details, a small size of 256MB can be sufficient for example.
  • Large Size (1/2GB or more): If you plan to install additional applications or need to retain a significant amount of data, a minimum size of 1/2GB is recommended.

Conclusion

By following these steps, you can enable persistence in Q4Rescue, allowing you to retain your settings, installed applications, and downloaded files across reboots. This makes Q4Rescue a powerful and customizable tool for system recovery and maintenance.


Related

Wiki: Home

MongoDB Logo MongoDB