Page 1 of 1

Live USB flash drive

Posted: Sun Jul 02, 2023 2:18 pm
by psychlone
I'd like to know whether the system on an MX live USB flash drive without persistence will ever write to that drive (logs, for example) or whether all logs etc. stay in RAM. I don't imagine it'll make a difference, but in case it does, it's MX19.3 live running on a mac mini late 2012, Core i7 2.3 MHz processor, 8 GB RAM and reading files from an external hard drive. Sorry if this has been answered already, but I couldn't find it in the manual, wiki or forum. Thanks.

Re: Live USB flash drive

Posted: Sun Jul 02, 2023 6:42 pm
by Charlie Brown
Without persistence (unless you "remaster" manually) everything will be just temporary, till you shut down.

Re: Live USB flash drive

Posted: Sun Jul 02, 2023 6:50 pm
by CharlesV
Without persistence, nothing is written to the USB. I believe I saw some place in this forum that talked about creating a method to have it write TO a hard drive if available, however that had to be setup in the liveUSB before writing it. (or set every boot otherwise.)

What I have done in the past, is to setup my own LiveUSB, and have it look for a specific hard drive partition with a set of scripts on that hard to run if found. Those scripts then setup and would use a predefined ( and pre-existing ) data area, complete with: documents, pictures, configs, scripts and logs all on the hard drive.) One of the scripts set logging locally on the hard drive as well.

What I have been using more and more, is a LiveUSB where I recover the 'extra' space' back, and then setup a data partition for me to write too - only if I need it. ( say you use a 64gb usb stick, I set it up so that I have LiveUSB partition and then remaining gigs usable ( 60gb ish ) as a data partition.) This works REALLY well for me, as the liveUSB is always the same as when written, and only I get to write to the 'Data' partition - when I want to!

Re: Live USB flash drive

Posted: Sun Jul 02, 2023 7:40 pm
by fehlix
psychlone wrote: Sun Jul 02, 2023 2:18 pm I'd like to know whether the system on an MX live USB flash drive without persistence will ever write to that drive (logs, for example) or whether all logs etc. stay in RAM. I don't imagine it'll make a difference, but in case it does, it's MX19.3 live running on a mac mini late 2012, Core i7 2.3 MHz processor, 8 GB RAM and reading files from an external hard drive. Sorry if this has been answered already, but I couldn't find it in the manual, wiki or forum. Thanks.
On writeable LiveUSB e.g. generated with MX/antiX LiveUSB Maker tool,
there are some "state" files which will be written to the the LiveUSB.
The term "persistence" is normally used in regard to save of root- or home persistence.
But even without persistence The liveSystem can be setup in a way to save
state files.
Those can be machine-specific state files, something like wifi-connections,
but also general state files. Also some logs can be written like remaster.log.
Have a look int /antiX/state directory.
I think those what can be saved, are somewhre adjustable, but need to have a look to find those settings.
I believe those files

Code: Select all

/antiX/state/machine-state-files
/antiX/state/general-state-files
will list what will be saved.

Re: Live USB flash drive

Posted: Sun Jul 02, 2023 8:35 pm
by CharlesV
@fehlix a question: Wouldnt those 'state logs' invalidate a crc check on the LiveUSB?

Re: Live USB flash drive

Posted: Sun Jul 02, 2023 11:03 pm
by figueroa
Anything you want to survive shutdown or reboot, save in ~/Live-usb-storage.

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 3:03 am
by fehlix
CharlesV wrote: Sun Jul 02, 2023 8:35 pm @fehlix a question: Wouldnt those 'state logs' invalidate a crc check on the LiveUSB?
The /antiX/state folder is on the LiveUSB main ext4 partition outside the persistence files rootfs/homefs.
So something, what user can do by writing directly onto the LiveUSB into /Live-usb/storage/demo, which is bind-mounted onto /home/demo/Live-usb-storage during the live session.
So any check sums are not invalidated by this.

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 11:00 am
by psychlone
Thank you all for the replies.

To be clear, my preference is for nothing to be written to the USB stick by the system. I am using the live usb to play music from an external hard drive and nothing else: I won't ever update it, I won't remaster it, I won't go online with it, I won't save files to it. Perhaps I should also mention that it's been produced from a snapshot (with accounts) of a system that's been set up as I want it, so there will be no changes made during operation that need to be saved. As far as I can see, having the system write to the drive gives no advantage, and has the disadvantage of wearing the drive out quicker.

Would I be right in thinking that if I edit GRUB at boot with a 'toram' parameter so that everything runs in RAM, nothing will get written to the USB drive (obviously I could dismount and remove the stick after booting so that it wouldn't be available for writing to, but I'd prefer not to do that because my Mac is tucked away in a fairly inaccessible place, and also the arrangement of USB ports on it is designed for people with smaller hands than mine).

