Setting Up A SystemRescueCD USB Key
Obtain the SystemRescueCD ISO image at http://www.system-rescue-cd.org/
Figure out which disk device is the USB key (we assume /dev/sdx in this example)
$ lsblk
Unmount any and all mounted partitions
$ sudo umount /dev/sdx1
Zero out the USB key (optional step)
$ sudo dd if=/dev/zero of=/dev/sdx status=progress
Eject, remove and reinsert the USB key (only if optional step above is included)
$ sudo eject /dev/sdx
Check the disk device assignment (only if optional step above is included)
$ lsblk
Copy the SystemRescueCD image onto the key
$ sudo dd if=systemrescuecd-6.0.7.iso of=/dev/sdx oflag=direct status=progress
Eject, remove and reinsert the USB key
$ sudo eject /dev/sdx
Check the disk device assignment
$ lsblk
Create the extra partition
$ sudo fdisk /dev/sdx
Welcome to fdisk (util-linux 2.33.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sdx: 7.2 GiB, 7743995904 bytes, 15124992 sectors Disk model: USB DISK 2.0 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: 0x5c94c26c Device Boot Start End Sectors Size Id Type /dev/sdx1 * 0 1415167 1415168 691M 0 Empty /dev/sdx2 236 3115 2880 1.4M ef EFI (FAT-12/16/32) Command (m for help): n Partition type p primary (2 primary, 0 extended, 1 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (3,4, default 3): First sector (1415168-15124991, default 1415168): 1415172 Last sector, +/-sectors or +/-size{K,M,G,T,P} (1415172-15124991, default 15124991): Created a new partition 3 of type 'Linux' and of size 6.6 GiB. Command (m for help): w The partition table has been altered. Syncing disks.
Eject, remove and reinsert the USB key
$ sudo eject /dev/sdx
Check the disk device assignment
$ lsblk
Create the filesystem in the partition
$ sudo mkfs.ext4 -L EXTRAS /dev/sdx3
Mount this filesystem and copy custom content onto it. To mount the filesystem during boot, and to use it to persist state between boots, append the following option to the "linux" command line of a grub boot menu item:
cow_label=EXTRAS