Installing Linux on USB – Part 7: Install Debian Linux from USB drives
Welcome to the part 7 of “Installing Linux on USB” series. In this part we will learn how to create a USB flash drive which can be used as an installation media to install Debian Linux.
Purpose: In this post we will see how can we prepare a bootable USB Debian Lenny installation media to install Debian Linux on any storage device (IDE/USB hard drives). Note that this post is a bit different than the rest of the post in the USB series as in this post we talk about preparing an “USB Installation Media” rather than talking about how to install on USB devices. So basically the end result of this tutorial would be that you can install Debian Lenny from a USB stick rather than from the traditional CD-ROMs
Background: There are many ways you can install Debian Linux (Lenny) namely:
1. Through CDs/DVDs which you can download from Debian’s website or obtain from vendors.
2. Through Floppy disks
3. Through USB sticks (We will covers this)
4. Through Network boot (PXE boot)
Method 1 is the most popular and the easiest.
Method 2 is outdated and very few people use it
Method 3 and 4 are not very straight forward although Debian people have done an excellent job to make it as simple as possible.
Step 1: Get a computer running Linux & a USB flash drive
You will need a computer which is already running Linux and a USB flash drive (a.k.a. USB stick) of size at least 256 MB which we will prepare as our installation media.
Step 2: Insert your USB stick into your computer
Insert the USB stick into the computer running Linux and make sure it gets detect by the kernel. Most of the recent kernels and Linux OS can detect USB devices on-the-fly without requiring to do anything special. You can check if the USB device got detect or not by giving the following command:
# dmesg
and you should see something like this:
[373982.581725] sd 8:0:0:0: [sdc] 4001760 512-byte hardware sectors (2049 MB)
[373982.582718] sd 8:0:0:0: [sdc] Write Protect is off
[373982.582718] sd 8:0:0:0: [sdc] Mode Sense: 03 00 00 00
[373982.582718] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[373982.584152] sd 8:0:0:0: [sdc] 4001760 512-byte hardware sectors (2049 MB)
[373982.585718] sd 8:0:0:0: [sdc] Write Protect is off
[373982.585718] sd 8:0:0:0: [sdc] Mode Sense: 03 00 00 00
[373982.585718] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[373982.585718] sdc:
[373982.589280] sd 8:0:0:0: [sdc] Attached SCSI disk
Step 3: Download the boot image file for USB device
Now download the boot.img.gz file from here.
Note: That this image corresponds to i386 architecture. You will need to find your corresponding architecture image from here. Here the architecture refers to the type of system on which you are going to install Debian Lenny.
For example, if your if you are going to install on a AMD64 machine then you need to go to /installer-amd64/ directory and download the boot.img.gz file from here.
Step 4: Prepare your USB stick to boot
Note: This step will erase all your data on your USB drive.
Now give the following command:
# zcat boot.img.gz > /dev/sdX
where sdX – is your USB device name (mine is “sdc” in this tutorial)
Now it is a good idea to remove un-plug and plug back in your USB devices so that the new partition table/structure is recognized by the Linux system. I had to do this. This refreshes the drives partition table stored by udev.
Check: You can check by giving the following command:
# mount /dev/sdX /mnt/
and you should be able to see installation files like syslinux.cfg, setup.exe, etc.
Note: There is no suffix “1″ or “2″ as is /dev/sdc1 or /dev/sdc2 once you copy the boot.img.gz image. Basically there are no partitions. The partition itself is just one big disk.
Step 5: Grab a net install or business CD image
Till now we have just prepared the USB stick to boot but we still need an installation image which we can use to install Debian. You have two options:
1. Download the netinst (Net Install) ISO image of size 150-180MB from here.
or
2. Download the businesscard image of size 40 MB from here.
Step 6: Copy the downloaded image to USB stick
Now all you need to do (as a final step) is to copy the downloaded ISO image (from above step) to your USB stick. To do this give the following command:
#mount /dev/sdX /mnt
# cp <path/to/iso/image> /mnt
#umount /dev/sdX
That’s it. You have successfully created a USB installation disk which can carry anywhere with you to Install Debian Linux. Just plugin the USB stick to the computer on which you would like to install Debian Lenny and set the BIOS to boot from USB stick. No CD-ROMs required!
Happy Installing!!!
Part 8: Review – Installing Linux on USB
Become IT expert with testking online training program. Pass your real test on first try using testking 642-813 tutorials and testking SY0-201 dumps.


Email Subscription









