Installing LINUX DSL to USB Flash Drive

“Hihi, berhubung hardisk dikomputer rumah RUSAK, jadi pengen manfaatin USB yang jarang kepakek. Ini tutorial yang langsung saya copy dari http://damnsmalllinux.org/wiki/index.php/Installing_to_a_USB_Flash_Drive BIAR KLO BACA LEBIH CEPET MAKSUTNYA :P”

Before going any further
Save all of your data on your USB to another storage medium, such as a CD/DVD or hard drive.

Requirements
USB Drive at least ?? in size 128MB.

From within DSL
Some things have changed since this page was originally written. Since then, an easy (and working) method to install DSL to a USB flash drive is available from within the DSL LiveCD main menu. Simply open the Main menu, go to Apps then Tools and select either a USBZIP or USBHDD and follow the prompts. See the page at USB Booting for more information.

From within Linux

* Begin by determining the location of your flash drive. It will be something like /dev/sda

fdisk -l

* Check your syslinux version and upgrade it if you want FAT32 support. (Syslinux 2.11 works for FAT16; Syslinux 3.35 works for FAT32) Compile & install the latest syslinux from http://www.kernel.org/pub/linux/utils/boot/syslinux/
* If you need to wipe the MBR on the Flash Disk, do it with a command like below. This shouldn’t be necessary unless there’s another funky bootloader in the MBR (like, if you were experimenting with another bootable USB linux distro).

dd if=/dev/zero of=/dev/sdX bs=512 count=1

( BE *VERY* CAREFUL NOT TO WIPE YOUR HARD DRIVE’S MBR HERE!!!)

Then install http://ms-sys.sourceforge.net/ and put another MBR in its place:

ms-sys -s /dev/sdX

Another way to put MBR in its place is using ‘mbr.bin’ 512 bytes file from the Syslinux package:

locate mbr.bin
cat /somepath/share/syslinux/mbr.bin > /dev/sdX

* Run fdisk on /dev/sdX, so it looks like this:

Device Boot Start End Blocks Id System
/dev/sdX1 * 1 1021 253177 b W95 FAT32

Use d to delete existing partitions until none remain. Use n,p,1 to create a new primary partition. Use a to make it bootable. Use t,b to make it W95 FAT32. Don’t forget to hit ‘a’ to make it bootable!

Use ‘w’ to save the changes and exit

* Download the dsl-embedded zipfile
* Create a FAT16 or FAT32 partition on the pendrive: mkfs.vfat -F 32 /dev/sdX1 (“-F 32″ will do FAT32; “-F 16″ will do FAT16)
* Mount the pendrive & unzip the dsl-embedded.zip file onto this.
* Unmount the pendrive
* run “syslinux -s /dev/sdX1″ (without the quotes) to make it bootable.
* You can now boot via QEMU (from within Linux or windows), OR as native from the USB drive.
* You can also run DSL from a GRUB bootloader menu on your USB key. This is very useful if you’re using DSL as part of a data/system rescue toolkit, as you can include multiple preset configurations of DSL as well as other utilities.

Note: syslinux needs the package “mcopy” included in the package “mtools”.

Note: Unfortunately, this method does NOT give a 50MB Linux Distribution because qemu dir and method is (comparatively) big. You will end up with a 110MB distribution.

Note: The iocharset=utf8 option when mounting the USB stick may result in the “KNOPPIX/KNOPPIX” not being found upon booting.

Method I: Using GRUB as boot loader

Note: This method has been reported not to work under certain conditions

* Download the current.iso dsl-cd image.
* Create an ext2 partition (=> 51MB) on pendrive. Mount it.

mke2fs -v -L “DSL” /dev/
mkdir -p /tmp/pendrive
mount /dev/ /tmp/pendrive/

where is the corresponding file which represents your USB storage device/partition.

Note: ext3 is ok too.

* Change to the directory where you mounted the ext2 partition, install GRUB boot loader:

cd /tmp/pendrive/
grub-install –no-floppy –root-directory=. /dev/

Note: Replace with the corresponding file which represents your USB storage device/partition. For example /dev/sdc1

Note 2: This method did not work for me, I used the manual method of running grub and entered “root (hd1,1)” and “setup (hd1)” (your paths will probably vary).

* Copy the contents of the cd image to the usb drive.

