[原创]U盘启动能保存数据的Hiweed

Ubuntu各种衍生版本
oldniu
帖子: 172
注册时间: 2006-08-10 16:01

[原创]U盘启动能保存数据的Hiweed

#1

帖子 oldniu » 2007-04-22 9:26

U盘启动能保存数据的Hiweed
关键词:U盘 优盘 ubuntu hiweed 启动 persistent

一直想有个U盘能启动ubuntu,能保存自己的设置数据,随身携带到别人的计算机上usb启动就有了自己熟悉的环境界面。为了实现这个目的,查看了不少人的贴子(感谢huahua、gnix_oag、ptptpt有多少个pt?),自己实验了一下,现在阶段性的报告如下。

关于U盘的选择

容量我用了1G的,因为Hiweed大约占700M,自己的设定数据占300M。自然2G更多自己的数据空间就更大。我试用了铼德的Ridata/KingMax蓝色高速超棒/sandisk的miniSD接转换器为标准SD+《微电脑世界》赠送的6合一读卡器,都可的以启动成功。KingMax的速度应该是最快的,可是我也没有明显感觉。所以3M写6M读应该也是可以的。也没有必要是启动型的U盘,见下文。

U盘分区准备
(请确认你的U盘是否是/dev/sdb,操作请确认U盘处于umount状态)
ubuntu@ubuntu:~$ sudo fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 1027 MB, 1027604480 bytes
255 heads, 63 sectors/track, 124 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 86 690763+ 6 FAT16
/dev/sdb2 87 124 305235 83 Linux

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2
#删除原有的分区,为了重新分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-124, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-124, default 124): +700M
#建立新分区700M,Hiweed够了,其他的ubuntu也许需要更多空间
Command (m for help): a
Partition number (1-4): 1
#设为启动分区
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)
#将分区设为FAT16
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (87-124, default 87):
Using default value 87
Last cylinder or +size or +sizeM or +sizeK (87-124, default 124):
Using default value 124
#建立第二的分区,用于保存设定数据
Command (m for help): p

Disk /dev/sdb: 1027 MB, 1027604480 bytes
255 heads, 63 sectors/track, 124 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 86 690763+ 6 FAT16
/dev/sdb2 87 124 305235 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
ubuntu@ubuntu:~$
#重新插拔一下U盘,完成分区准备建立文件系统
ubuntu@ubuntu:~$ mkfs.vfat -F 32 -n Hiweed /dev/sdb1
#-n volume-name
mkfs.vfat 2.11 (12 Mar 2005)
ubuntu@ubuntu:~$ mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2
#-L Set the volume label for the filesystem。因为ubuntu的persisitent模式需
#要定义这个volume name为casper-rw
mke2fs 1.38 (30-Jun-2005)
Filesystem label=casper-rw
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
76320 inodes, 76308 blocks
3815 blocks (5.00%) reserved for the super user
First data block=0
3 block groups
32768 blocks per group, 32768 fragments per group
25440 inodes per group
Superblock backups stored on blocks:
32768

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

U盘数据准备
完全依照http://www.hiweed.com/node/96 只不过硬盘换成U盘。
下载 http://ftp.ubuntu.org.cn/gnix_oag/hd_boot_liveCD.rar
#--username=ubuntu --password=ubuntuftp
解压后拷贝到/dev/sdb1上
ubuntu@ubuntu:~$ ls /media/Hiweed/
boot
ubuntu@ubuntu:~$ ls /media/Hiweed/boot/
grub initrd.gz vmlinuz
ubuntu@ubuntu:~$ ls /media/Hiweed/boot/grub/
bj2008.xpm.gz menu.lst
修改 \boot\grub\menu.lst 文件,将
title Start or install Ubuntu
kernel (hd0,0)/boot/vmlinuz boot=casper ramdisk_size=1048576 root=/dev/ram rw quiet splash debian-installer/locale=zh_CN
修改为
title Start Hiweed
kernel (hd0,0)/boot/vmlinuz boot=casper persistent ramdisk_size=1048576 root=/dev/ram rw quiet splash
#persistent 使用casper-rw的标志
然后保存文件。
将 Hiweed GNU/Linux Desktop 的 ISO 文件中 casper 目录解压放在/dev/sdb1分区的根目录。
ubuntu@ubuntu:~$ ls /media/Hiweed/
boot casper

