establish Solaris xVM virtual machine on zfs disk

本文介绍了如何在Solaris系统中创建分区,并利用ZFS文件系统创建了一个8GB的存储卷,用于存放虚拟机镜像。同时,还演示了使用virt-install工具创建虚拟机的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. Create a Solaris partition

[allen@araj-nhm:~]sudo format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 38899 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1f,2/ide@0/cmdk@0,0
Specify disk (enter its number): 0
selecting c0d0
Controller working list found
[disk formatted, defect list found]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0d0s1 is currently used by swap. Please see swap(1M).


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> parti


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> print
Current partition table (original):
Total disk cylinders available: 38899 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm   32525 - 38898       48.83GB    (6374/0/0)  102398310
  1       swap    wu       3 -   263        2.00GB    (261/0/0)     4192965
  2     backup    wm       0 - 38898      297.98GB    (38899/0/0) 624912435
  3        usr    wm     264 -  2874       20.00GB    (2611/0/0)   41945715
  4        usr    wm    2875 -  5485       20.00GB    (2611/0/0)   41945715
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 alternates    wu       1 -     2       15.69MB    (2/0/0)         32130

partition> 5
Part      Tag    Flag     Cylinders         Size            Blocks
  5 unassigned    wm       0                0         (0/0/0)             0

Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[3]: 5486
Enter partition size[0b, 0c, 5486e, 0.00mb, 0.00gb]: 40gb
partition> print
Current partition table (unnamed):
Total disk cylinders available: 38899 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm   32525 - 38898       48.83GB    (6374/0/0)  102398310
  1       swap    wu       3 -   263        2.00GB    (261/0/0)     4192965
  2     backup    wm       0 - 38898      297.98GB    (38899/0/0) 624912435
  3        usr    wm     264 -  2874       20.00GB    (2611/0/0)   41945715
  4        usr    wm    2875 -  5485       20.00GB    (2611/0/0)   41945715
  5        usr    wm    5486 - 10707       40.00GB    (5222/0/0)   83891430
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 alternates    wu       1 -     2       15.69MB    (2/0/0)         32130

partition> label
Ready to label disk, continue? y

partition> quit


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> label
Ready to label disk, continue? y

format> quit

2. Create a new storage pool named xpool that includes the disk c1t0d0.

[allen@araj-nhm:~]sudo zpool create -f xpool c0d0s5
[allen@araj-nhm:~]sudo zpool list
NAME    SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
xpool  39.8G   111K  39.7G     0%  ONLINE  -
[allen@araj-nhm:~]sudo zpool iostat
               capacity     operations    bandwidth
pool         used  avail   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
xpool        111K  39.7G      0      2   1005  28.2K

3. Create an 8–Gbyte Solaris ZFS volume to store the guest domain master image.

[allen@araj-nhm:~]sudo zfs create -V 8gb xpool/domU-b93   
[allen@araj-nhm:~]ls -l /dev/zvol/dsk/xpool
total 1
lrwxrwxrwx 1 root root 35 Sep  4 13:44 domU-b93 -> ../../../../devices/pseudo/zfs@0:1c

4. Create the guest on zfs
[allen@araj-nhm:~]sudo virt-install
What is the name of your virtual machine? zfs-domu-93
 How much RAM should be allocated (in megabytes)? 1024
 What would you like to use as the disk (file path)? /dev/zvol/dsk/xpool/domU-b93
 Would you like to enable graphics support? (yes or no) no
 What is the install location? /export/home/allen/ISO/sol-11-x86-snv-93.iso
 

Starting install...
Creating domain...                                                 0 B 00:04
v3.1.4-xvm chgset 'Mon Jun 23 23:14:22 2008 -0700 15877:5a856f19f90d'
SunOS Release 5.11 Version snv_93 32-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Configuring /dev
/platform/i86xpv/kernel/drv/xdt: undefined symbol 'dtrace_unregister'
/platform/i86xpv/kernel/drv/xdt: undefined symbol 'dtrace_register'
/platform/i86xpv/kernel/drv/xdt: undefined symbol 'dtrace_probe_create'
/platform/i86xpv/kernel/drv/xdt: undefined symbol 'dtrace_probe_lookup'
/platform/i86xpv/kernel/drv/xdt: undefined symbol 'dtrace_probe'
WARNING: mod_load: cannot load module 'xdt'
WARNING: xdt: unable to resolve dependency, module 'drv/dtrace' not found


    1.     Solaris Interactive Text (Console session) (default)
    2.     Apply driver updates
    3.     Single user shell

