USB-muistin valmisteluun tarvitaan järjestelmä, jossa GNU/Linux on jo toiminnassa ja jossa USB on tuettu. Nykyisissä GNU/Linux-järjestelmissä USB-muisti pitäisi tunnistua automaattisesti kun se kytketään koneeseen. Jos se ei tunnistu, olisi varmistuttava ytimen moduulin usb-storage olevan ladattuna. Kun USB-muisti kytketään, se kuvataan laitteeseen nimeltä /dev/sdX
, missä ”X” on jokin kirjaimista a-z. Kyseisen laitteen pitäisi ilmetä komennon dmesg tulosteesta sen jälkeen kun muisti on kytketty. Kun muistille kirjoitetaan, on sen kirjoitussuoja ehkä otettava pois päältä.
Tässä osiossa kuvatut toiminnot tuhoavat kaiken mitä laitteella jo on. Varmistu käyttäväsi USB-muistin oikeaa laitenimeä. Jos käytät väärää laitenimeä, saatat tuhota kaiken tiedon esimerkiksi koneen kiintolevyltä.
Debian CD and DVD images can now be written directly a USB stick, which is a very easy way to make a bootable USB stick. Simply choose a CD or DVD image that will fit on your USB stick. See Kohta 4.1, ”Viralliset Debian GNU/Linux romput” to get a CD or DVD image.
Alternatively, for very small USB sticks, only a few megabytes in size, you can download the mini.iso
image from the netboot
directory (at the location mentioned in Kohta 4.2.1, ”Mistä asennusotokset löytyvät?”). [6]
The CD or DVD image you choose should be written directly to the USB stick, overwriting its current contents. For example, when using an existing GNU/Linux system, the CD or DVD image file can be written to a USB stick as follows, after having made sure that the stick is unmounted:
#
cp
debian.iso
/dev/sdX
#
sync
Simply writing the CD or DVD image to USB like this should work fine for most users. The other options below are more complex, mainly for people with specialised needs.
An alternative way to set up your USB stick is to manually copy the installer files, and also a CD image to it. Note that the USB stick should be at least 1 GB in size (smaller setups are possible if you follow Kohta 4.3.3, ”Manually copying files to the USB stick — the flexible way”).
There is an all-in-one file hd-media/boot.img.gz
which contains all the installer files (including the kernel) as well as syslinux
and its configuration file .
Note that, although convenient, this method does have one major disadvantage: the logical size of the device will be limited to 1 GB, even if the capacity of the USB stick is larger. You will need to repartition the USB stick and create new file systems to get its full capacity back if you ever want to use it for some different purpose.
Jos käytät tätä otosta, riittää purkaa se sellaisenaan USB-muistille:
# 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, businesscard, or full CD) to it. Unmount the stick (sdX
/mntumount /mnt
) and you are done.
Jos USB-muistin sisältöä halutaan muokata tai halutaan tietää tarkemmin mitä tapahtuu, olisi tiedostot kopioitava muistille seuraavalla tavalla. Tämän tavan eräs etu on — mikäli USB-muisti on riittävän suuri— mahdollisuus kopioida kokonainen CD-levyn ISO-otos sille.
Nyt näytetään miten käytetään USB-muistin ensimmäistä osiota eikä koko muistia.
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[7], install an MBR using:
# install-mbr /dev/sdX
The install-mbr command is contained in the mbr
Debian package. Then create the filesystem using:
# mkdosfs /dev/sdX1
Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the dosfstools
Debian package.
Ytimen käynnistämiseksi USB-muistilta käynnistettäessä tallennetaan muistille käynnistyslatain. Vaikkakin minkä tahansa käynnistyslataimen (esim. LILO
) pitäisi toimia, on kätevintä käyttää SYSLINUX
:ia, koska se käyttää FAT16-osiota ja sen asetuksia voidaan muuttaa tekstiedostoa muokkaamalla. Mitä tahansa FAT-tiedostojärjestelmää tukevaa käyttöjärjestelmää voidaan käyttää käynnistyslataimen asetustiedoston muuttamiseen.
SYSLINUX
saadaan tallennettua FAT16-osioon USB-muistille asentamalla paketit syslinux
ja mtools
järjestelmään, ja antamalla komento:
# syslinux /dev/sdX1
Tarkista taas huolellisesti, että laitenimi on oikein. Osio ei saa olla liitettynä kun SYSLINUX
käynnistetään. Komento kirjoittaa osioon käynnistyssektorin ja luo tiedoston ldlinux.sys
, jossa on käynnistyslataimen koodi.
Liitä osio (mount /dev/
) ja kopioi seuraavat tiedostot Debianin asennuspalvelimelta muistille:
sdX1
/mnt
vmlinuz
tai linux
(ytimen ohjelmatiedosto)
initrd.gz
(käynnistysmuistilevyn levyotos)
Asennin on valittavissa tavallisena tai graafisen käyttöliittymän kera. Jälkimmäinen on alihakemistossa gtk
. Jos tiedostojen nimiä halutaan muuttaa, on huomattava ettei syslinux
osaa käsitellä muita kuin DOS:n (8.3) tiedostonimiä.
Next you should create a syslinux.cfg
configuration file, which at a bare minimum should contain the following two lines (change the name of the kernel binary to ”linux
” if you used a netboot
image):
default vmlinuz append initrd=initrd.gz
For the graphical installer you should add vga=788
to the second line. Other parameters can be appended as desired.
To enable the boot prompt to permit further parameter appending, add a prompt 1
line.
If you used an hd-media
image, you should now copy the ISO file of a Debian ISO image[8] onto the stick. When you are done, unmount the USB memory stick (umount /mnt
).
[6] A special method can be used to add firmware to the mini.iso
. First, write the mini.iso
to the USB stick. Next obtain the necessary firmware files. See Kohta 6.4, ”Puuttuvan laitetiedoston lataaminen” for more information about firmware. Now unplug and replug the USB stick, and two partitions should now be visible on it. You should mount the second of the two partitions, and unpack the firmware onto it.
# mount /dev/sdX2
/mnt # cd /mnt # tar zxvf/path/to/
firmware.tar.gz # cd / # umount
[7] Don't forget to set the ”bootable” bootable flag.
[8] You can use either a businesscard, a netinst or a full CD image (see Kohta 4.1, ”Viralliset Debian GNU/Linux romput”). Be sure to select one that fits. Note that the ”netboot mini.iso
” image is not usable for this purpose.