如何使U盘启动
这个曾经困扰了我。试用了syslinux,未果。最后还是使用了grub,这个我熟悉的东东。
sudo apt-get install mbr
在u盘上建立mbr:sudo install-mbr /dev/sdb
然后grub
>root (hd0,0)
为了确认是否是正确的U盘可以
>cat (hd0,0)/boot/grub/menu.lst
然后在mbr上安装grub
>setup (hd0)
#这一步是需要stage等文件的。在安装好的ubuntu/boot/grub/下面有这些文件拷贝到U盘的/boot/grub/下,再次执行setup(hd0)成功。

结果:U盘可以使用Hiweed,liveCD启动,并保存数据。下一步需要研究filesystem.squashfs,启动引导的initrd.gz vmlinuz,按需定制要启动的ubuntu。保存数据的形式为 gnix_oag的ubuntu.fs形式,为Fat区上的一个文件这样就不用再创建casper-rw这个分区了。Hiweed有了新版本1.2? 也想重新制作U盘尝试。

另:国外是有人卖U盘启动的ubuntu的。像这种设定了启动,能引导工作保存数据的U盘如果在淘宝上卖,会有人买吗?容量为1G-2G,价格在U盘价格上添加一点服务费。


计算机的U盘启动(转载)
我U盘启动没碰见特别的设置,只是可能需要换换usb口。
BIOS USB booting tips and tricks

The system BIOS can be complicated to someone who is not yet familiar with all of the settings. Here are a few tips to increase your chances of USB Linux system boot success. If the flash memory stick fails to boot, go back into the system BIOS and try changing some of the following settings (taking note to the changes made).
BIOS setting tips:
Switch on or off USB keyboard support
Turn off Fast Boot
Disable USB 2.0 support (last resort, this will default to USB 1.1)
General tips:
Unplug USB hubs and extensions (these may draw from the current needed to wake your USB device)
Try using a different USB port. (some frontal ports may not be fully supportive)
Unplug additional USB devices. (I’ve seen something as simple as an IPod halt a system boot)
Sometimes a USB drive may go undetected at startup. If your drive has an LED, ensure that it either flashes or remains solid during system post. If the drive does not respond, remove the drive, then power the system completely down for 15 seconds, reinsert the drive and try again.
Some laptops using a PCMCIA slot may have troubles booting. You may have to tell Linux to ignore PCMCIA during boot. You can do this in the syslinux.cfg file by simply adding “nopcmcia” to the default boot options or by using a cheatcode before boot.
Also, be sure to check out the USB BIOS boot options section.

USB BIOS boot options
The following list of USB BIOS boot options have been thoroughly tested with various Linux USB installs. There may be others but this is meant to be a simple checklist to familiarize you with the boot options and which ones to use. Check back often as we will be adding new information to this list over time.
BIOS Boot Options:
1.USB-HDD ” Preferred boot method”
2.USB-ZIP “May or may not work”
3.USB-FDD “Unsupported”
Summary:
Generally speaking, if your system BIOS supports the USB-HDD boot option, it should boot Linux from a large capacity USB flash drive. (a BIOS that supports USB-HDD automatically detects the geometry of the USB Flash drive)
The USB-ZIP option is typically used on older systems that do not support USB-HDD boot. Using this boot option might require modifying the drive geometry to match how the BIOS has been hard-coded to see the device.
Exception: The USB-ZIP boot option may allow you to boot larger capacity flash drives without drive geometry modification, if your BIOS also lists the flash drive as a selectable hard drive under boot priority. (Typical of the Award-Phoenix BIOS)
Tips:
If your BIOS lists the USB memory stick as a hard drive, you should select it as the 1st boot device.
You should always remove other USB boot options from the boot priority list when attempting to boot from USB-ZIP or USB-HDD to avoid conflicting startup Cues.
The file-system used may also affect the BIOS’s ability to detect and boot the drive. If a Fat file-system doesn’t work, try Fat32.
Be sure to keep an eye out for BIOS updates from your board manufaturer.
Through experience, we have found that most “recent” Award/Phoenix and AMI BIOS’s can generally support USB boot.
螺钉头虽然愚笨但总想在坚实的生活里钻出自己的天地来。
caiiaccai
帖子: 8
注册时间: 2007-04-30 12:43