mkdir /tmp/dsl-cd
mount [/path_to/]current.iso /tmp/dsl-cd/ -o loop
cp -vR /tmp/dsl-cd/* /tmp/pendrive/

* While in the same directory – where you mounted the ext2 filesystem – create a menu.lst file for grub in the directory ./boot/grub/menu.lst

cat > /tmp/pendrive/boot/grub/menu.lst << EOF
title Damn Small Linux
root (hd0,0)
kernel /boot/isolinux/linux24 root=/dev/sda1 ro lang=us toram noeject frugal
initrd /boot/isolinux/minirt24.gz
boot
EOF

Note: You might have to change (hd0,0) to the correct partition for your USB drive. However, the default should work on most systems.

* Unmount the filesystem.
* You can now boot from your USB storage device.

Method II: Using GRUB as boot loader

Someone found the above process doesn’t work and has documented for others this working process

The Situation:

* Running SLED 10 (Suse)
* The USB key is a 1GB and appears as /dev/sda
* Logged in as root
* The DSL ISO is downloaded to /root/Desktop/dsl-3.3.iso
* Two partitions, the first to use as general USB storage, the second for DSL
* The DSL partition wanted to be ext3 so that Windows doesn’t mess it up
* The first partition needs to be the big storage one as Windows doesn’t like addressing the second partition on flash drives

The procedure:

* fdisk /dev/sda
o d – Delete all partitions on the key
o n – Make a partition
+ p – Primary partition for general storage
+ 1 – First partition
+ 1 – From the first block
+ 948 – Most of the space, about 933MB
o n – Make a partition
+ p – Primary partition for DSL
+ 2 – Second partition
+ 949 – Start from the next available sector
+ 1012 – To the end of the disk. I give it 64MB
o a – Make the partition bootable
+ 2 – Mark the DSL partition bootable
o t – Change the partition type
+ 1 – Change partition 1
+ b – Change it to Win95 FAT32
o w – Write the changes
* fdisk -l – Gives the following output:

Device Boot Start End Blocks Id System
/dev/sda1 1 948 954131+ b W95 FAT32
/dev/sda2 * 949 1012 64416 83 Linux

Your flash drive should now look like this

* mkdir /mnt/iso
* mkdir /mnt/usb
* mount -o loop /root/Desktop/dsl-3.3.iso /mnt/iso
* mke2fs /dev/sda2

Note: If you want to have an ext3 filesystem, add the -j flag: mke2fs -j /dev/sda2

* mount /dev/sda2 /mnt/usb/
* cd /mnt/iso
* tar cvf – . | (cd /mnt/usb; tar xvf – )
* mkdir /mnt/usb/boot/grub
* cp /boot/grub/*stage* /mnt/usb/boot/grub/
* cat > /mnt/usb/boot/grub/menu.lst << EOF

title Damn Small Linux
root (hd0,1)
kernel /boot/isolinux/linux24 root=/dev/sda1 ro lang=us toram noeject frugal
initrd /boot/isolinux/minirt24.gz
boot
EOF

* cd /mnt/usb/
* grub-install –no-floppy –root-directory=. /dev/sda
* cd /root
* umount /mnt/usb
* umount /mnt/iso
* rm -r /mnt/iso
* rm -r /mnt/usb

From within Windows

Note: This guide assumes that your USB Flash Drive is “F:”. Please replace “F” with the correct drive letter.

There are two methods. For either method, you will need:

* A USB flash drive (also called flash disk, pendrive, USB stick…)
* Download “dsl-embedded.zip” from http://www.damnsmalllinux.org/download.html (49Mb – The Torrent is recommended, and is often the fastest)

Method I

1. Format your flash drive, from cmd.exe (the “DOS” window) type:

FORMAT F: /fs:FAT32

2. Unzip “dsl-embedded.zip” to your flash drive (you could use the “Extract all files” built into XP with the destination as “F:\”)
3. Download Syslinux – Syslinux can also be used by various other platforms, such as Unix.
4. Go to a command prompt and run syslinux for your drive from \win32\syslinux.exe typing

SYSLINUX -ma F:

# If you are running Windows Vista, remember to start cmd.exe as Administrator, otherwise the normal cmd.exe won’t be able to access the MBR of your USB drive. # reboot. Note: Booting from USB may or may not work on your computer, mostly dependent on its age and bios setup. Some systems may have problems booting from USB drives formatted as FAT32. Changing the format step to

FORMAT F: /fs:FAT

may allow DSL to boot.

Method II

For this method, you will need “HP USB Key Utility for Windows”, from http://h18007.www1.hp.com/support/files/server/us/download/23839.html?jumpid=reg_R1002_USEN

1. Install “HP USB Key Utility for Windows”
2. Plug in the flash disk and let windows find it (check the letter assigned to your flash disk i.e. F:)
3. Run Start Menu-> Programs -> HP System Tools -> HP Drive Key Boot Utility
1. On Welcome Screen – click Next
2. Select your flash drive letter (in my case F:) – click Next
3. Choose Create New or Replace Existing Configuration – click Next
4. Choose Hard Drive – click Next
5. Choose Create New Filesystem – click Next
6. Wait until the drive is formated…
7. Choose HP Firmware Flash Package – click Next, click Finish.
4. Now extract the content of the dsl-embedded.zip file directly onto your flash disk (F: in my case) overwriting all files(!!).
5. Done! Your DamnSmallLinux on USB is ready :-) Reboot and try it!!

NOTE: This method would not work for me using DSL v3.3 with a Sandisk Cruizer Titanium USB drive.

Convert .iso to USB installation

With the guide from [1] you can install the .iso contents non-destructiveley onto a USB partition. Leave out all the partitioning or formating stuff to prepare an existing and used USB drive for DSL booting:

Note: All path names are examples! Please adapt or you may corrupt existing partitions or files.

* Mount USB drive, with e.g. mount /dev/sda1 /flash – can be either FAT16 or FAT32!
* Mount ISO image, with e.g. mount /tmp/dsl-3.2.iso /tmp/iso -o loop
* Copy all contents from ISO to USB drive: cp -vr /tmp/iso/* /flash/
* Rename and move syslinux files to root directory: mv /flash/boot/isolinux/* /flash/
* Rename isolinux.cfg: mv /flash/isolinux.cfg /flash/syslinux.cfg
* Unmount USB drive: umount /flash
* Install syslinux: syslinux /dev/sda1 and eventually set the MBR boot flag for this partition (with fdisk).

Questions

* Why does DSL installed on USB disk won’t finish booting after conversion from .iso?
o It appears that KNOPPIX file is hard-wired to seek for CD-ROM and not USB drive. Use embedded version.

* Why does the from-within-Linux method require FAT16, but the Windows method work with FAT32? Could I just leave and reuse an existing FAT32 USB partition using the Linux syslinux version?
o Either method should work however, as per previous notes, using FAT might provide better results than FAT32.
o Syslinux is the key reason for FAT16 vs. FAT32… CentOS 4.4 (which is essentially Red Hat ES4) comes with syslinux 2.11 which does not support FAT32. Syslinux 3.35 (the latest, as of this writing) works with FAT32 just fine.

* Why my keyboard and usb mouse do not work when I entered X windows?
o Try to enable ‘usb device emulation legacy’ entry in your bios setup.

Modifications for v 3.2 Embedded

After installation I added autorun.inf penguin.ico /USB /tightvnc

Trying to run the dsl-linux.sh in my distro did not work I had to modify the file (it was setup for a second drive and qemu did not exist in the download)

Here are some configuration settings that I found I had to modify after the installation. I also created an autorun.inf that works flawlessly with this. The autorun.inf file is also configured for use of TightVNC if the folder tightvnc is created at the root of the drive. I also created a context link to the folder USB.

* autorun.inf

[autorun]
icon=penguin.ico
label=Damn Small Linux
open=dsl-base.bat
action=Run Damn Small Linux in qemu
shell\vncviewer\command=tightvnc\vncviewer.exe
shell\vncviewer=Run the VNC Viewer Application
shell\tightvnc\command=tightvnc\tightvnc-1.2.9-setup.exe
shell\tightvnc=Run the TightVNC Server Installation
shell\usbfolder\command=”explorer.exe USB\”
shell\usbfolder=Open the USB folder in Windows Explorer

This next file I modified and paired up with the windows equivalent so you do not have to answer the questions every boot. Some people might find the -m 256 beyond and should change as needed.

* dsl-linux.sh

qemu/qemu -L qemu/ -no-kqemu -soundhw sb16 -m 256 -localtime \
-kernel linux24 -initrd minirt24.gz -hda KNOPPIX/KNOPPIX \
-append “qemu vga=791 quiet noscsi nousb nofirewire atapicd noideraid \
noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce frugal”

You must also download qemu and copy these files to the qemu dir on the usb drive.

* qemu
* qemu-img
* qemu-i386

If you wish to use the rest of the context menu I’ve created, download the TightVNC installer, vncviewer and put them in a \tightvnc.

At this point I made all of the damn small linux files hidden and hid the TightVNC, USB folders. Its a low level of security but works nicely. To use anything you just right click the drive in My Computer.

2 Tanggapan

  1. lah, kok copas saja artikelnya?
    saya kira anda terjemahkan ke dalam bahasa yang anda mengerti ? hee… btw… thanks sudah susah2 posting, semoga ada tutorial dalam bahasa indonesia :p

  2. Coba untuk dimengerti!
    Thx

Berikan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Logout / Ubah )

Twitter picture

You are commenting using your Twitter account. Logout / Ubah )

Facebook photo

You are commenting using your Facebook account. Logout / Ubah )

Google+ photo

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.

%d blogger menyukai ini: