How to install a Mandriva Linux distribution on a USB key? mkusb Howto * Requirements: - A working urpmi configuration - Root access - Free hard drive space (key size) * Basic use: You need to 'chown root mkusb' and 'chmod 4755 mkusb' first mkusb -b /tmp_dir/ -k NAME sda 20m This will create into /tmp_dir/NAME a chrooted installation, then use /tmp_dir/tmp/ to create a read-write ext2 loopback root.img with 20 MB of free space, and a read-only compressed loopback usr.clp. The key found in /dev/sda will be reformated (all data lost) with a /dev/sda1 FAT16 partition and a /dev/sda5 ext2 /home partition with root.img and usr.clp on it. The FAT16 partition will contain the /boot directory and will be syslinuxed. * Step by Step If you want to perform only one step, or change some configuration after a specific step, the full sequence can be performed with: create the chroot: mkusb -b /tmp_dir/ --chroot NAME extra_rpm_1 extra_rpm_2 ... extra_rpm_n perform post_install: mkusb -b /tmp_dir/ -p NAME patch rc.sysinit: mkusb -b /tmp_dir/ -s NAME rebuild the initrd: mkusb -b /tmp_dir/ --initrd NAME prepare the images: mkusb -b /tmp_dir/ -i NAME 20m sda create the key: mkusb -b /tmp_dir/ -k NAME sda * Technical details - The technology is quite basic, it is not default though, the linuxrc script of the initrd is patched to mount the root.img loopback as root. I had quite some issues with the nash interpreter, and have to delay the USB initialisation from 5 seconds to 15 seconds (it tooks about 9 seconds on my machine, guessing some configuration may be slower). - rc.sysinit is also patched to gzloopmount /usr, however I think this just can be done with fstab using 'gz' encryption - You need a system able to boot USB removable device to boot directly from the key, if you cannot boot USB, you can make a boot.iso (http://ylraw.free.fr/files/mkusb/boot.iso) to boot with a CD and then use the key - Once your chroot is created, you do not need to rebuild it each time to add a package or change the configuration, just perform a urpmi --root /tmp_dir/NAME file.rpm to install a new package. * Bugs / missing features - Packages list are (more or less) hardcoded, providing a file with package list should be more flexible - Syslinux is used with a FAT16 partition, grub or lilo should be more suited if kernel upgrade are performed - /usr is read-only, but compressed, the saved space is about 70% of a non compressed /usr, moreover / is read-write, so extra package could be installed in / (but need to be modified). We could imagine, nevertheless, a update mode where /usr is uncompressed on a harddrive, the packages added, and then compressed back. I could also add a swith for a read-write non compressed /usr (and be able to swith to a compressed version when space is needed) - /boot is not correctly mounted (ususally /dev/sda1), because AFAIK there is no label support for FAT partition. - The system is right now barely configured, and some preconfiguration as well as globetrotter like initscript will be necessary to have it really usable. - There is no user preconfigured, this should be performed at the first boot. - Have a better layout for this /dev/sda1 containing /boot, not easy to autodetect - Umounting filesystems is likely to be quite problematic