Hidden SystemRescueCd on a USB stick

I usually carry the physically smallest possible USB stick in my keychain just in case I need to move some files around or something similar. Having a USB stick capable of booting SystemRescueCd around is also something I like to have so the obvious thing is to combine these two requirements. The documentation below explains how to do it so that when the stick is used in a regular fashion in a Windows machine, the SystemRescueCd functionality isn't visible unless the partition table is viewed.

The main thing to know about Windows USB stick handling is that it will only show the first partition on the stick regardless of it's type. As a result, having a Linux partition at the beginning of the stick will not work as Windows will only see it and show an unknown stick being attached. As a result, that first partition needs to be (V)FAT or NTFS in order for it to show correctly. A second partition is still needed in order to hide the SystemRescueCd related file from view which also protects the files from accidental deletion or mishandling when the stick is connected to a Windows machine.

The following instructions assume that Linux is used. The process can however be also done using SystemRescueCd booted from a spare USB stick or actual CD.

Start by getting the latest SystemRescueCd ISO image from http://www.system-rescue-cd.org/ and then mount it using the loop device for file access

mkdir /mnt/iso
mount -o ro,loop /path/to/systemrescuecd-x86-someversion.iso /mnt/iso

Then either resize the USB stick to fit one more partition using for example gparted or erase everything. I'll asume below that the stick ends up getting called /dev/sde but results may vary depending on attached hardware. The first partition needs to be a (V)FAT or NTFS partition so when using fdisk the type is set to 'c' (W95 FAT32 (LBA)). The second partition needs to have about 1 GB of size and type set to the default '83' (Linux) and be made bootable. Then save the changes and format the partitions

mkfs.vfat /dev/sde1
mkfs.ext4 /dev/sde2

and mount the Linux partition

mkdir /mnt/sysrescue
mount /dev/sde2 /mnt/sysrescue

Now copy all the files from the SystemRescueCd iso to the second partition

cd /mnt/sysrescue
cp -vax /mnt/iso/* .

and do the setup for making the USB stick bootable (install extlinux if not available)

ln -s isolinux extlinux
cd extlinux
ln -s isolinux.cfg extlinux.conf
extlinux --install /mnt/sysrescue/extlinux

Finally, do some cleanup

sync
cd
umount /mnt/iso
umount /mnt/sysrescue

The USB stick should now be ready to use. It will boot to the original SystemRescueCd menu if used as a boot device or show the (V)FAT partition when inserted to a Windows machine. On Linux machines, both partitions are obviously visible. This process works with USB sticks over 4 GB as extlinux doesn't have problems with partition locations.

Note that with USB sticks bigger than 4 GB the Windows partition may be better to use NTFS format instead of (V)FAT if files bigger than 4 GB need to be stored without splitting.