LiveUSB
From openSUSE
Contents |
openSUSE 11.2
从 openSUSE 11.2 Milestone 7 开始, LiveCD iso 镜像同样可以用来制作 LiveUSB。再也不需要 #openSUSE 11.1 及之前版本 段落所描述的复杂步骤了。
步骤
从 Factory Live CD 下载您选择的 Live CD 镜像文件,请确保您下载的文件是 build218 或更新的版本,然后
按照以下步骤进行操作:
1) 找到您的 USB 驱动盘被识别的方式:
linux-vgqb:~ # ls -l /dev/disk/by-id/*usb*
该命令将会输出如下结果:
lrwxrwxrwx 1 root root 9 13. Aug 10:04 /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B751D8C1994-0:0 -> ../../sdb
在此 /dev/sdb 是命令行中的简称,通常,直接使用 /dev/disk/by-id/.. 以防止写错硬盘导致数据丢失。
2) 将 LiveCD iso 写入 usb stick, 请注意将这里举例的 /dev/sdb 用您自己的具体硬盘设备代替(上面命令输出的设备信息):
dd if=openSUSE-KDE4-LiveCD-x86_64-Build0219-Media.iso of=/dev/sdb bs=4M
| 使用 dd 命令将不可逆地删除您所选 USB 驱动盘上现存的所有数据。换言之,在使用您的 USB 盘进行 LiveUSB 制作之前请做好完整的数据备
份,因为一旦 LiveCD 制作完毕,您 USB 驱动盘上原有的所有数据都将丢失(不可逆的丢失)。 因为 dd 命令会努力直接写入您所指定的任何目标,甚至是您的硬盘。 |
在剩余磁盘空间上创建分区
该分区可以用于为 Live 系统创建可写的 /home 目录, 使之成为在所有机子上都能使用的可移植 openSUSE。
我们将使用命令 fdisk 来实现该目标。
注意,下面的步骤演示原本是一个整体,在此分成段落是为了方便我们将解释说明添加进去。 更多信息请参考 man fdisk .
- 列出分区:
linux-vgqb:~ # fdisk /dev/sdb
The number of cylinders for this disk is set to 3935.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 4126 MB, 4126670848 bytes
64 heads, 32 sectors/track, 3935 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0×967113b7
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 660 675840 83 Linux
- 创建新分区:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
o p
o Partition number (1-4): 2
First cylinder (661-3935, default 661):
Using default value 661
Last cylinder, +cylinders or +size{K,M,G} (661-3935, default 3935):
Using default value 3935
- 检查所做的修改:
Command (m for help): p
Disk /dev/sdb: 4126 MB, 4126670848 bytes
64 heads, 32 sectors/track, 3935 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0×967113b7
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 660 675840 83 Linux
/dev/sdb2 661 3935 3353600 83 Linux
- 最后写入 USB 驱动:
Command (m for help): w
'''The partition table has been altered!
Calling ioctl() to re-read partition table.'''
最小的 USB 驱动盘容量是 1 GB, 多多益善。 以便有大量的磁盘空间用于写入。
记住: 如果您没有进行 fdisk 这部分的操作,那么您的 USB 驱动器将会像一个 Live CD 一样,一旦关机,所有数据将全部丢失,而上面操作创建的
/dev/sdb2 将会用于储存您的所有修改。
openSUSE 11.1 及之前版本
和 Ubuntu- 及 Fedora-型的系统不同的是, SUSE-型的 live CD 中的 initrd 并不直接适用于从 USB 驱动盘启动。openSUSE 系统镜像创建工具, KIWI, 可以生成为 Live USB 类媒介定制的 initrd 文件, 但是在某些部位不同,比如,linuxrc 脚本和 supplied kernel modules.
更新:有一个最简单创建 Live USB 驱动盘的方法:
已知 Bug: should but won't fit on a 2gb stick, use 4gb and the kiwi version of the 11.0 repos doesn't recognize the usb stick you have to install this newer version -and dependencies-. It shouldn't give you any errors, but when booting the usb stick the first time it couldn't start X, i had to run yast (graph.config), init 3 and init 5 to start kdm again and it worked. i had to activate network manager in yast too so it connects automatically |
| 类似的自动安装方法:将现有 openSUSE 移植到 USB 设备上,请参考 移植 SUSE |
USB live 引导和定制在 KIWI 项目中讨论project. Thanks cyberorg for your help on #opensuse-kiwi on freenode.
如何从一个运行中的 openSUSE 系统创建可引导 openSUSE 11.0 USB 驱动盘
本教程将为您演示获取可引导 openSUSE Live USB 的最快速的方法。假定您没有可用的 openSUSE 11.0 DVD。 本文为预发布文档,欢迎贡献您的一份力量帮
助修订更正。
准备工作
您需要在您的硬盘上腾出一个非常大的可用磁盘空间。5 GB 是比较合适的。另外您需要接入一个高速互联网(一般都是宽带),因为在没有安装 DVD 的情况下
,所有需要的软件包都要从网上直接下载。
安装 kiwi
- 在硬盘上安装 openSUSE 11.0 。(我更倾向于不需要这一步骤,因为毕竟我需要的只是一个安装在 USB 上的系统从而不需要硬盘安装)
(我正在处理这一步骤,比如使用虚拟机软件启动 LiveCD,然后在 LiveCD 中制作 USB 系统。)
- 使用 Yast > 软件安装源(Software Repositories) > 添加(Add) > 指定 URL(Specify URL).. 添加一个新的软件源:
在储存所压缩的 700 MB 文件的地方创建目录树 ("物理扩展")
- 您可以从发行版的 DVD 或者从互联网下载软件包来创建 USB 系统。
- 使用发行版的 DVD 创建的方法是最好的,如果您没有高速互联网(宽带)接入服务或者如果您不确定某次运行是否完成。下载所需版本的
iso 镜像文件 并在本地系统上挂载:
mkdir /mnt/my-distro mount -o loop /path-to-iso/my-distribution.iso /mnt/my-distro
跳过下面修改 config.xml 配置文件的步骤,直接到 #清理工作 清理工作 一段。
- The preferred way to create the USB stick is with recent packages from the internet. To do this edit change the repositories from DVD by
editing both the following config.xml files:
/usr/share/kiwi/image/usbboot/suse-11.0/config.xml /usr/share/kiwi/image/kwliveCD-suse-11.0/config.xml
- In each of the above config.xml files, delete only the DVD repository and set yast2 repositories for oss and non-oss with the following
pattern (as you will download 500Mb-600Mb, you probably want to substitute your local mirror in the above source paths. You can find your
<repository type="yast2"> <source path="http://download.opensuse.org/distribution/11.0/repo/oss/"/> </repository> <repository type="yast2" status="replaceable"> <source path="http://download.opensuse.org/distribution/11.0/repo/non-oss/"/> </repository>
- In /usr/share/kiwi/image/kwliveCD-suse-11.0/config.xml you can also set the update repository to the update repository on your local
mirror:
<repository type="rpm-md" status="replaceable"> <source path="http://download.opensuse.org/update/11.0/"/> </repository>
- Make sure you either update the .checksum.md5 files present in the respective directories to reflect the modifications, or else plainly
delete them. Otherwise kiwi will run almost to the end only to tell you it couldn't verify the config files, which is very time wasting.
cp .checksum.md5 .checksum.md5.old md5sum config.xml > .checksum.md5
- 清理工作
rm -rf /tmp/kiwi*
- Run (replace KDE with GNOME if you want GNOME)
kiwi --prepare /usr/share/kiwi/image/kwliveCD-suse-11.0 --root /tmp/kiwi-tmp --add-profile KDE --logfile terminal
- If you get
error: 'adaptec-firmware' matches no packages
then probably you haven't set up the non-oss repository as described above.
- If all goes well, you should see
KIWI exited successfully done
Create the compressed 700 MB file (="system image") and initrd (="usbboot image")
If you have already created the file system and only want to create initrd then jump over this section and use the Option below!
- 运行
mkdir /tmp/kiwi-image kiwi --type usb --create /tmp/kiwi-tmp -d /tmp/kiwi-image --logfile terminal
(This creates the compressed filesystem at /tmp/openSUSE-11.0-read-only.i686-2.5, basically by calling mksquashfs /tmp/kiwi-tmp/, plus an
initrd)
- Plug in your usbstick and unmount it with a command like the following:
umount /dev/sdb umount /dev/sdb1 umount /dev/sdb2
- We now make the usbstick (Note: do not specify --bootstick-device, it will ask for it):
kiwi --bootstick /tmp/kiwi-image/initrd-usbboot-suse-11.0.i686-2.1.1.splash.gz --bootstick-system /tmp/kiwi-image/openSUSE-11.0.i686-2.5
Make sure you promptly cancel automount requests or the process will terminate with an error. If you are familiar with operating from a
root console (without a desktop) then the process will be faster and there will not be any automount requests to worry about.
Congratulations - if all goes well, you now have a bootable openSUSE 11.0 USB stick!
可选: 仅仅创建 initrd (="usb 引导镜像")
本步骤适用于只创建 initrd 文件,而不修改 700 MB 压缩文件系统的情况。
- 运行
kiwi --prepare /usr/share/kiwi/image/usbboot/suse-11.0 --root /tmp/kiwi-live --logfile terminal kiwi --create /tmp/kiwi-live/ -d /tmp/
(This builds the initrd for the USB stick and puts it to /tmp/initrd-usbboot-suse-11.0.i686-2.1.1.gz)
- 复制 initrd, kernel等文件以及 700 MB 文件系统到 USB 驱动盘,然后使之可引导:
kiwi --bootstick /tmp/initrd-usbboot-suse-11.0.i686-2.1.1.splash.gz --bootstick-system /tmp/openSUSE-11.0-read-only.i686-2.5
重要经验
Kiwi 为 Live USB 驱动盘分区 (例如 1 GB sda) 如下:
- /dev/sda1 /media/disk ext2 rw,nosuid,nodev 0 0 (21.3MB primary type=83 bootable)
- /dev/sda2 /ro_branch squashfs ro 0 0 (708MB primary type=83)
- /dev/sda3 /rw_branch ext2 rw 0 0 (310MB primary type=83)
需要注意的是: 700 MB 的主压缩文件Note well that the main 700 MB compressed filesystem is not a file in a vfat partition, but rather it
is a partition itself!
Also note that the stick is set up in a "persistent" way per default, so that changes are written back to the USB stick at /dev/sda3 which
contains also packages and stuff that doesn't fit into the 700+ MB initrd.
剩余的问题 (FAQ)
(请添加至列表)
- Additional hints on Configuration can be found at Xen project. The following
command helps you to extract a list of installed rpms in the config.xml format:
rpm -qa --queryformat "\<package name=\"%{NAME}\"/\>\n" >rpms.txt
- 如何从 http://madwifi.org/suse/11.0/i586/ 加载 madwifi 驱动
You will have to download the driver rpm (i.e. madwifi-kmp-default-0.9.3.3_2.6.22.9_0.4-0.1.i586.rpm ) to a local directory and insert that
as source (rpm-dir) in the config.xml file. Also you need to add the driver to the packages section.
<repository type="rpm-dir"> <source path="/my/madwifi/rpm/dir/"/> </repository>
<package name="madwifi-kmp-default"/>
- Why is xvkbd open? How do I get rid of it?
- How can I (manually) convert a downloaded Live CD ISO into a bootable USB stick (without having to have openSUSE installed and without
using Kiwi)?
There's a howto at http://www.pendrivelinux.com/2008/03/28/usb-suse-flash-drive-install/
- Wow thanx the above howto is much easier than this tutorial. Makes me wanna link it at the top so people dont waist there time with all the
above steps. :)
- Why is fvwm2 part of the 1CD distribution?
- How do I change GRUB to get e.g. German as the default language for both keyboard and system?
Simply change
<locale>en_US.UTF-8</locale>
in the config.xml to
<locale>de_DE.UTF8</locale>
Since changes you make later are persistent, you may as well change /etc/X11/xorg.conf
- How can I know how much r/w space I have left?
mount /dev/sda3 /mnt df umount /mnt
- How can "persistency" (r/w) be disabled or set to r/o?
- How can I build a 32-bit image on a 64-bit system
linux32 kiwi --prepare ... linux32 kiwi --create ...
- How do I make the first partition a FAT partition so the stick also can be used for general data trasnfer between machines independant of
operating system
- 如何添加 NVIDIA/ATI 二进制驱动?
您可以将其添加至
/usr/share/kiwi/image/usbboot/suse-xx.x/config.xml
文件的段落
<drivers type="drivers"> <file name="drivers/nvidia/*"/> <file name="drivers/ati/*"/>
- 如何修改显示分辨率为 1024x768?
参考
- How to convert SUSE-type Live CDs into bootable USB sticks (by Simon Peter)
- How to convert Ubuntu-type Live CDs into bootable USB sticks (by probono)
- How to convert the Fedora-type Live CDs into bootable USB sticks (by probono)


