Installing to a USB Flash Drive cn
From DSL Wiki
This page in other languages: English (英文), Español
Contents |
准备
为防止数据丢失,事先将U盘上的所有数据保存在另外的存储介质上,如CD/DVD 或硬盘。
U盘容量需求
USB盘容量至少需要 128M,如果>=512M 则更好。
在DSL内安装
从本页最初完成到现在情况已经有了一些改变。从那时起,将DSL安装在USB Flash盘上的简单方法是通过DSL LiveCD的主菜单。打开主菜单--Apps--Tools,选择USBZIP或USBHDD,然后依照提示进行。 查看【USB Booting】页获得更多信息。
在Linux内安装
- 确定Flash盘的位置。 一般为 /dev/sda
fdisk -l
- 检查Syslinux的版本,如果要支持FAT32请升级。 (Syslinux 2.11 支持 FAT16; Syslinux 3.35 支持FAT32) 编译安装最新的syslinux,从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).
BE *VERY* CAREFUL NOT TO WIPE YOUR HARD DRIVE'S MBR HERE!!! Replace sdX with the path to your USB drive
dd if=/dev/zero of=/dev/sdX bs=512 count=1
Then install http://ms-sys.sourceforge.net/ and put another MBR in its place:
ms-sys -s /dev/sdX
OR, 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: ("-F 32" will create a FAT32 partition; "-F 16" will make a FAT16 one)
mkfs.vfat -F 32 /dev/sdX1
- Mount the pendrive & unzip the dsl-embedded.zip file onto this.
- Unmount the pendrive
- Next use syslinux to make it bootable.
syslinux -s /dev/sdX1
- 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.
选择1:使用GRUB作为启动加载器
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/<device> mkdir -p /tmp/pendrive mount /dev/<device> /tmp/pendrive/
where <device> 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/<device>
Note: Replace <device> 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.
选择2:使用GRUB作为启动加载器
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
- d - Delete all partitions on the key
- 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
- 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
- a - Make the partition bootable
- 2 - Mark the DSL partition bootable
- t - Change the partition type
- 1 - Change partition 1
- b - Change it to Win95 FAT32
- 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/sda2 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
在Windows内安装
- 注意:安装指南中假定你的U盘盘符为“F:”,请替换“F”为你自己的U盘盘符。
用两种方法。无论哪种方法,你都需要:
- 一个USB 闪存驱动器(也叫闪存盘,笔驱动盘(pendrive), USB 记忆棒……)
- 从[1] - 下载“dsl-embedded.zip”文件(大小约49M,建议从Torrent下载,通常速度更快)
方法I
- 从cmd.exe(DOS窗口)内格式化闪存盘,命令:
FORMAT F: /fs:FAT32
- 展开“dsl-embedded.zip”到闪存盘(你可以使用XP内置的“展开所有文件”到目标盘,如“F:\”)
- 下载Syslinux - Syslinux,该程序也可以用于其它平台,如Unix。
- 在命令行提示符下运行win32版本的syslinux.exe:
SYSLINUX -ma F:
- 如果运行在Windows Vista平台,记得以管理员权限启动cmd.exe,否则在cmd.exe下不能存取U盘的MBR(主引导根目录)。
- 重启机器。
注意: 对于太老旧的或者BIOS设置不对的计算机,可能从USB引导功能无法实现。一些系统可能无法从格式化为FAT32格式的U盘引导。改变U盘格式化的格式,命令是:
FORMAT F: /fs:FAT
(**) 反馈:按照上述方法,有人无法从U盘引导计算机YMMV。能够引导:
- (2007/9/27 Hp T5515 thinclient,没有问题,一般的(Generic)512M U盘, fat32, 嵌入版本DSL 3.4.3)
- (2007/10/16 组装的双core PC机,没有问题。Adata JOGr 2G U盘,FAT32,嵌入版本DSL 3.4.4)
- (2007/11/25 Asus EEEpc(华硕EEEpc), 没有问题。一般的(Generic)128M U盘,FAT32,嵌入版本DSL 4.0)
- (2007/12/12 Memorex Travel U盘, 没有问题。 1GB U盘,FAT32)
方法 II
注意:HP USB Key Utility 在Vista 下不能执行。
在http://www.althack.com/2006/03/10/how-to-run-linux-on-a-usb-drive/有图文版。
从http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&mode=3&taskId=135&swItem=MTX-UNITY-I23839下载“HP USB Key Utility for Windows”。
- 安装“HP USB Key Utility for Windows”
- 插入U盘,windows自动查找,记下U盘所占用的盘符,如F:。
- 执行开始->程序-> HP System Tools -> HP Drive Key Boot Utility
- 在欢迎屏上,单击下一步
- 选择U盘所在盘符,单击下一步
- 选择创建新盘或者替换已有配置,单击下一步
- 选择硬盘,单击下一步
- 选择创建新的文件系统,单击下一步
- 等待完成U盘格式化……
- 选择“HP Firmware Flash Package”,单击下一步,单击完成。
- 现在展开dsl-embedded.zip文件内容到U盘,如果有替换文件的提示,选择“替换所有文件”(切记!!)
- 完成!DamnSmallLinux U盘准备好了 :-) 重启计算机,试试看DSL吧!!
注意: 对我而言,DSL v3.3 + Sandisk Cruizer Titanium U盘无法工作。
方法 III
转自Linxusir.org/bbs:无需光驱 运行DSL LINUX的最简单方法 (适用于WINDOWS用户,非虚拟机)
- 下载DSL的ISO,和软盘启动镜像文件IMG.
- 下载虚拟软驱,VFLOPPY.
- 用VFLOPPY虚拟DSL的软盘镜像。
- 用WINRAR解压DSL的ISO文件,得到knoppix文件夹,将这个文件夹拷贝到你硬盘的第一个FAT分区。(ntfs无效)
- 重启,在启动项中选择虚拟软驱启动。OK.
注意:这种方法可以以只读的方式访问KNOPPIX文件夹所在的FAT分区。
转换 .iso 到 U盘的安装
With the guide from [2] you can install the .iso contents non-destructively 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/sdx1 /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/sdx1 and eventually set the MBR boot flag for this partition (with fdisk).
问与答
- Why does DSL installed on USB disk won't finish booting after conversion from .iso?
- 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?
- Either method should work however, as per previous notes, using FAT might provide better results than FAT32.
- 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?
- Try to enable 'usb device emulation legacy' entry in your bios setup.
对 3.2 嵌入版本的修改
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.
