"brand": "lx", 
   "alias": "ubuntu1404", 
   "kernel_version": "3.13.0", 
   "max_physical_memory": 2048, 
   "image_uuid": "a21a64a0-0809-11e5-a64f-ff80e8e8086f", 
   "resolvers": ["","","",""], 
   "nics": [ 
       "nic_tag": "admin", 
       "ip": "", 
       "netmask": "", 
       "gateway": "", 
       "primary": true 
   "filesystems": [ 
       "type": "lofs", 
       "source": "zones/datastore", 
       "target": "/mnt/datastore" 
export vmuuid="71962330-42d7-4c5f-9dd4-e66af460aaac" 
vmadm boot $vmuuid order=cd,once=d cdrom=/CentOS-6.8-x86_64-minimal.iso,ide
vmadm update $vmuuid vnc_password=gogogo
vmadm update $vmuuid vnc_port=54669
mkdir /opt/artifacts 
cd /opt/artifacts
curl -kLO
Alternative VirtIO drivers: curl -LO  
curl -kLO
vmadm create < /opt/artifacts/win2k12r2_vm.json
export vmuuid="<<UUID from vmadm create>>" 
cp virtio-win* /zones/$vmuuid/root/ cp en_windows_10_multiple_editions_x64_dvd_6846432.iso /zones/$vmuuid/root/ 
vmadm boot $vmuuid order=cd,once=d cdrom=windows.iso,ide cdrom=virtio-win-0.1-49.iso,ide
#load drivers then from another cd
"filesystems": [
      "type": "lofs",
      "source": "zones/datastore/netatalk",
      "target": "/mnt/datastore"
vmadm update alias=name
# cat meta.json
         {"opsys": "ubuntu"}
# vmadm update ed9879e8-764a-4c15-a298-6b51e815b68e < meta.json
Successfully updated ed9879e8-764a-4c15-a298-6b51e815b68e
vmadm console <VM-UUID>
vmadm update <VM-UUID> vnc_password=<password>
vmadm update <VM-UUID> qemu_extra_opts = "-k <yourkeyboard>"
vmadm start <VM-UUID> order=cd,once=d cdrom=/centos.iso,ide
After shutting down the VM, you can create a snapshot of the guest volumes using zfs snapshot . In a second step, run zfs send to generate a file from the snapshot and compress the file:
zfs snapshot zones/5562fffe-96b1-454e-aff0-6d8782875f2e-disk0@image
zfs send zones/5562fffe-96b1-454e-aff0-6d8782875f2e-disk0@image | gzip > centos6.5.zvol.gz
A complete VM template is nothing more than a compressed image, together with a file containing the metadata – again in JSON format. An example of this is shown in Listing 3. Most of the entries should be self-explanatory. The UUIDs that you enter (e.g., for uuid , creator_uuid , and vendor_uuid ) can be created with the uuid command. Entering ls -l shows the disk size . The SHA1 hash is somewhat more difficult because you create it with the digest command:
/usr/bin/digest -a sha1 centos6.5.zvol.gz
The timestamps do not need to be accurate. It’s fine just to adjust the date. After completing the manifest file, import the template into your own store:
imgadm install -m centos6.5.dsmanifest -f centos6.5.zvol.gz
and then the template is ready for creating new VMs.
Listing 3: centos6.5.dsmanifest
    "name": "centos-6.5",
  version: "1.0.0",
    "type": "zvol",
    "cpu_type": "qemu64",
    "description": "Centos 6.5 VM 1.0.0",
    "created_at": "2013-12-04T02:51:46.994Z",
    "updated_at": "2013-12-04T02:51:46.994Z",
    "os": "linux",
    "image_size": 10000,
    "files": [
        "path": "centos6.5.zvol.gz",
        "sha1": "92a100d8eb2c2fd436db1d2b539aa26894f919cb",
        "size": 285111272
    "requirements": {
      "networks": [
          "name": "net0",
          "description": "public"
      "ssh_key": true
    "disk_driver": "virtio",
    "nic_driver": "virtio",
    "uuid": "555793a9-3c32-4eb9-ae81-f60176d8a8e3",
    "creator_uuid": "352971aa-31ba-496c-9ade-a379feaecd52",
    "vendor_uuid": "352971aa-31ba-496c-9ade-a379feaecd52",
    "creator_name": "ADMIN",
    "platform_type": "smartos",
    "cloud_name": "sdc",
    "urn": "sdc:ADMIN:centos-6.5:1.0.0",
    "published_at": "2013-12-04T02:51:46.994Z"
Home-Grown Migration
In a similar way, you manage a kind of home-grown virtual machine migration, for which you need to convert the image of the VM to RAW format on the originating host if it is not already stored this way. To do this on Linux, for example, you would use qemu-img convert then copy the RAW image to the SmartOS host on which you create a new VM with the appropriate disk size, as described. The last step is to copy the data directly into the ZFS raw device using dd or cat :
dd if=centos.img of=/dev/zvol/rdsk/zones/<UUID>
This approach is described without any warranty and only recommended for experiments.
As described so far, SmartOS is ideally suited for testing systems in virtual machines. If you want to build a cloud or use SmartOS professionally in some other way, you will not get far with manual administration. Provisioning and configuration management software is recommended for automation purposes.
The method of booting SmartOS via PXE has already been mentioned, and detailed instructions are available. Programs such as Puppet or CFEngine are useful for configuration management. However, Chef [1] is supported best, with Joyent providing various Cookbooks itself. More experimental, but perhaps worth a look, is the FIFO project, which implements a web-based GUI for managing virtual machines on SmartOS.
Installing Chef is possible in three ways: the Omnibus installer by Chef/Opscode, which is still considered experimental; the fat client by Joyent; or manual installation using PKG-SRC. Monitoring options include a Nagios Remote Plugin Executor (NRPE) for the global zone. Joyent always uses Zabbix [2] monitoring.
Although SmartOS theoretically runs on various server hardware, you would again do well to be guided by Joyent for production use. They recommend, for example, SAS connectivity for storage instead of SATA. Also, a sufficient amount of memory is never a bad thing. More details can be found in a post by Joyent employee Keith Wesolowski.
zpool add zones cache c8t3d0
zpool add zones cache c8t3d0
zpool status 
zpool remove oradata c8t3d0
[root@smb ~]# groupadd -g 50000 samba
[root@smb ~]# useradd -u 50000 -g samba -s /usr/bin/false -d /home/samba samba
[root@smb ~]# smbpasswd -a samba
[root@smb: ~]# svcadm enable svc:/pkgsrc/samba:smbd
[root@smb: ~]# svcadm enable svc:/pkgsrc/samba:nmdb
[root@smb: ~]# svcs -a | grep samba
groupadd -g 50000 nas
mkdir /home/media
useradd -u 50000 -g nas -s /usr/bin/false -d /home/media media
smbpasswd -a media
mima: media
svcadm  restart svc:/pkgsrc/samba:smbd
groupadd -g 50000 ops
mkdir /home/ops
useradd -u 50000 -g ops -s /bin/false -d /home/ops ops
chown ops:ops /home/ops -R
down vote
We can see the maximum number of threads defined in the following file in linux
cat /proc/sys/kernel/threads-max
sysctl -a | grep threads-max
root @ [ datadyne :: (SunOS) ] ~ # vmadm list -o uuid -H alias=zone1
root @ [ datadyne :: (SunOS) ] ~ # zonecfg -z d0627c90-f603-4467-8f34-37a97f97d078
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078> add fs
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078:fs> set dir=/entertainment
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078:fs> set special=/goliath/entertainment
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078:fs> set type=lofs
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078:fs> add options [ro]
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078:fs> end
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078> verify
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078> commit
zonecfg:d0627c90-f603-4467-8f34-37a97f97d078> exit
[root@INFINITBYTE /opt]# zonecfg  -z e6e81d82-5456-43f7-9a5e-d39c1d86fad0 
zonecfg:e6e81d82-5456-43f7-9a5e-d39c1d86fad0> remove fs dir=/mnt/TDDOWNLOAD
zonecfg:e6e81d82-5456-43f7-9a5e-d39c1d86fad0> commit
zonecfg:e6e81d82-5456-43f7-9a5e-d39c1d86fad0> verify
zonecfg:e6e81d82-5456-43f7-9a5e-d39c1d86fad0> exit
vmadm update e6e81d82-5456-43f7-9a5e-d39c1d86fad0  max_lwps=4000
  • storage/zfs/smartos/smartos填坑.txt
  • 最后更改: 2019/04/16 18:31
  • (外部编辑)