@fehlix - thank you very much for the information about the state files. Do you know whether, during any given session, the state files are read at any time after they've been written to in that session? What I'm thinking is that if their only purpose is to carry information over to the system after reboot, I could edit /antiX/state/machine-state-files and /antiX/state/general-state-files so that nothing gets written from now on (leaving in place the files currently in the folders /antiX/state/general and /antiX/state/machine), and it would do no harm (given that there won't be any changes that I want kept). Is that right?

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 11:06 am
by fehlix
psychlone wrote: Mon Jul 03, 2023 11:00 am Thank you all for the replies.

To be clear, my preference is for nothing to be written to the USB stick by the system. I am using the live usb to play music from an external hard drive and nothing else: I won't ever update it, I won't remaster it, I won't go online with it, I won't save files to it. Perhaps I should also mention that it's been produced from a snapshot (with accounts) of a system that's been set up as I want it, so there will be no changes made during operation that need to be saved. As far as I can see, having the system write to the drive gives no advantage, and has the disadvantage of wearing the drive out quicker.

Would I be right in thinking that if I edit GRUB at boot with a 'toram' parameter so that everything runs in RAM, nothing will get written to the USB drive (obviously I could dismount and remove the stick after booting so that it wouldn't be available for writing to, but I'd prefer not to do that because my Mac is tucked away in a fairly inaccessible place, and also the arrangement of USB ports on it is designed for people with smaller hands than mine).

@fehlix - thank you very much for the information about the state files. Do you know whether, during any given session, the state files are read at any time after they've been written to in that session? What I'm thinking is that if their only purpose is to carry information over to the system after reboot, I could edit /antiX/state/machine-state-files and /antiX/state/general-state-files so that nothing gets written from now on (leaving in place the files currently in the folders /antiX/state/general and /antiX/state/machine), and it would do no harm (given that there won't be any changes that I want kept). Is that right?
Probably both,
* toram and pullout the stick after boot
* remove any entries within the state-files

Re: Live USB flash drive  [Solved]

Posted: Mon Jul 03, 2023 11:18 am
by fehlix
psychlone wrote: Mon Jul 03, 2023 11:00 am To be clear, my preference is for nothing to be written to the USB stick by the system. I am using the live usb to play music from an external hard drive and nothing else: I won't ever update it, I won't remaster it, I won't go online with it, I won't save files to it.
Maybe just create a non-writable/read-only LiveUSB by using dd-dump mode
either within Live USB Maker dd-dump mode.
Or any other iso-to-usb image-writer tool.
E.g on command line with dd-live-usb

Code: Select all

dd-live-usb --help
Usage: dd-live-usb [<options>]

A save and convenient way to make a "dd" live-usb from a .iso file.
Will prompt you for the file and for the device to write to if they
are not given on the command line.

Options:
  -C --color=<xxx>       Set color scheme to off|low|low2|bw|dark|high
                         (default is high)
  -F  --force=usb        Disable safety check that ensures we only write to usb
                         and removable devices
  -f  --from=<file>      The iso file to copy
  -h  --help             Show this usage
  -P  --progress=<type>  Type of progress indicator: bar|percent|none
                         (the default is bar)
  -t  --to=<device>      The device to write to
  -v  --version          Show the version number and date

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 1:07 pm
by anticapitalista
There is also a nosavestate option you could add manually to the live boot menu

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 2:31 pm
by psychlone
Thanks @fehlix . I thought I'd used dd when making the live USB, but I'd got my sticks mixed up (I have many) and I was looking at one where the persistence option had been been checked in Live USB Maker. I've just redone that one with dd (since I have no use for persistence on it) and the state-files and folders are absent. Thanks very much for your help.

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 2:40 pm
by psychlone
Thanks for the tip @anticapitalista - I hadn't come across that parameter before, and I think I might have a use for it in the future when booting a full install.

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 3:42 pm
by Charlie Brown
psychlone wrote: Mon Jul 03, 2023 2:40 pm... might have a use for it in the future when booting a full install.
https://mxlinux.org/wiki/system/boot-parameters/#Loading%20Modules wrote:
savestate (LiveUSB Only) Save certain “state” files across reboots even without persistence enabled. Also save certain machine-specific state files across reboots. You can control which files get saved by editing the files /live/boot-dev/antiX/state/general-state-files and /live/boot-dev/antiX/state/machine-state-files. Those files and the directory they are in will be created automatically the first time you boot the LiveUSB. This is enabled by default and it is “sticky” so once you enable it it will stay enabled until you turn it off. See below.

nosavestate (LiveUSB Only) disable saving state files. See description above. This too is sticky so when you use it saving state will stay disabled until you re-enable it.

Re: Live USB flash drive

Posted: Mon Jul 03, 2023 4:11 pm
by psychlone
Thanks @Charlie Brown . I guess I might not have a use for it, then. Still, you never know: if I start using persistence again it could come in useful.