How to install Debian from a USB drive?
Download UNetbootin, which allows one to create bootable USB installation media for almost any Linux and BSD distribution out of the box.
Just run it, select Debian, choose the usb drive and wait while it downloads the .iso and transfers it to your usb. After that it's bootable and the install works like from a CD.
If you're on Linux, the easiest way is to simply do (as per the docs):
cat debian.iso > /dev/sdX; sync
Where X is your drive letter, you can find out the correct letter by checking the output of dmesg
right after connecting your USB device. For example for me (and probably many) it would be /dev/sdb
This will wipe everything from your USB drive, so be careful!
UPDATE:
For completeness, I should also mention Rufus for Windows.
- Open Debian Download page and download the right cd / dvd for your pc. Most likely, if you have a modern computer, you'll want amd64 version. I'd suggest to choose cd because today you'll probably have a broadband connection and you'll be able to download other needed packages later very quickly.
-
If you use Linux terminal you can use dd to prepare your usb stick (iso filename in this command is just an example, you'll have to use your downloaded iso name and path:
dd if=/your/path/debian-7.5.0-i386-netinst.iso of=/dev/sdX bs=4M
sync
See Debian official instructions here.
Edit: added sync, to flush device writes before ejecting the usb device.
- Modern Debian versions include a partitioning tool and wizard, the process should be fairly easy, as pointed out in all the guides, here's one.
So far the easiest way I have found is
cp debian-7.2.0-i386-netinst.iso /dev/sdX
sync
Where X is the drive letter assigned to the devise (see dmesg right after inserting the USB)
As seen in the Debian instructions
4.3.3. Manually copying files to the USB stick — the flexible way (Debian Official Ref.)
After trying other options and some notebooks refusing to boot, I've tried this "flexible way" and it was the only one that worked for me.
Stick your new USB stick to the USB (a new one or one that you don't care to lose all data).
-
unmount it, if it has mounted automatically
- umount /dev/sdX1 (and sdX2, ...)
-
partition it (i like old-fashion fdisk)
- fdisk /dev/sdX
- d to delete all partitions
- n to create a new, using all space
- t to change the partition type to ID c: W95 FAT32 (LBA)
- a to make sure it is bootable
- w to write the changes and exit
-
Install an MBR with (I didn't need this step, so you may test. But its no harm to use it):
- install-mbr /dev/sdX
-
Create the filesystem
- mkdosfs -F32 -n "Debian85" /dev/sdX1
-
Keep it unmounted and generate the system in it:
- syslinux /dev/sdX1
-
Lets mount the USB stick:
- mount /dev/sdX1 /mnt/d2/
-
Copy some files (be certain you download them from hd-media):
- cp vmlinuz /mnt/d2
- cp initrd.gz /mnt/d2
-
Edit the file syslinux.cfg, and add the following content to it:
- vim /mnt/d2/syslinux.cfg
DEFAULT linux
LABEL linux
SAY Boot Debian Jessie 8.5 CD-1 from SYSLINUX...
KERNEL vmlinuz
APPEND ro root=/dev/ram initrd=initrd.gz vga=788
PROMPT 1
-
Copy the ISO image to the USB stick:
- cp /some/path/debian-live-8.5.0-amd64-kde-desktop.iso .
- sync
-
Unmount the stick and it is ready to boot some machines:
- umount /mnt/d2
Notes:
- If at some point you become confused about what is mounted where, don't forget to run:
lsblk -fo +size
-
A comment from my experience: if you copy the files on step 8 from your mounted ISO CD image instead of from the hd-media, then, after a successful boot, during the beginning of the installation (step "Detect and mount CD-ROM"), it will show you the message:
"incorrect cdrom / cdrom detected cannot be used for installation".
Googling it may show you problems with unetbootin
, but as you can see, this method gives the same error and doesn't use such program.
- Also, as this method keeps the USB stick available space after the process usable, it is a good idea to create a folder (use the name
firmware
so debian can find it during the install) and add to it all sorts of non-free firmware that may be needed during the installation. You can get them from this unofficial netinstall image.