歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 使用 LVPM 將Wubi-Ubuntu桌面版復制到專有分區的方法

使用 LVPM 將Wubi-Ubuntu桌面版復制到專有分區的方法

日期:2017/2/28 16:15:20   编辑:Linux教程

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 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/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

總計 0 drwxr-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 ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
}

if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set 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_msdos
insmod ext3
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 15fbe968-a73a-4b14-8315-ae841cf0d048
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3 loop=/ubuntu/disks/root.disk ro quiet splash
initrd /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_msdos
insmod ext3
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 15fbe968-a73a-4b14-8315-ae841cf0d048
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3 loop=/ubuntu/disks/root.disk ro single
initrd /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_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set de305be6305bc3e5
drivemap -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 ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
在這一步,應該注意,將分區的uuid和路徑改成目標分區(即紅色標注部分)。因為LVPM在復制grub的時候,沒有將分區和路徑改過來。

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

default=0
timeout=5
title Ubuntu-on-menu.lst/dev/sda3
insmod part_msdos
insmod ext3
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set 15fbe968-a73a-4b14-8315-ae841cf0d048
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda3 loop=/ubuntu/disks/root.disk ro quiet splash
kernel /boot/vmlinuz-2.6.35-22-generic ro root=/dev/sda3
initrd /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:
root


title UnknownOS
root (hd0,4)
makeactive
chainloader +1
boot


title Microsoft Windows XP Professional
root (hd0,0)
makeactive
chainloader +1
boot

Copyright © Linux教程網 All Rights Reserved