Enter the number of your choice.
Selected: 1                                        

Solaris Interactive Text (Console session)

Using install cd in /dev/dsk/c0t1d0p0
Using RPC Bootparams for network configuration information.
Attempting to configure interface xnf0...
Skipped interface xnf0
Reading ZFS config: done.
Setting up Java. Please wait...
Serial console, reverting to text install
Beginning system identification...
Searching for configuration file(s)...
Search complete.
Discovering additional network configuration...


Select a Language

   1. English
   2. French
   3. German
   4. Italian
   5. Japanese
   6. Korean
   7. Simplified Chinese
   8. Spanish
   9. Swedish
  10. Traditional Chinese

Please make a choice (1 - 10), or press h or ? for help: 1

What type of terminal are you using?
 1) ANSI Standard CRT
 2) DEC VT52
 3) DEC VT100
 4) Heathkit 19
 5) Lear Siegler ADM31
 6) PC Console
 7) Sun Command Tool
 8) Sun Workstation
 9) Televideo 910
 10) Televideo 925
 11) Wyse Model 50
 12) X Terminal Emulator (xterms)
 13) CDE Terminal Emulator (dtterm)
 14) Other
Type the number of your choice and press Return: 12
Completing system identification...
in.rdisc: No interfaces up
Starting remote procedure call (RPC) services: done.
System identification is completed.
System identification complete.
Starting Solaris installation program...
Executing JumpStart preinstall phase...
Searching for SolStart directory...
Checking rules.ok file...
Using begin script: install_begin
Using finish script: patch_finish
Executing SolStart preinstall phase...
Executing begin script "install_begin"...
Begin script install_begin execution completed.

Preparing system for Solaris install

Configuring disk (c0t0d0)
    - Creating Fdisk partition table
    - Creating Solaris disk label (VTOC)

Creating and checking file systems
    - Creating / (c0t0d0s0)

Beginning Solaris software installation

Solaris 11 software installation succeeded

Customizing system files
    - Mount points table (/etc/vfstab)
    - Network host addresses (/etc/hosts)
    - Environment variables (/etc/default/init)

Cleaning devices

Customizing system devices
    - Physical devices (/devices)
    - Logical devices (/dev)

Installing boot information
    - Updating boot environment configuration file

Installation log location
    - /a/var/sadm/system/logs/install_log (before reboot)
    - /var/sadm/system/logs/install_log (after reboot)

Installation complete
Executing SolStart postinstall phase...
Executing finish script "patch_finish"...


Finish script patch_finish execution completed.

Executing JumpStart postinstall phase...

The begin script log 'begin.log'
    is located in /var/sadm/system/logs after reboot.

The finish script log 'finish.log'
    is located in /var/sadm/system/logs after reboot.


Launching installer. Please Wait...



Installing Additional Software
|-1%--------------25%-----------------50%-----------------75%--------------100%|

   Pausing for 30 seconds at the "Summary" screen. The wizard will continue to
   the next step unless you select "Pause". Enter 'p' to pause. Enter 'c' to
   continue. [c]

   Pausing for 90 seconds at the "Reboot" screen. The wizard will continue to
   the next step unless you select "Pause". Enter 'p' to pause. Enter 'c' to
   continue. [c]
Creating boot_archive for /a
updating /a/platform/i86pc/boot_archive
updating /a/platform/i86pc/amd64/boot_archive
syncing file systems... done
rebooting...
unable to open console: Error 0

Guest installation complete... restarting guest.
v3.1.4-xvm chgset 'Mon Jun 23 23:14:22 2008 -0700 15877:5a856f19f90d'
SunOS Release 5.11 Version snv_93 64-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: unknown
Configuring devices.
Loading smf(5) service descriptions: 197/197
Reading ZFS config: done.
Creating new rsa public/private host key pair
Creating new dsa public/private host key pair
USB keyboard

unknown console login:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值