#2

帖子 caiiaccai » 2007-04-30 18:06

希望有精简版!!! :wink:
头像
jackhowe
帖子: 7
注册时间: 2007-01-12 19:21
来自: 江苏 苏州 张家港[工作在成都]
联系:

#3

帖子 jackhowe » 2007-05-07 20:59

为什么我用这种方法做,结果却是启动到登陆界面,让我输入用户名和密码?
我第一次启动,哪来什么用户名和密码啊?
试了root,密码为空不行;试了Ubuntu密码为空和Ubuntu都不行,请教怎么解决?
头像
jackhowe
帖子: 7
注册时间: 2007-01-12 19:21
来自: 江苏 苏州 张家港[工作在成都]
联系:

#4

帖子 jackhowe » 2007-05-07 21:22

发现问题;了,我用的是Ubuntu7.04的ISO文件中的casper,把hd_boot_liveCD.rar换成bhd_i386_2.6.20-15g-ntfs-aufs.tar.gz就可以了!
头像
jackhowe
帖子: 7
注册时间: 2007-01-12 19:21
来自: 江苏 苏州 张家港[工作在成都]
联系:

#5

帖子 jackhowe » 2007-05-07 22:00

现在U盘可以启动,,但是安装了ATI的受限驱动,要求我重启,重启后发现并没有像楼主说得那样能【保存数据】,受限驱动仍旧显示没有安装,我原先设置的系统代理服务器都没有保存,请教楼主,怎么实现你所说的能【保存数据】?
oldniu
帖子: 172
注册时间: 2006-08-10 16:01

#6

帖子 oldniu » 2007-05-07 23:22

用casper-rw分区 保存数据需要在启动菜单参数中有persistent关键字。
“修改为
title Start Hiweed
kernel (hd0,0)/boot/vmlinuz boot=casper persistent ramdisk_size=1048576 root=/dev/ram rw quiet splash
#persistent 是使用casper-rw的标志
然后保存文件。”
自然也应确认casper-rw分区正常。

【保存数据】先实验一下能否在/home/ubuntu下存个文件,看下次启动还有没有。

Ati显卡更新驱动不成功是否是应为缺少了/lib/modules/2.6.15-23-386/volatile/fglrx.ko?
这篇文章有用吗?
viewtopic.php?t=52330
螺钉头虽然愚笨但总想在坚实的生活里钻出自己的天地来。
cjjhr99
帖子: 75
注册时间: 2007-06-04 1:55

#7

帖子 cjjhr99 » 2007-06-09 19:57

LZ能总结一下,你的这种方法跟把U盘当LIVE CD用,在原理上有什么区别,为什么变成能存数据了呢?

在这里我才神奇的发现原来U盘也可以分区。

我有个想法,就是用LIVE CD 启动,然后让它认出U盘,然后直接按照安装到硬盘的方式把系统安装到U盘,不知道行不行的通?
niaomo
帖子: 36
注册时间: 2007-03-31 18:09

#8

帖子 niaomo » 2007-06-10 12:41

cjjhr99 写了:LZ能总结一下,你的这种方法跟把U盘当LIVE CD用,在原理上有什么区别,为什么变成能存数据了呢?

在这里我才神奇的发现原来U盘也可以分区。

我有个想法,就是用LIVE CD 启动,然后让它认出U盘,然后直接按照安装到硬盘的方式把系统安装到U盘,不知道行不行的通?
你所想的,也正是我所想的。
试试看?
头像
huangjiahua
帖子: 3294
注册时间: 2005-03-30 0:27
联系:

#9

帖子 huangjiahua » 2007-06-10 18:24

cjjhr99 写了: 在这里我才神奇的发现原来U盘也可以分区。

我有个想法,就是用LIVE CD 启动,然后让它认出U盘,然后直接按照安装到硬盘的方式把系统安装到U盘,不知道行不行的通?
可以,不过有可能有时候要手工安装 grub
跃过无数的时间断层,只为了在
cjjhr99
帖子: 75
注册时间: 2007-06-04 1:55

#10

帖子 cjjhr99 » 2007-06-11 11:30

