使用 LVPM 将Wubi-Ubuntu桌面版复制到专有分区的方法

Wubi是Windows Ubuntu-Based Installer的缩写,即在windows的分区(NTFS)中虚拟一段磁盘空间,作为独立于windows的loop分区,作为linux的根目录/。

使用LVPM(Loopmounted Virtual Partition Manager)可以扩展虚拟磁盘的空间(使用LVMP的resize功能),或者将linux系统从虚拟的磁盘拷贝到真实的分区下,实现真正的windows+linux双系统。

1.分区

在wubi-Ubuntu下,使用系统自带的磁盘实用工具,建议将空白的分区分出一个linux下的交换分区(SWAP),剩余的作为linux的分区(ext2,,ext3或ext4格式)。

下面是磁盘分区之后的数据

administrator@ubuntu:~$sudo fdisk -l

[sudo] password for administrator:Disk /dev/sda: 320.1 GB, 320072933376 bytes255 heads, 63 sectors/track, 38913 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000001

Device Boot Start End Blocks Id System

/dev/sda1 * 1 1275 10241406 7 HPFS/NTFS

/dev/sda2 1276 1397 979965 82 Linux swap / Solaris

/dev/sda3 1398 6123 37961595 83 Linux

/dev/sda4 6124 38913 263385675 f W95 Ext’d (LBA)

/dev/sda5 6124 16723 85144468+ 7 HPFS/NTFS

/dev/sda6 16724 27738 88477956 b W95 FAT32

/dev/sda7 27739 38913 89763156 7 HPFS/NTFS

从上面的数据可以看出,主分区从/dev/sda1开始,扩展分区从/dev/sda4开始,第一个扩展分区为/dev/sda5.不妨再看看分区容量。

administrator@ubuntu:~$df -lh

文件系统 容量 已用 可用已用%%挂载点

/dev/sda3 36G 4.1G 30G 12%/

none 999M 328K 999M 1%/dev

none 1004M 348K 1004M 1%/dev/shm

none 1004M 92K 1004M 1%/var/run

none 1004M 0 1004M 0% /var/lock

/dev/sda1 9.8G 4.6G 5.3G 47%/media/SYS

/dev/sda5 82G 75G 7.1G 92% /media/SOFT

/dev/sda6 85G 75G 9.9G 89% /media/WORK

/dev/sda7 86G 81G 4.9G 95% /media/BACK

分区的UUID(Universally Unique Identifier即唯一识别码)也是应该知道的。

administrator@ubuntu:~$ls -al /dev/disk/by-uuid

总计0drwxr-xr-x 2 root root 160 2011-04-23 01:31 .

drwxr-xr-x 6 root root 120 2011-04-23 01:31 ..

lrwxrwxrwx 1 root root 10 2011-04-22 17:31 15fbe968-a73a-4b14-8315-ae841cf0d048 -> ../../sda3

lrwxrwxrwx 1 root root 10 2011-04-22 17:31 237D-1AF7 -> ../../sda6

lrwxrwxrwx 1 root root 10 2011-04-22 17:31 293d2cc0-614c-4b02-887d-354a29de1220 -> ../../sda2lrwxrwxrwx 1 root root 10 2011-04-22 17:31 9AC4BB30C4BB0D8F -> ../../sda7

lrwxrwxrwx 1 root root 10 2011-04-22 17:31 D028BF0728BEEB9A -> ../../sda5

lrwxrwxrwx 1 root root 10 2011-04-22 17:31 DE305BE6305BC3E5 -> ../../sda1

2.使用LVMP工具的transfer功能。

这一步,LVMP做三件事:格式化目标分区成ext4格式;复制文件;安装、复制grub。

注意修改\boot\grub 下的grub. cfg 文件