February 25th, 2009 at 3:27 am
[...] Part 7: Install Debian Linux from USB drives Share and Enjoy: [...]
February 25th, 2009 at 9:56 pm
[...] Part 7: Install Debian Linux from USB drives Share and Enjoy: [...]
February 26th, 2009 at 6:01 pm
[...] a USB flash drive which can be used as an installation media to install Debian Linux. Read it here Purpose: In this post we will see how can we prepare a bootable USB Debian Lenny installation media [...]
March 2nd, 2009 at 1:44 am
[...] HOWTO: Create a USB Debian Installation flash drive This is a drop-dead-simple guide in the plainest possible language to creating a bootable USB drive that will install Debian. Knowing how to do this is an important part of eliminating socially, environmentally and politically irresponsible RO media from the world. [...]
March 3rd, 2009 at 12:00 am
Great series! I will buy a netbook. However, most of them haven’t a DVD drive. A bootable pen-drive with installation image (or complete system) is very useful. Thank you!
Reply to this comment
March 12th, 2009 at 8:41 pm
[...] Part 7 [...]
March 18th, 2009 at 1:56 pm
If you have a system that has a USB port but can’t boot from it, it probably has a floppy drive. So boot from Smart Boot Manager: http://linux.simple.be/tools/sbm – I’m doing this now.
Reply to this comment
April 24th, 2009 at 10:08 am
Enjoying reading your blog. Hard work always pays off.
Reply to this comment
April 29th, 2009 at 7:17 am
Excellent tutorial. Works like a charm.
Thanks!
Reply to this comment
Admin Reply:
April 30th, 2009 at 1:29 pm
Thank you.
Reply to this comment
May 26th, 2009 at 4:38 pm
I get invalid compressed format.
Im using the larger iso image.
Im going to try the business card and see what happens.
Later
Reply to this comment
Admin Reply:
May 27th, 2009 at 1:34 am
At which step are you getting the compression error?
Reply to this comment
Kilo Reply:
May 28th, 2009 at 10:38 pm
Hey.
I figured it out.
I was using Puppy Linux to copy the files over to my usb stick, but there was no status bar as to how finished the copying was so I was assuming that it was all done when I pulled the usb stick out. This resulted in a partial .iso image copy.
Everything is fine now.
Thanks for the reply
Kilo
Reply to this comment
Admin Reply:
May 28th, 2009 at 11:09 pm
Glad to know that it worked out for you. Have fun.
Reply to this comment
June 12th, 2009 at 5:16 am
Hey I had to use the command :
sudo dd if=boot.img of=/dev/sdb
because my boot.img wasn’t with .gz …
I hope that it works :D
Thanks for the tutorial man !
Reply to this comment
June 20th, 2009 at 6:37 pm
Tried it several times. “zcat boot.img.gz > /dev/sdb” [sdb=where my flash drive appears] only spews garbage in the terminal window and doesn’t touch the drive. Eventually everything stops in the terminal window with a whole series of “-su” commands. using dd seems to have actually copied something. Of course, it blew away the partition table, making the device unbootable. Unfortunately fat16 doesn’t seem to be an acceptable filetype to Debian Etch … will try someone else’s instructions. Thanks.
Reply to this comment
henry Reply:
February 1st, 2010 at 12:20 pm
I get the same issue using zcat….
Reply to this comment
Admin Reply:
February 15th, 2010 at 10:20 am
Are you root? Also some people have reported success using “dd” command instead of zcat. See the previous comments..
Reply to this comment
July 2nd, 2009 at 10:09 am
Nice howto.
Another –maybe easier– way is:
http://unetbootin.sourceforge.net/
Reply to this comment
Haines Brown Reply:
August 18th, 2010 at 11:35 am
People report mixed results with unetbooin as of August 2010 under debian for a squeeze installation. Apparently it works for some but not others.
Reply to this comment
July 29th, 2009 at 10:47 am
I need to create the boot flash drive on a Win XP machine. Can I do this simply by creating the directory structure and copying the files in as per the above instructions?
Reply to this comment
Admin Reply:
August 5th, 2009 at 12:29 pm
You mean you need to create a Bootable USB drive with Windows XP on it? Or do you need to create a USB drive from which you can install Windows XP?
Reply to this comment
August 5th, 2009 at 1:02 pm
No, I meant create a bootable usb drive with Debian GNU/Linux on it, on a Win XP machine. But it’s ok, that unetbootin link above looks as though it will do the trick.
Reply to this comment
September 23rd, 2009 at 4:12 pm
Thanks for the tutorial.
The USB drive booted fine and went through the Debian install process without a problem until it needed to write the partition table of the disk I was installing to. The drive has been successfully detected but it fails consistently trying to create the partitions…
If I use the same ISO image and use a CDROM to install it works fine…
Any ideas??
Reply to this comment
Admin Reply:
September 23rd, 2009 at 4:34 pm
Try looking at the messages during the install process as mentioned here:
http://linux.koolsolutions.com/2009/05/06/tip-inspecting-linux-installation-process-behind-the-scenes/
Also are you trying to write/create partitions on the USB drive from which you booted? I hope not…
Reply to this comment
September 23rd, 2009 at 5:43 pm
Thanks. Appreciate the tip about the install messages. Problem solved…
I was installing over the top of an existing Linux (which I had used in the first steps of the process). It looks like, the install process searched the existing partitions for the install ISO (which was on the USB drive but also still on the old Linux install). It looks like it found the ISO on the hard drive first, and then kept the partition mounted. So of course it didn’t want to change the partition table of a mounted drive.
Reply to this comment
October 27th, 2009 at 3:51 pm
This procedure can also be accomplished in Windows using “win32diskimager-RELEASE-0.1-r15-win32″ to unpack and write the boot.img file to a boot stick and then copying the Debian ISO file on to it. It’s much simpler this way, no command line is needed and, you don’t need to have a Linux box already up and running to do it.
Reply to this comment
December 15th, 2009 at 8:51 pm
Thanks very much, this is an excellent tutorial.
Reply to this comment
January 5th, 2010 at 5:23 am
The how to is simple but as soon as I boot hte machine with the USB,
the black screen of death appears.
The pc is a pentium III compaq, and the howto not working
it is better a way with syslinux, cuz damnsmalllinux boot pendrive works great.
Reply to this comment
January 5th, 2010 at 9:11 am
it worked !! huurra
I found what was the error.
The mbr of the pendrive was not ok.
I had to do :
syslinux -s /dev/sda1
zcat procedure
then
mount and copy the iso file to the pendrive
then during the plpboot floppydisk
start pc
put floppy disk plpboot and without usb pendrive in pc
press ctrl + esc
I get plp screen
then
i place the usb pendrive in hte usb port of hte pc
plp boot pages certainly detects it
then select USB
and that s it! USB pendrive install of debian starts and pc is now installed
thank you !
Reply to this comment
January 19th, 2010 at 8:33 am
[...] instaliavimas iš USB, anks?iau kelet? kartu s?kmingai naudojausi unetbootin. Ta?iau po koki? 3 bandym?: vien? kart? instaliavo sen? versij? (nes unetbootin nelabai atnaujina šaltini? iš kur imami failai), bandant sukurt iš ISO instaliacija prasid?jo lik ir s?kmingai, bet po to nerado CD, kurio šiuo atveju ir nebuvo. Pasitel?k?s ? pagalb? google visgi radau gana nesud?ting? ir aiški? instrukcij?. [...]
February 1st, 2010 at 9:40 pm
Hi there.
Great installation help…thanks, fixed my problem.
Anyone reading this guys stuff should bookmark it.
Reply to this comment
February 12th, 2010 at 4:39 pm
Thank you for that clear explanation.
My question is what do you have to do to install the Debian system itself on the USB Flash. The above explanation seems to create and installation USB Flash in liu of an installation CD.
Thanks
Peter
Reply to this comment
Admin Reply:
February 15th, 2010 at 9:59 am
Hi Peter,
Have you seen this article?
http://linux.koolsolutions.com/2009/01/28/installing-linux-on-usb-part-2-install-debian-lenny-on-usb-hard-drive/
It exactly explains what you are looking for.
Reply to this comment
March 1st, 2010 at 10:11 pm
Heya, Thanks for the howto,
Lately I have been doing all my debian installs via this method with ONE important addendum:
On the HDD make a small fat partition as the first and zcat boot.img.gz > /dev/sdX1 then it all works out fine. use gparted later to remove the first partition.
cheers
Reply to this comment
March 15th, 2010 at 10:27 am
Thanks for the tutorial, it worked Fine.. I tryed with the unetbootin, but debain was unable to detect the Cdrom… with your tutorial it was smooth and clean.. Thenx a lot
Reply to this comment
March 24th, 2010 at 4:09 am
Thank’s, greate guide. I also had to set the boot flag on sdX1 in gparted to make it work.
Reply to this comment
March 25th, 2010 at 11:19 am
I have an ISO of Debian 4.2 GB downloaded and I want to use that instead of Business Card CD you have mentioned can you suggest how to do that.
Reply to this comment
March 31st, 2010 at 12:43 am
It isn’t working for me, it doesn’t see any image file on the USB stick (netinstall) and searches the hard disks for one. After that an error regarding kernel modules. The unetbootin method doesn’t see my keyboard even if I enable legacy support in the BIOS, weird.
Reply to this comment
Llewen Reply:
March 31st, 2010 at 5:53 am
I had this exact same problem and basically gave up. I ended up installing a cdrom so I could install the os.
Reply to this comment
Alinu Reply:
April 2nd, 2010 at 7:34 am
I tried everything descriped here http://www.debian.org/releases/stable/i386/ch04s03.html.en no success even with the other method. I also tried “dd if=debian-live-504-i386-gnome-desktop.img of=/dev/sdc” this gave another problem, something like “Insert proper boot device and press any key”. Then I tried with another distribution… Arch Linux, dd-ing the 2009.08 core .img file to the usb drive, no success at all, I ended up in a grub terminal.
The only success I had was with unetbootin and Puppy Linux (worked flawlessly, but I need Debian [which I will dist-upgrade to testing for ext4 support] or Arch Linux) and out of curiosity dd-ing a FreeBSD 8 memstick image with “bs=10240 conv=sync” parameters, though that didn’t help because all my partitions on both my HDD are ext4 and FreeBSD as far as I know doesn’t support ext4. I am thinking about doing a Debian install from my current working Arch Linux using debootstrap following the steps outlined here. But I am undecided because if it fails I will be left without a working system for a few days.
Reply to this comment
April 22nd, 2010 at 3:33 pm
I am trying to put Debian w/ LXDE onto my netbook (has not CD drive). I want to make a bootable USB drive instead that will allow me to install it to the second partition on my hard drive.
I have follow the steps in this guide, but every time I try the “zcat” procedure, the USB drive doesn’t have enough space left to copy the ISO (about 650MB) files (always just under 220MB left, no matter how big the USB drive I use).
I’ve looked up other options, but haven’t been able to make anything else work. Thanks for any thoughts.
Reply to this comment
June 10th, 2010 at 7:37 pm
use a partition editor after zcat to grow the fs
Reply to this comment
June 14th, 2010 at 1:31 pm
Nice tutorial, works perfect! Thanks for your work.
Reply to this comment
June 24th, 2010 at 9:50 pm
This was awesome, way less work than mk-boot-usb or the ways debian.org explains…
Reply to this comment
July 1st, 2010 at 7:47 am
[...] http://forums.debian.net/viewtopic.p…9&hilit=initrd http://linux.koolsolutions.com/2009/02/25/…rom-usb-drive/ http://blogs.pcworld.co.nz/pcworld/t…without_a.html [...]
July 4th, 2010 at 1:29 pm
Awesome HOWTO. Just finished installing debian onto an Acer Revo using it.
Thanks!
Reply to this comment
July 16th, 2010 at 1:11 am
Thanks for the guide! This one worked for when the other tools I downloaded to make the USB boot couldn’t do the job. Thanks alot!
Reply to this comment
August 22nd, 2010 at 11:57 am
zcat doesn’t accept gzip-compressed files on OS X. Use gzcat instead.
Reply to this comment
September 16th, 2010 at 10:04 am
thanks
i’ve tried with unetbootin with no success: the image it copies still requires CD drive during install
your howto worked perfectly.
Reply to this comment
September 22nd, 2010 at 11:09 am
After many attempts to install Debian on my laptop from my usb drive and the installer not seeing iso on usb after starting install, I finally put the iso on a flash card and after booting from the usb drive the computer saw the iso on the flash card and I was finally able to install Debian on my laptop.
Reply to this comment
October 5th, 2010 at 8:59 am
Great tutorial! Exactly what I was looking for. My slim desktop didn’t come with an optical drive. This worked like a charm. Thanks!!!
Reply to this comment
Admin Reply:
October 19th, 2010 at 4:26 pm
Glad to know that you had success on your desktop. Thanks for reporting back.
Reply to this comment
October 22nd, 2010 at 6:53 am
[...] HOWTO: Create a USB Debian Installation flash drive | Organizing … [...]
November 4th, 2010 at 12:29 pm
Have tried every available method to install ´lenny´ (unetbootin etc), i get furthest with this method, but always hit the same problem. ie installer doesn´t find the .iso image on the flashdrive,(also placed .iso on my hard drive, but it didn´t find that either.Any ideas please?
Reply to this comment
December 12th, 2010 at 10:15 pm
thanx for the tutorial. but i followed the same procedure but it didnt worked. The usb booted but hangs giving some messages. i am stuck up with that.
Reply to this comment
March 18th, 2011 at 8:21 pm
i had the same issue as some one else here. I’m wondering how this is set up, because, it creates a small partition on the flash drive. Opening it with a disk partition tool just shows the entire drive as if nothing has been done to it, there are no additional partitions. I tried copying a cd image to the drive but obviously didn’t have the space. anyone know of a work-around for this?
Reply to this comment
Chet Reply:
March 18th, 2011 at 8:29 pm
ok, just found this out. There is an error in the partition utility, it says it cannot open the partition, that there is no such file or directory.
Reply to this comment
March 23rd, 2011 at 1:48 pm
Hi,
i wanted to know how to make it possible to put multiple debian architectures for selection?
Reply to this comment
April 1st, 2011 at 9:57 am
It is possible to load the image without formating the pen-drive, I’ve used what you used, but instead of formating the drive with the img file I’ve copied this file to the pendrive, then used grub4dos (any grub should work, I used a hiren’s boot usb) and loaded the image with grub:
kernel /HBCD/memdisk
initrd debian.img
Reply to this comment
April 16th, 2011 at 5:25 am
Thank you very much. I have spent most of today wasting my time trying to create a bootable USB with other tools such as Ubuntu’s usb-creator and unetbootin. Supposedly, these tools can create a bootable USB stick using any iso file. Your method was the only method that successfully created a bootable Debian netinst for me to use with my netbook that doesn’t have a CD drive. Very helpful article.
Reply to this comment
May 1st, 2011 at 4:58 am
so bad no simple tool is offered for windows OS to create a linux stick :(
Reply to this comment
July 27th, 2011 at 4:58 pm
[...] Install Debian Linux from USB Drive [...]
October 3rd, 2011 at 10:58 pm
While installing linux on usb, is it required to create swap partition? I’m using 8GB thumb drive wherein probably 4GB it will take for swap if I let it install auto. If swap is required for such solid state device, how much space it should be assigned?
Reply to this comment
October 24th, 2011 at 7:43 pm
[...] install debian. I have an 8GB usb stick. after formatting it to fat32, I follow the instructions on http://linux.koolsolutions.com/2009/…rom-usb-drive/ but after the zcat boot.img.gz > /dev/sdX thing, df shows the drive has a total capacity of [...]
November 24th, 2011 at 3:49 pm
You may want to check this site if you decided to check out OpenSuSE.
http://jason.ferrer.com.ph/2011/08/opensuse-on-usb-reloaded_16.html
Reply to this comment
January 6th, 2012 at 2:40 pm
Great, simple, easy to follow tutorial! Thanks!
Now, how do we put grub (lilo?, ???) on the USB drive so we can have one USB thumb drive with MULTIPLE ARCHITECTURE installers on it? That would be really cool! ;-)
i.e. boot USB: choose i386, armel, amd64, etc… continue with installation for whichever machine is chosen.
Reply to this comment
January 10th, 2012 at 1:20 pm
Didn’t work for me.
It just stoped on ‘Verifying DMI Pool Data’ and did not proceed farther.
For some reason it can not boot.
Reply to this comment
January 17th, 2012 at 5:15 pm
[...] http://wiki.debian.org/BootUsb, http://linux.koolsolutions.com/2009/02/25/installing-linux-on-usb-part-7-install-debian-linux-from-u… No related [...]
January 23rd, 2012 at 10:05 pm
[...] [[Fuente]] Tags: debianinstalacionlinuxpendriveusb [...]
May 25th, 2012 at 4:18 am
these instructions worked great in puppy linux! But, i want to install debian into my existing grub4dos, and share a partition that already has puppy linux installed. Is it possible with the business card installer?
thanks
Reply to this comment
May 25th, 2012 at 4:19 am
is it possible to use this method to run debian live cd off the flash drive, instead of installing to hard disk?
thanks
Reply to this comment
October 7th, 2012 at 12:26 am
[...] lot of trouble for Debian. I found the following 3 pages very useful to prepare the bootable disk: page 1, page 2, page 3. Thanks community support, Debian is [...]