我把U盘格为LZ说的那样一个FAT 一个EXT2,要安装的时候LIVE CD认不到U盘。
不知道该怎么样才能让系统认到U盘。
有没有谁有什么解决的方法??
oldniu
帖子: 172
注册时间: 2006-08-10 16:01

#11

帖子 oldniu » 2007-06-11 15:47

从原理上U盘安装与下文ptptptpt的大作,应该没有本质区别。但是U盘要考虑ubuntu的安装需要的空间问题,估计4G的U盘能装。否则建议考虑先定制ubuntu然后迁移到U盘。
精华: 【2007.05.23更新】把 ubuntu 操作系统装入移动硬盘,并在不同电脑上运行
viewtopic.php?t=29692

huahua所讲的grub设定可能是指如下部分:
-------------------------------------
如何使U盘启动
这个曾经困扰了我。试用了syslinux,未果。最后还是使用了grub,这个我熟悉的东东。
sudo apt-get install mbr
在u盘上建立mbr:sudo install-mbr /dev/sdb
然后grub
>root (hd0,0)
为了确认是否是正确的U盘可以
>cat (hd0,0)/boot/grub/menu.lst
然后在mbr上安装grub
>setup (hd0)
#这一步是需要stage等文件的。在安装好的ubuntu/boot/grub/下面有这些文件拷贝到U盘的/boot/grub/下,再次执行setup(hd0)成功。
-------------------------------------
螺钉头虽然愚笨但总想在坚实的生活里钻出自己的天地来。
cjjhr99
帖子: 75
注册时间: 2007-06-04 1:55

#12

帖子 cjjhr99 » 2007-06-13 23:25

LZ能帮我看下我的为什么启动不了吗?

我用的是PTPTPTP的那个定制的MINI版CASPER,是UBUNTU 7.0.4的,下面是我的文件结构:

ns@ns-laptop:~$ ls /media/Ubuntu
boot casper
ns@ns-laptop:~$ ls /media/Ubuntu/boot
feisty grub
ns@ns-laptop:~$ ls /media/Ubuntu/boot/feisty
initrd.gz vmlinuz
ns@ns-laptop:~$

跟HIWEED唯一不同的就所把HIWEED那些放在BOOT下的文件放feisty里了。
然后menu.list的内容是:
timeout 5

default 0

fallback 1

splashimage (hd0,0)/boot/grub/bj2008.xpm.gz

fontfile (hd0,0)/boot/grub/fonts



title Start Hiweed
kernel (hd0,0)/boot/feisty/vmlinuz boot=casper persistent ramdisk_size=1048576 root=/dev/ram rw quiet splash


title GO Back (MS Windwos OS)

rootnoverify (hd0,0)

makeactive

chainloader +1

之后是能正常启动:
首先是提示找不到“GRLDR”(因为我没在根目录放这文件)
但启动继续进行
然后进入那个选择系统的地方,UBUNTU LINUX 或者GO BACK
选第一个,继续进行
initrd boot/feisty/initrd.gz 估计表示是能根据我配置的menu.list找到我放这些文件的地方
之后就进入我们熟悉的UBUNTU的图形启动界面,进度条走了一点点。

但也就只进行到这里就不动了
最后出现:
Busybox 什么的。。。。

/bin/sh: can't access tty ; job control turned off

以上就是我的“症状”,之后我把那个GRLDR的文件放到根目录下,这样就能正常启动了,但是就保存不了东西,
我试过来,能在CASPER-RW的分区写东西,但在/HOME下就不能写。
clyb
帖子: 33
注册时间: 2007-07-02 16:52

#13

帖子 clyb » 2007-07-09 21:39

感觉看不懂。。。。

遗憾阿 。。。
头像
mir_lww
帖子: 192
注册时间: 2007-01-12 22:59
来自: GDUT

#14

帖子 mir_lww » 2007-07-16 0:16

对‘如何使u盘启动’看的不大懂。。
xiaoyong
帖子: 515
注册时间: 2006-05-20 10:38

#15

帖子 xiaoyong » 2007-07-18 13:52

回复12楼,ptptptptp的mini版是feisty,而feisty是不支持persistent参数的,见 https://bugs.launchpad.net/ubuntu/+sour ... +bug/84591

硬盘引导对启动环境做了很大的改动,会出现一些问题,比如安装 virtualbox 也会出错,解决不了,因为 aufs 的文件系统是只读属性。
回复