## DO NOT EDIT THIS FILE## It is automatically generated by grub-mkconfig using templates# from /etc/grub.d and settings from /etc/default/grub#### BEGIN /etc/grub.d/00_header ###if [ -s $prefix/grubenv ]; thenset have_grubenv=trueload_envfiset default=”0″if [ “${prev_saved_entry}” ]; thenset saved_entry=”${prev_saved_entry}”save_env saved_entryset prev_saved_entry=save_env prev_saved_entryset boot_once=truefifunction savedefault {if [ -z “${boot_once}” ]; thensaved_entry=”${chosen}”save_env saved_entryfi}function recordfail {set recordfail=1if [ -n “${have_grubenv}” ]; then if [ -z “${boot_once}” ]; then save_env recordfail; fi; fi}function load_video {}if [ “${recordfail}” = 1 ]; thenset timeout=-1elseset timeout=10fi### END /etc/grub.d/00_header ###### BEGIN /etc/grub.d/05_debian_theme ###set menu_color_normal=white/blackset menu_color_highlight=black/light-gray### END /etc/grub.d/05_debian_theme ###### BEGIN /etc/grub.d/10_linux ###### END /etc/grub.d/10_linux ###### BEGIN /etc/grub.d/10_lupin ###menuentry “Ubuntu,grub.cfg Linux 2.6.35-22-generic on /dev/sda3” {insmod part_msdosinsmod ext3set root='(hd0,msdos3)’search –no-floppy –fs-uuid –set 15fbe968-a73a-4b14-8315-ae841cf0d048loopback loop0 /ubuntu/disks/root.diskset root=(loop0)linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3 loop=/ubuntu/disks/root.disk ro quiet splashinitrd /boot/initrd.img-2.6.35-22-generic}menuentry “Ubuntu,grub.cfg Linux 2.6.35-22-generic on /dev/sda3 (recovery mode)” {insmod part_msdosinsmod ext3set root='(hd0,msdos3)’search –no-floppy –fs-uuid –set 15fbe968-a73a-4b14-8315-ae841cf0d048loopback loop0 /ubuntu/disks/root.diskset root=(loop0)linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3loop=/ubuntu/disks/root.disk ro singleinitrd /boot/initrd.img-2.6.35-22-generic}### END /etc/grub.d/10_lupin ###### BEGIN /etc/grub.d/20_linux_xen ###### END /etc/grub.d/20_linux_xen ###### BEGIN /etc/grub.d/20_memtest86+ ###### END /etc/grub.d/20_memtest86+ ###### BEGIN /etc/grub.d/30_os-prober ###menuentry “Microsoft Windows XP Professional (on /dev/sda1)” {insmod part_msdosinsmod ntfsset root='(hd0,msdos1)’search –no-floppy –fs-uuid –set de305be6305bc3e5drivemap -s (hd0) ${root}chainloader +1}### END /etc/grub.d/30_os-prober ###### BEGIN /etc/grub.d/40_custom #### This file provides an easy way to add custom menu entries. Simply type the# menu entries you want to add after this comment. Be careful not to change# the ‘exec tail’ line above.### END /etc/grub.d/40_custom ###### BEGIN /etc/grub.d/41_custom ###if [ -f $prefix/custom.cfg ]; thensource $prefix/custom.cfg;fi### END /etc/grub.d/41_custom ###在这一步,应该注意,将分区的uuid和路径改成目标分区(即红色标注部分)。因为LVPM在复制grub的时候,没有将分区和路径改过来。

同时也要修改\boot\grub 下的menu.lst

default=0timeout=5title Ubuntu-on-menu.lst/dev/sda3insmod part_msdosinsmod ext3set root='(hd0,msdos3)’search –no-floppy –fs-uuid –set 15fbe968-a73a-4b14-8315-ae841cf0d048loopback loop0 /ubuntu/disks/root.diskset root=(loop0)linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3 loop=/ubuntu/disks/root.disk ro quiet splashkernel /boot/vmlinuz-2.6.35-22-generic ro root=/dev/sda3initrd /boot/initrd.img-2.6.35-22-generic# This is a divider, added to separate the menu items below from the Debian# ones.title Other operating systems:roottitle UnknownOSroot (hd0,4)makeactivechainloader +1boottitle Microsoft Windows XP Professionalroot (hd0,0)makeactivechainloader +1boot

好像有头大象在吸水。然后再去了芦笛岩,

使用 LVPM 将Wubi-Ubuntu桌面版复制到专有分区的方法

相关文章:

你感兴趣的文章:

标签云: