现在几乎所有的PC都支持USB启动,打造一个嵌入了OS的优盘/移动硬盘(以下简称USB)是件有趣又实用的事,这样就可以即那U盘/移动硬盘来存储数据,亦可在PC出问题时作为修复、备份PC上数据的工具。闲话少说,咱们开始动手吧 ^_^。(下面步骤用到的命令中以linux:~#开头的是以root用户身份运行的)
1)首先确认你的USB上重要数据已经备份,然后把你的USB连接到电脑。确认你的USB设备ID,如:/dev/sdb (下面步骤以此为例),卸载(不是eject)已挂载的USB设备。
2)安装ImageWriter:[code]linux:~ # zypper in imagewriter[/code]3)下载openSUSE LiveCD,如: openSUSE-11.4-GNOME-LiveCD-i686.iso
4)运行SUSE Studio Imagewriter:[code]计算机=>应用程序=>SUSE Studio Imagewriter[code]
也可以在终端中直接输入命令:[code]linux:~ # imagewriter[/code]打开的SUSE Imagewriter如图所示:[attach]34687[/attach]
单击窗口中间部分弹出如下对话框,如图中红圈所示,选中你下载的openSUSE LiveCD镜像文件:[attach]34688[/attach]
单击窗口最下面的下拉框的选择需要装载openSUSELiveCD的USB设备。
以上操作完成后,结果如下图:[attach]34686[/attach]
最后, 单击 “Write” 按钮以使Imagewriter把LiveCD写到USB上。
5)创建分区设置,这里至少要添加两个分区,第一个添加的用于平常存储数据,最后一个分区留给openSUSE LiveCD做临时数据空间(注意,这个分区一定要放在所有分区的后面,因为,LiveCD启动后会查找USB设备上的最后一个分区并且擦除该分区上的所有数据!),下面的命令可作为参考:[code]linux:~ # fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p
Disk /dev/sdb: 8011 MB, 8011120640 bytes
64 heads, 32 sectors/track, 7640 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe7e27a80
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 695 711680 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (696-7640, default 696):
Using default value 696
Last cylinder, +cylinders or +size{K,M,G} (696-7640, default 7640): 6500
Command (m for help): p
Disk /dev/sdb: 8011 MB, 8011120640 bytes
64 heads, 32 sectors/track, 7640 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe7e27a80
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 695 711680 83 Linux
/dev/sdb2 696 6500 5944320 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (6501-7640, default 6501):
Using default value 6501
Last cylinder, +cylinders or +size{K,M,G} (6501-7640, default 7640):
Using default value 7640
Command (m for help): p
Disk /dev/sdb: 8011 MB, 8011120640 bytes
64 heads, 32 sectors/track, 7640 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe7e27a80
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 695 711680 83 Linux
/dev/sdb2 696 6500 5944320 83 Linux
/dev/sdb3 6501 7640 1167360 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
linux:~ # mke2fs -T ext4 -L PNY /dev/sdb2
mke2fs 1.41.11 (14-Mar-2010)
文件系统标签=PNY
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
371680 inodes, 1486080 blocks
74304 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1522532352
46 block groups
32768 blocks per group, 32768 fragments per group
8080 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
linux:~ # mke2fs -T ext4 -L susetmp /dev/sdb3
[/code]6)重启你的PC,设置BIOS从USB设备启动,让USB设备上openSUSE完全启动,这可能要花大约10分钟的时间,但这完全取决于USB的最后一个分区的大小,如果你打算让USB作为你的第二个PC,你就应该把它的空间分的大一点,这个分区会被USB上的SUSE用了存储数据。
让LiveCD完全启动一遍就是要让LiveCD初始化USB上的最后一个分区。
至此,一个可随处移动,能够自我管理(启动后,它不仅可以访问你的PC,也可访问管理其自身,亦即所谓的“自治”)的USB即在你的手中降生啦!


neverSatrabbit 于 2013-01-10 15:02:05发表:
高手,领教
dianji 于 2012-12-28 10:19:39发表:
强强强强
徐空华 于 2012-12-26 16:11:52发表:
很有实力 值得学习啊
gky2009514 于 2012-12-07 13:23:21发表:
新手完成任务,求下书籍~
linuxtro 于 2012-05-31 14:20:07发表:
相当于一个急救盘
jingxun5217 于 2012-05-23 00:05:43发表:
我的SuSE11.4 imagewriter 打不开阿!
skybuler 于 2012-04-11 14:04:05发表:
呵呵...
skybuler 于 2012-04-11 14:03:53发表:
路过...
lxine 于 2011-12-30 20:05:59发表:
强焊!........
xiehuailian 于 2011-08-07 20:02:26发表:
都强
wq413732076 于 2011-08-02 08:12:58发表:
看不懂呢
bingxiaohan 于 2011-06-07 11:49:38发表:
牛人
liulee123 于 2011-06-01 14:04:02发表:
强啊
gleerat 于 2011-05-22 18:19:16发表:
直接安装ubuntu11.04到移动硬盘的。
your180 于 2011-05-22 15:54:46发表:
:0)1好
Growth兆 于 2011-05-22 09:53:14发表:
感谢sauntor的分享,本贴加入到论坛顶置的Linux应用索引贴中
drivers 于 2011-05-21 14:46:01发表:
实力派啊
q7262395 于 2011-05-21 14:24:59发表:
我移动硬盘是装的ubuntu10.04-2用来修复引导什么的,/15g