Main Page | 最近更改 | 編輯本頁 | 頁面歷史

可列印版 | 免責聲明 | 隱私政策

未登入
登入 | 幫助
 

UserModeLinux

出自DebianWiki

目錄

[編輯] User Mode Linux

UML (User Mode Linux) 是一種安全的虛擬機器,可以執行一般程式般在現有的硬碟上啟動數個 Linux 系統。而虛擬機器所使用的檔案系統(root filesystem)則是建立在宿主系統上的單一檔案系統。

一般而言,程序執行於 Linux 系統的架構是

  +-----------+-----------+----+
  | Process 1 | Process 2 | ...|
  +-----------+-----------+----+
  |       Linux Kernel         |
  +----------------------------+
  |         Hardware           |
  +----------------------------+

而 User Mode Linux 則是在宿主系統上另執行一核心。

              +----------------+
              | Process 2 | ...|
  +-----------+----------------+
  | Process 1 | User-Mode Linux|
  +----------------------------+
  |       Linux Kernel         |
  +----------------------------+
  |         Hardware           |
  +----------------------------+

普遍的用途

[編輯] UML 核心

使用 User Mode Linux 的首要步驟便是自行編譯或取得預先編譯的核心系統。

注意!要執行 UML,你的基礎核心應該要使用 2.2.15 或 2.3.22 之後的核心。
.
若你的宿主核心為 2.6 以上,你可能會遇到 "I'm tracing myself and I can't get out" 
的錯誤訊息,請參考 http://usermodelinux.org/modules.php?name=News&file=article&sid=142
自行修改核心系統

[編輯] 自行編譯

你可以依據需要自行編譯客製化的系統,2.6 新版的核心已經內建 UML 程式碼,然而其中的程式碼大多過舊,你可以在 blaisorblade 的網站找到較新的程式碼。 請依據 Howto 第二節 的步驟進行此工作。

[編輯] 預先編譯

Debian 系統的使用者可以直接安裝 DebianPackages:user-mode-linux,這是預先編譯的 UML 核心與模組。

如果你不需特定的核心版本,預先包裝的套件應已足夠。而以下的範例仍以安裝預先編譯的為基礎。

[編輯] 使用系統

執行 UML ,需要設定主要有

以上得設定都需要 DebianPackages:uml-utilities 中的指令協助。請先安裝 DebianPackages:uml-utilities

[編輯] 虛擬檔案系統

只有核心而沒有基礎系統與程式的作業系統是無法運作的。UML 所使用的檔案系統是單一的檔案系統映像檔(filesystem images)。你可以自行手動建立,也可直接下載已預先建立的檔案系統,已經有開發者提供了各種安裝系統的檔案系統映像檔。

[編輯] debootstrap/rootstrap

此節介紹的是使用 DebianPackages:debootstrap / DebianPackages:rootstrap 建立 Debian 為主的檔案系統。

在 Debian 上,你可以藉由 DebianPackages:debootstrap 快速的下載建立 Debian 基礎系統(base system),你必須手動建立一個空白的檔案系統映像檔。

例如建立大小為 100M 的空白檔案::

$ dd if=/dev/zero of=root_fs seek=100 count=1 bs=1M
1+0 records in
1+0 records out
1048576 bytes transferred in 0.003817 seconds (274703945 bytes/sec)

對之格式化

$ mkfs.ext3 root_fs
mke2fs 1.35 (28-Feb-2004)
root_fs is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
25896 inodes, 103424 blocks
5171 blocks (5.00%) reserved for the super user
First data block=1
13 block groups
8192 blocks per group, 8192 fragments per group
1992 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729
 
Writing inode tables: done
Creating journal (4096 blocks): 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.
$ file root_fs
root_fs: Linux rev 1.0 ext3 filesystem data

接下來必須使用 root 將其掛載,並以 debootstrap 建立基礎檔案系統

# mkdir /mnt/uml
# mount -o loop root_fs /mnt/uml
# debootstrap --arch i386 woody /mnt/uml http://debian.linux.org.tw/debian
# umount /mnt/uml

以上的指令即可建立基礎的 Debian 系統,而你必須手動進行許多設定,例如拷貝 UML 需要使用的模組等。

http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-8.html

除了手動建立檔案系統外,DebianPackages:rootstrap 是開發設計使用 DebianPackages:debootstrap 與 UML 的工具,可以建立單一的檔案系統映像檔,而且設定中中也對 UML 做了客製化的選項,建立虛擬檔案系統只需要一個指令即可完成。

[編輯] 共享檔案系統

copy-on-write http://user-mode-linux.sourceforge.net/shared_fs.html http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-7.html

[編輯] 存取宿主檔案系統

Host file access http://user-mode-linux.sourceforge.net/hostfs.html http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-9.html

[編輯] 控制台

http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-10.html

[編輯] 虛擬網路環境

http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-6.html

[編輯] umlrun

DebianPackages:umlrun DebianPackages:umlrun-uml

[編輯] 核心除錯

http://user-mode-linux.sourceforge.net/debug-session.html http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-11.html http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO-12.html

[編輯] Separate Kernel Address Space

提供加強性安全與效能 DebianPackages:kernel-patch-skas

[編輯] 相關文件/延伸閱讀

取自"http://wiki.debian.org.tw/index.php/UserModeLinux"

本頁面已經被瀏覽18,699次。 這頁的最後修訂在 2007年10月20日 (星期六) 17:30。 本站的全部文本內容在GNU Free Documentation License 1.2之條款下提供。


[Main Page]
Main Page
社區
近期活動
最近更改
隨機頁面
幫助
贊助

編輯本頁
討論本頁
頁面歷史
鏈入頁面
鏈出更改

特殊頁面
錯誤報告