I have a 4GByte-USB-Stick and want to install Debian on it, so I can carry Debian in my pocket and user (almost) any PC.

Prepare the Stick

Inside the Host-OS

Note, I use Debian to create this stick, folowing packages should be installed

apt-get install debootstrap gparted grub
# mkdir /mnt/usb
# mount /dev/sdh2 /mnt/usb/
# debootstrap --arch i386 stable /mnt/usb
# chroot /mnt/usb

Inside the USB-Stick (chroot)

apt-get install less vim locales ssh console-setup
dpkg-reconfigure locales
apt-get update
apt-get install linux-image-686
  • Ignore the error messages about df not working: we did not mount /proc
apt-get install grub
  • Grub also complains a lot. Ignore this to. When Grub asks if you are sure you do not want to install grub in a partition, say yes.

Install Grub

From the host-OS (not USB Stick!)

grub-install --recheck --root-directory=/mnt/usb /dev/sdh
 
menuentry 'boot Debian' {
        insmod part_msdos
        insmod ext2
        search --no-floppy --fs-uuid --set root <your UUID here>
        echo    'Loading Linux'
        linux   /vmlinuz root=UUID=<your UUID here> ro  quiet
        echo    'Loading initial ramdisk'
        initrd  /initrd.img
}


You are done, boot on your USB stick and do what you want on your new Debian GNU/Linux! I used the chroot to install kde (kde-plasma-desktop), iceweasel and so on, so I can do something else during the installation.

What next

Sources

http://www.flimzy.com/index.php/Install_Debian_on_USB

Page last modified on 24.01.2013 23:59 Uhr