opensolaris 2009.06 workshop
Embed Size (px)
TRANSCRIPT
PowerPoint Presentation
OpenSolaris 2009.06
Markus WeberSun Microsystems, Inc.
Iban NietoOpenSolaris Community
A Workshop for some keyTechnologies
Agenda
Install OpenSolaris 2009.06
Sun VirtualBox
IPS, Package Manager, and Repositories
ZFS & Time Slider
DTrace
If time permits: Crossbow & Containers
This presentation will show how the OpenSolaris OS ties into how open source OS technologies have been evolving over the last couple of decades, and show how the innovative features in the Solaris OS have laid the foundation for even more great new projects, making for an OS that's easy to use and support, and is an ideal platform for leading edge development and deployment.
Install OpenSolaris 2009.06
Options:
Upgrade from a previous version
Natively on your laptop
In a partition on your laptop
In VirtualBox
Install OpenSolaris 2009.06
Basic System Requirements:
At least 512MB memory, more is better
Recommended at least 9GB disk space
Upgrade to OpenSolaris 2009.06
Package ManagerUpdate All
Follow instructions
Command Line:pfexec su
pkg image-update [-nv]
Follow instructions
Install OpenSolaris 2009.06 Natively
Boot from OpenSolaris LiveCD
OpenSolaris LiveUSB
Use Device Driver UtilityTo check support for your devices
If ok, installGo through easy installation wizard
Reboot
Done !
Install OpenSolaris 2009.06 in Partition
Notes if running Windows:
If you have Windows installed, and you set up sufficient space for installing the OpenSolaris 2009.06 operating system, the installation should be straightforward. All versions of the OpenSolaris software for the x86 platform use the GNU Grand Unified Bootloader (GRUB). The OpenSolaris software recognizes Windows and ensures that the Windows partitions remain unchanged during an installation. When the OpenSolaris installation completes, and the system reboots, the GRUB menu displays both the Windows and the OpenSolaris boot entries.
Install OpenSolaris 2009.06 in Partition
Notes if running Linux:
If you have either the Linux or Windows operating systems
installed on your system, before installing the OpenSolaris
operating system, save a copy of the menu.lst file. You will need
to manually update the menu.lst file to add the Linux information
after the OpenSolaris installation completes.
For instructions on that, please check:
http://dlc.sun.com/osol/docs/content/2009.06/getstart/linuxgrub.html#linuxgrubtask
Install OpenSolaris 2009.06 in Partition
Notes if running Solaris 10:The installer cannot be used to
multiboot the OpenSolaris operating system. However, the installer
can be used to replace the Solaris 10 1/06 and later releases in an
existing multiboot Solaris system.
Notes on Extended Partitions:
If you have another operating system installed on an extended
partition, the existing extended partition is neither changed nor
lost during an OpenSolaris installation. Existing extended
partitions are not visible during the installation, but the primary
fdisk partition in which the extended partition resides is visible.
No data in these partitions is lost as a result of the
installation. The operating system on an extended partition is not
displayed in the GRUB menu.
Install OpenSolaris 2009.06 in Partition
For more information on how to install OpenSolaris 2009.06 in a
multiboot environment, please check:
http://dlc.sun.com/osol/docs/content/2009.06/getstart/partition.html
Install OpenSolaris 2009.06 in VirtualBox
http://www.virtualbox.orgDownload and install binaries
according
to your OSFor any Windows, Linux, Solaris/OpenSolaris,
Mac OS X (Intel)
http://www.opensolaris/getDownload OpenSolaris .iso file
Or use LiveCD
Install OpenSolaris 2009.06 in VirtualBox
In VirtualBox: NewChoose OS, a name, memory size, (virtual) disk image, Finish
Change graphic memory, attached .iso or LiveCD.
Start
Install OpenSolaris
Install Guest Additions !!Devices Install Guest Additions...
As root, cd /media, pkgadd -d .pkg
Sun VirtualBox
Host Platforms
Guest Platforms
x86 Hardware
Sun VirtualBox
Broad platform supportHosts: Windows, Solaris, Linux, OS X
Guests: Support for practically any x86-based OS
Powerful virtual hardware and device support
Versatile Networking options
Rich host/guest integration
Virtual SATA or IDE: up to 32 disks
Virtual NICs: gigabit ethernet E1000
Virtual USB Controller: USB 1.1 and 2.0 (with USB device filter)
Full ACPI Support: guests reflect power status of host
Virtual CD/DVD: passthru for CD/DVD writing
Processor: 32-bit and 64-bit guests; PAE support
Graphics Acceleration: OpenGL for Windows Guests
Sun VirtualBox: a useful example
Sun VirtualBox: the main window
Check out all theConfiguration options.
And play around with it !!
What is IPS ?
Image Packaging System
Repositories
Easy to package
for the developer
Determine, control
and resolve dependencies
Rapid delivery of fixes
Upgrade and rollback with ZFS snapshots
What are Repositories ?
Community
Sun
Release
Develop
Contribute
Pending
Extra
Support
Command Line Interface to IPS
beadm(boot environment administration)beadmget a list of option (some require pfexec / root)
man beadmfor man pages
beadm listlist current boot environments
pkg(image packaging retrieval client)pkg get a list of options (some require pfexec / root)
man pkgfor man pages
pkg publishercheck current publishing authorities
pkg historysome history information
pkg info [ |more ]check all packages installed (long output !)
Command Line Interface to IPS
Curious or adventerous ? Let's add the /dev repository:pkg publisher
pfexec pkg set-publisher -O \ http://pkg.opensolaris.org/dev dev.opensolaris.org
pkg publisher
pkg unset-publisher dev.opensolaris.org (if you want)
Want VirtualBox and flash ? Let's add the /extra repository:Go to http://pkg.sun.com and register
Download SSL key & certificate
pfexec pkg set-publisher -k \
-c -O \ https://pkg.sun.com/opensolaris/extra/ \
extra.opensolaris.org
Command Line Interface to IPS
Flashpkg info -r flash
pfexec pkg install flash
VirtualBoxpkg info -r virtualbox
pfexec pkg install virtualbox
OpenOfficepkg info -r openoffice
pfexec pkg install openoffice
Enhanced Package Manager
Package Manager
Discover 'Repository' drop-down menu on the top right
Discover categories drop-down menu on the top left
Discover sub-categories on the left panel
Click on a package, and check out 'Files', 'Dependencies', and 'Licence on the bottom
Play with the 'Search' function
Click on 'File' 'Manage Boot Environments...'
Click on 'File' 'Manage Repositories...'
Package Manager: Manage Repositories
Click on 'File' 'Manage Repositories...'
Let's add the sunfreeware.com repository:
Package Manager: Manage Repositories
Browse or search through the packages
Click on a package, and select 'Install/Update'
ZFS & Time Slider
Time Slider
Let's configure it
Let's use it
Use it everyday, even for your own version control !
Time Slider
'System' 'Administration' 'Time Slider':
Enable it
Choose 'All' or 'Custom'
Also note the 'Delete
Snapshots...' button
Time Slider
Open the File Browser (the house/home button)
Navigate to any directory that is snapshot'ed
Click on 'Restore'
Notice the 'Time Slider'
Slide the 'Time Slider'
(note: if you setup Time Slider only a few minutes ago,
of course the will not be any snapshots yet)
However, New: create a snapshot of this directory manually by clicking on the camera icon !
Time Slider
Time Slider
Once you have snapshots, delete a file
Then, 'travel back' in time on the slider.
Select the deleted file, right-click, select
'Restore to Desktop'
Backup / Restore as easy as that !!!
Open a new tab, compare directories
To close Time Slider, click on the white cross in red
circle button on the top left.
ZFS
ZFS is VERY cool !The underlying technology that makes Time Slider possible
End-to-End data integrity256bit checksums
Copy-on-write transactions
Immense data capacity128bit filesystem
Easy to usePooled storage model no more volume mgr
ZFS
To create one or more pools (zpool), let's simulate
physical hard drives:Files can be used for that:mkfile 100m
/disk1
mkfile 100m /disk2
etc.
Or, virtual SATA disks in VirtualBox:On the powered-off
OpenSolaris guest, open
'Hard Disks', then 'Enable Additional Controller',
then create some virtual disks
ZFS
zpoolto see options
man zpoolfor man pages
zfsto see options
man zfsfor man pages
ZFS Reference, Commands and Examples
Create a ZFS storage pool # zpool create mpool mirror c1t0d0 c2t0d0
Add capacity to a ZFS storage pool # zpool add mpool mirror c5t0d0 c6t0d0
Add hot spares to a ZFS storage pool # zpool add mypool spare c6t0d0 c7t0d0
Replace a device in a storage pool # zpool replace mpool c6t0d0 [c7t0d0]
Display storage pool capacity # zpool list
Display storage pool status # zpool status
Scrub a pool # zpool scrub mpool
Remove a pool # zpool destroy mpool
Create a ZFS file system # zfs create mpool/devel
Create a child ZFS file system# zfs create mpool/devel/data
Remove a file system # zfs destroy mpool/devel
Take a snapshot of a file system # zfs snapshot mpool/devel/[email protected]
Roll back to a file system snapshot # zfs rollback -r mpool/devel/[email protected]
Create a writable clone from a snapshot# zfs clone mpool/devel/[email protected] mpool/clones/devdata
ZFS Reference, Commands and Examples
Remove a snapshot# zfs destroy mpool/devel/[email protected]
Enable compression on a file system # zfs set compression=on mpool/clones/devdata
Disable compression on a file system# zfs inherit compression mpool/clones/devdata
Set a quota on a file system # zfs set quota=60G mpool/devel/data
Set a reservation on a new file system # zfs create -o reserv=20G mpool/devel/admin
Share a file system over NFS# zfs set sharenfs=on mpool/devel/data
Create a ZFS volume # zfs create -V 2GB mpool/vol
Remove a ZFS volume# zfs destroy mpool/vol
ZFS Basics
Note: if you don't want to type pfexec all the time, just do
'pfexec su -'
Create a mirrored zpoolzpool create mypool mirror /file1 /file2 or
zpool create mypool mirror c1t0d0s2 c1t1d0s2 (example for VirtualBox, check with 'format')
zpool list
zpool status mysool
Add more disks to the pool (easy !)zpool add mypool mirror file3
file 4
(or different for VirtualBox)
zpool list
zpool status mysool
ZFS Basics
Create a mirrored zpoolzpool create mypool mirror file1 file2or
zpool create mypool mirror c1t0d0s2 c1t1d0s2 (example for VirtualBox, check with 'format')
zpool list
zpool status mysool
Add more disks to the pool (easy !)zpool add mypool mirror file3
file 4
(or different for VirtualBox)
zpool list
zpool status mysool
Create a zfs filesystemzfs list
zfs create mypool/myfsor
zfs create -o mountpoint=/export/myfs mypool/myfs
zfs list
Note: no format, no newfs, no /etc/vfstab, no mount !!
ZFS Basics
Let's do some snapshotting !cd /mypool/myfs or /export/myfs
ls -l
echo Before Snapshot > file1.txt
zfs snapshot mypool/[email protected]
zfs list -t all | grep mypool
(note, at that moment you might actually see also some snapshots
created by time slider !)
rm file1.txt
echo After Snapshot > file1.txt
cat file1.txt
zfs rollback mypool/[email protected]
ls -l
cat file1.txt
ZFS Basics
Backup and Restore complete filesystems or poolszfs send mypool/[email protected] > /tmp/zfsdata
zfs destroy -r mypool/myfs
Note: the -r option recursively destroys all children, including
snapshots.
ls -l /mypool/myfs (gone !)
zfs receive -d mypool < /tmp/zfsdata
ls -l /mypool/myfs (back !)
Note: you can also backup to different system(s) by using something like:zfs send | ssh zfs receive
ZFS Basics
RAID-ZRAID-Z (Redundant Array of Inexpensive Disks) is similar to RAID-5 but it's a bit better because it checksums on multiple disks, so data security is higher and performance is also better thanks to organizing data in a way that the disks are well harnessed (less going there and back to get data).
zpool destroy mypool
zpool create mypool raidz file1 file2 file3
zpool list
zpool status mypool
ZFS Basics
Other useful commands:zfs create mypool/home
zfs create mypool/home/jorge
zfs create mypool/home/antonio
zfs create mypool/home/maria
Zfs list
zfs set quota=20m mypool/home/jorge
zfs set reservation=10m mypool/home/maria
zfs get quota mypool/home/jorge
zfs get quota mypool/home/maria
zfs get reservation mypool/home/jorge
zfs get reservation mypool/home/maria
ZFS Basics
Other useful commands (cont.):cd /mypool/home/jorge/
mkfile 30m testtest: initialized 20840448 of 31457280 bytes: Disc quota exceeded
To see all properties:zfs get mypool/home/jorge
ZFS Basics
Want to use OpenSolaris as a storage server ?zfs create mypool/nfsshare
zfs set sharenfs=on mypool/nfsshare
zfs get sharenfs mypool/nfsshare
Happy Sharing !!
ZFS Basics
Want to use OpenSolaris as a storage server ?pkg install SUNWsmbs (might be necessary to reboot)
svcadm enable -r smb/server
zfs create -o casesensitivity=mixed \ mypool/cifsshare
zfs set sharesmb=on mypool/cifsshare
zfs get sharesmb mypool/cifsshare
sharemgr show -vp
Happy Sharing !!Note: if working with, and connecting from
certain Windows workgroups, there are a few more steps.
Check out the How to Guide !
DTrace
Tool to observe and understand dynamic behavior of entire software system
Fundamentally different from previous toolsSoftware does not have to be instrumented or explicitly built for monitoring
Safe for use on live production systems
No overhead until probes are enabled, and then only minimal overhead
Includes programming language (D) for expressing variety of tracing behaviorNot super simple, but many free scripts, some C-like elements
DTrace
Let's check what's available:pfexec su -
dtrace -l | more
dtrace -l | wc -l
Create a file call syscall.dsyscall:::entry
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
DTrace
Let's check what's available:pfexec su -
dtrace -l | more
dtrace -l | wc -l
Create a file call syscall.dsyscall:::entry
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
Not interested in Xorg calls ? Modify file:syscall:::entry
/execname != Xorg/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
DTrace
Not interested in Xorg calls ? Modify file:syscall:::entry
/execname != Xorg/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
Also not interested in dtrace calls ? Modify file:syscall:::entry
/execname != Xorg && execname != dtrace/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
DTrace
Only interested in calls by firefox ? Modify file:syscall:::entry
/execname == firefox-bin/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
Also not interested in dtrace calls ? Modify file:syscall:::entry
/execname != Xorg && execname != dtrace/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
DTrace
Only interested in calls by firefox ? Modify file:syscall:::entry
/execname == firefox-bin/
{
printf("%s(%d) called %s\n", execname, pid, probefunc);
}
Execute the file with:dtrace -qs syscall.d
So you already understand some very bascis !
But what did the dtrace -l output actually mean ?Dtrace uses 'Probes'
Probes are instrumentation pointsThink of them as 'sensors' on your system, at any touch point of software (kernel, OS, applications, code, etc.)
The names are a four-tuple: provider:module:function:name
Examples:fbt:zfs:zfs_create_unique_device:entry
fbt:zfs:zfs_create_unique_device:return
DTrace
provider:module:function:name means:
Provider A library of related probes.
Module The module the function belongs to, either a kernel module or user segment.
Function The function name that contains the probe.
Name The name of the probe.
DTrace
There a many D scripts, information, and tutorials out there !
Very good starting point:
http://www.opensolaris.org/os/community/dtrace/
Network Virtualization
Network virtualization (Project Crossbow)Enable Open Networking
Bandwith ControlDown to the protocol and port level
Virtual Wire virtualize everything
NICs, Firewall, Switches, Routers
Don't run out of physical NICs anymore !
Project Crossbow
Project Crossbow
Network Virtualization
A great 'Getting Started Guide':
http://www.sun.com/bigadmin/features/articles/crossbow_net_virt.pdf
Network Virtualization
Let's create a VNIC, and then a zone with exclusive IP stack (to
use dhcp):
dladm show-link
(check your physical NIC in this example, we have e1000g0)
dladm create-vnic -l e1000g0 zonenic1
dladm show-link
dladm show-vnic
(notice also the randomly assigned MAC address)
ifconfig zonenic1 plumb
ifconfig -a
Network Virtualization
Let's see if we can get a dhcp address:
ifconfig zonenic1 dhcp
ifconfig -a
ifconfig zonenic1 unplumb
ifconfig -a
Let's create a filesystem for our zone(s):zfs create rpool/export/zones
zfs list
Network Virtualization
Let's create a zone !
# zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/zones/zone1
zonecfg:zone1> set autoboot=false
zonecfg:zone1> set ip-type=exclusive
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=zonenic1
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
Network Virtualization
Let's install and boot the zone:
zoneadm -z zone1 install
(note: this might take a while, as it will fetch the OpenSolaris
image from the /release repository !)
zoneadm -z zone1 boot
zlogin -C zone1
(to get console access to the booting zone)
Go through the few installation steps
You might then have to configure it to use dhcp:
touch /etc/dhcp.zonenic1
Delete hostname entry in /etc/hosts
Network Virtualization
reboot
(check out how fast a zone reboots !)
zlogin zone1
(from the global zone)
To monitor the virtual network interface:netstat -a -I zonenic1 5
You just created a new 'virtual machine' on your laptop !!
OpenSolaris Books
opensolaris.org & opensolaris.com
OpenSolaris Unlocks Your Potential
OpenSolaris: Get it. Use it. Learn it.
opensolaris.com/get
OpenSolaris 2009.06
A Workshop for some keyTechnologies
?
?
?
?
?
?
?
?
?
?
Markus WeberSun Microsystems, Inc.
Iban NietoOpenSolaris Community
Click to edit the title text format
Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level
OpenSolaris 2009.06
pg