To prepare the USB stick, we recommend to use a system where GNU/Linux is already running and where USB is supported. With current GNU/Linux systems the USB stick should be automatically recognized when you insert it. If it is not you should check that the usb-storage kernel module is loaded. When the USB stick is inserted, it will be mapped to a device named /dev/sdX
, where the ”X” is a letter in the range a-z. You should be able to see to which device the USB stick was mapped by running the command dmesg after inserting it. To write to your stick, you may have to turn off its write protection switch.
![]() |
Varning |
---|---|
Procedurerna som beskrivs i detta avsnitt kommer att förstöra allt som redan finns på enheten! Försäkra dig om att du använder det korrekta enhetsnamnet för ditt USB-minne. Om du använder fel enhet kommer resultatet bli att all information går förlorad på till exempel en hårddisk. |
Debians installationsavbildningar kan nu skrivas direkt till ett USB-minne, vilket är ett mycket enkelt sätt att göra en bootbar USB-sticka. Välj bara en bild (t. ex. nätinstallation, CD, DVD-1 eller NetBoot) som får plats på ditt USB-minne. Se Avsnitt 4.1, ”Officiella Debian GNU/Linux installationsavbildningar” för att få en installationsavbildning.
Alternativt, för mycket små USB-pinnar, bara några få megabyte i storlek, kan du ladda ner mini.iso avbildningen från katalogen netboot
(på den plats som nämns i Avsnitt 4.2.1, ”Var man får tag på installationsavbildningar”).
Den installationsbild du väljer ska skrivas direkt till USB-sticken och skriva över dess nuvarande innehåll. När du till exempel använder ett befintligt GNU / Linux-system kan bildfilen skrivas till ett USB-minne på följande sätt, efter att ha säkerställt att sticket är omonterat:
#
cp
debian.iso
/ dev /sdX
#
sync
Information om hur du gör detta på andra operativsystem finns i Debian CD FAQ .
![]() |
Viktigt |
---|---|
Bilden måste skrivas till hela diskenheten och inte till en partition, t.ex. / dev / sdb och inte / dev / sdb1. Använd inte verktyg som unetbootin som ändrar bilden. |
![]() |
Viktigt |
---|---|
Att bara skriva installationsbilden till USB så här skulle fungera bra för de flesta användare. De andra alternativen nedan är mer komplexa, främst för personer med specialiserade behov. |
Hybridbilden på pinnen upptar inte allt lagringsutrymme, så det kan vara värt att överväga att använda det fria utrymmet för att hålla firmwarefiler eller paket eller andra filer du väljer. Detta kan vara användbart om du bara har en pinne eller bara vill behålla allt du behöver på en enhet.
Skapa en andra FAT-partition på pinnen, montera partitionen och kopiera eller packa fast programvaran på den. Till exempel:
# mount /dev/sdX2
/mnt # cd /mnt # tar zxvf/sökväg/till/
fast-programvara.tar.gz # cd / # umount /mnt
Du kanske har skrivit mini.iso
till USB-sticken. I det här fallet behöver den andra partitionen inte skapas eftersom den, mycket snyggt, redan kommer att finnas. Att koppla ur och koppla tillbaka USB-sticken bör göra de två partitionerna synliga.
An alternative way to set up your USB stick is to manually copy the installer files, and also an installation image to it. Note that the USB stick should be at least 1 GB in size (smaller setups are possible if you follow Avsnitt 4.3.3, ”Manually copying files to the USB stick — the flexible way”).
Det finns en allt-i-ett-fil kallad hd-media/boot.img.gz som innehåller alla installationsprogrammets filer (inklusive kärnan) såväl som syslinux
och dess konfigurationsfil .
Observera att, även om det är bekvämt, denna metod har en stor nackdel: den logiska storleken för enheten kommer att vara begränsad till 1 GB, även om kapaciteten för USB-minnet är större. Du kommer att behöva partitionera om USB-minnet och skapa nya filsystem för att få dess fullständiga kapacitet tillbaka om du någon gång vill använda det för andra ändamål.
För att använda denna avbildning så behöver du bara extrahera den direkt till ditt USB-minne:
# zcat boot.img.gz > /dev/sdX
After that, mount the USB memory stick (mount /dev/
), which will now have a FAT filesystem on it, and copy a Debian ISO image (netinst or full CD/DVD) to it. Unmount the stick (sdX
/mntumount /mnt
) and you are done.
If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick. One advantage of using this method is that — if the capacity of your USB stick is large enough — you have the option of copying any ISO image, even a DVD image, to it.
Vi kommer nu att visa hur man ställer in USB-minnet att använda första partitionen, istället för hela enheten.
![]() |
Notera |
---|---|
Since most USB sticks come pre-configured with a single FAT16 partition, you probably won't have to repartition or reformat the stick. If you have to do that anyway, use cfdisk or any other partitioning tool to create a FAT16 partition[3], install an MBR using:
# install-mbr /dev/ The install-mbr command is contained in the
# mkdosfs /dev/ Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the |
In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. Although any boot loader should work, it's convenient to use syslinux
, since it uses a FAT16 partition and can be reconfigured by just editing a text file. Any operating system which supports the FAT file system can be used to make changes to the configuration of the boot loader.
För att lägga syslinux
på FAT16-partitionen på ditt USB-minne, installera paketen syslinux
och mtools
på ditt system och kör:
# syslinux /dev/sdX1
Än en gång, se till att du använder det korrekta enhetsnamnet. Partitionen får inte vara monterad när syslinux startas. Den här proceduren skriver en startsektor till partitionen och skapar filen ldlinux.sys
som innehåller starthanterarens programkod.
Mount the partition (mount /dev/
) and copy the following installer image files to the stick: sdX1
/mnt
vmlinuz
or linux
(kernel binary)
initrd.gz
(initial ramdisk image)
You can choose between either the text-based or the graphical version of the installer. The latter can be found in the gtk
subdirectory. If you want to rename the files, please note that syslinux
can only process DOS (8.3) file names.
Next you should create a syslinux.cfg
configuration file, which at a bare minimum should contain the following line (change the name of the kernel binary to ”linux
” if you used a netboot
image):
default vmlinuz initrd=initrd.gz
For the graphical installer you should add vga=788
to the line. Other parameters can be appended as desired.
Lägg till en prompt 1
-rad för att aktivera startprompt för att tillåta ytterligare parametertillägg.
If you used an hd-media
image, you should now copy the ISO file of a Debian ISO image[4] onto the stick. When you are done, unmount the USB memory stick (umount /mnt
).
[3] Don't forget to set the ”bootable” bootable flag.
[4] You can use either a netinst or a full CD/DVD image (see Avsnitt 4.1, ”Officiella Debian GNU/Linux installationsavbildningar”). Be sure to select one that fits. Note that the ”netboot mini.iso
” image is not usable for this purpose.