site  contact  subhomenews

Permanent saving for EasyOS live-CD

December 05, 2018 — BarryK

I posted yesterday about creating a live-CD of EasyOS, that runs totally in RAM, without any ability to save the session, that is, a pristine first-bootup every time:

http://bkhome.org/news/201812/easyos-live-cd-debut.html

However, I have reconsidered, for the sake of those who have an older computer that will not boot from USB. Now, the CD will automatically discover a plugged-in USB-stick or SD-card, and use that as the working-partition.

In the above link, I wrote about the Disk Identifier. One thing that I did not mention, the 4-byte (8 hex digits) code is for dos partitions. A Guid partition table (gpt) has a longer Disk Identifier, for example:

# fdisk -l /dev/sdc
Disk /dev/sdc: 3.7 GiB, 4005560320 bytes, 7823360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B082636C-2E48-4D76-93EC-CAD9A98383EE

What I have done with the live-CD, is it will look for a drive with disk id of 0x12345678, if found, it will use that as the working-partition. If not found, it will bootup in RAM only. This is great, it means that users who have to bootup from a CD, now have permanent storage, no need even for internal hard drive.

To create such a USB-stick is very easy. Find a spare stick, plug it in, run Gparted, and create a msdos partition table, via the "Device -> Create partition table..." menu. In my case:

image1

As my USB-stick already had a guid partition table (gpt), this gets rid of it. Regardless of what is on the stick, this gets rid of it and you have a clean slate. Then, create a partition with ext4 filesystem, to fill the drive.

Confirming, now have a dos partition table:

# fdisk -l /dev/sdc
Disk /dev/sdc: 3.7 GiB, 4005560320 bytes, 7823360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf8d6e744

However, what we want is to change the disk identifier to 0x12345678, and this can be done with fdisk. You can run fdisk by doing this:

# fdisk /dev/sdc

...then chose "x" (expert mode), then "i" to change the disk-id, then "r" to return to main menu, then "w" to write change and exit. Or, you can do it in one line:

# echo -e "x\ni\n0x12345678\nr\nw" | fdisk /dev/sdc
# sync
...please be careful that you do this to the entire drive, in my case sdc, not a partition.

Reboot the live-CD and the USB-stick is automatically discovered and used. I have stuck a label on my USB-stick, with masking tape, this can now be used for all future live-CD usage:

image2

Interested? If so, the live-CD is here:

http://distro.ibiblio.org/easyos/amd64/releases/pyro/0.9.10/

I intend to announce the release of EasyOS version 0.9.10 tomorrow. First, I want to rewrite the frugal-install tutorial, there have been so many changes. Should get that done tomorrow sometime. 

Tags: easy