Posts by Category

Buttons

Pure New Zealand

This site is driven by Blosxom

T
his site was written in vi

SDF is driven by NetBSD

Subscribe to this sites RSS/XML feed

This site has a Tableless Stylesheet

Email me
home :: tech :: unix :: solaris

Jan 09, 2007

Solaris ZFS Tips & Tricks

Configure the /devices directory to make physical disks available for use:

# drvconfig

Creates /dev entries for hard disks attached to the system:

# disks

List available disks and format them:

# format

You can activate the ZFS web gui:

# /usr/sbin/smcwebserver start

Access it via your browser:

https://hostname:6789

Create a mirrored disk:

/usr/sbin/zpool create -f testfs mirror c0d1 c1d1

Replace device in mirror:

/usr/sbin/zpool replace -f testfs c1d1

Create the snapshot:

/usr/sbin/zfs snapshot testfs@test_snap

Access a snapshot through the .zfs/snapshot directory at the root of the filesystem.

Excellent ZFS cheat-sheet over at Unix Admin Corner.

A useful step-through for adding disks to Solaris over at KernelTrap.

Great blog with tips on using Zones with ZFS and securing your Solaris system - Clingan.

[/tech/unix/solaris] | [permalink] | [2007.01.09-00:23.00]

Oct 24, 2005

Solaris OpenBoot Commands

Notes from Sun Certified Solaris 9.0 System and Network Administrator All-in-One Exam Guide:

OpenBoot

View the OpenBoot release information for your firmware, as well as the system configuration:

ok banner SPARCstation 20, Type 5 Keyboard ROM Rev. 2.4, 256 MB memory installed, Serial #456543 Ethernet address 5:2:12:c:ee:5a HostID 456543

The OpenBoot PROM monitor is based on the Forth programming language, and can be used to run Forth programs that perform the following functions:

Booting the system, by using the boot command

Performing diagnostics on hardware devices by using the diag command

Testing network connectivity by using the watch-net command

The OpenBoot monitor has two prompts from which commands can be issued: the ok prompt, and the > prompt. In order to switch from the > prompt to the ok prompt, you simply need to type n:

> n ok

Changing the Default Boot Device To boot from the default boot device (usually the primary hard drive), you would enter the following:

ok boot

However, it is also possible to boot using the CDROM by using this command:

ok boot cdrom

The system may be booted from a host on the network by using this command:

ok boot net

Alternatively, if you have a boot floppy, the following command may be used:

ok boot floppy

Because many early Solaris distributions were made on magnetic tape, it’s also possible to boot using a tape drive with the following command:

ok boot tape

Instead of specifying a different boot device each time you want to reboot, it is possible to set an environment variable within the OpenBoot monitor, so that a specific device is booted by default. For example, to set the default boot device to be the primary hard disk, you would use the following command:

ok setenv boot-device disk boot-device = disk

To verify that the boot device has been set correctly to disk, the following command can be used:

ok printenv boot-device boot-device disk

In order to reset the system, to use the new settings, you simply use the reset command:

ok reset

To set the default boot device to be the primary network device, you would use the following command:

ok setenv boot-device net boot-device = net

This configuration is commonly used for diskless clients, such as Sun Rays, which use RARP and NFS to boot across the network. To verify that the boot device has been set correctly to net, the following command can be used:

ok printenv boot-device boot-device net disk

To set the default boot device to be the primary CD-ROM device, you would use the following command:

ok setenv boot-device cdrom boot-device = cdrom

To verify that the boot device has been set correctly to cdrom, the following command can be used:

ok printenv boot-device boot-device cdrom disk

To set the default boot device to be the primary floppy drive, you would use the following command:

ok setenv boot-device floppy boot-device = floppy

To verify that the boot device has been set correctly to floppy, the following command can be used:

ok printenv boot-device boot-device floppy disk

To set the default boot device to be the primary tape drive, you would use the following command:

ok setenv boot-device tape boot-device = tape

To verify that the boot device has been set correctly to tape, the following command can be used:

ok printenv boot-device boot-device tape disk

Testing System Hardware

The test command is used to test specific hardware devices, such as the loopback network device. This device could be tested by using the following command:

ok test net Internal Loopback test - (OK) External Loopback test - (OK)

This indicates that the loopback device is operating correctly. Alternatively, the watch-clock command is used to test the clock device:

ok watch-clock Watching the 'seconds' register of the real time clock chip. It should be ticking once a second. Type any key to stop. 1 2 3 Tip Timing results can be cross-checked against a reliable timing device for accuracy.

If the system is meant to boot across the network, but a boot attempt does not succeed, it is possible to test network connectivity using the watch-net program. This determines whether or not the system’s primary network interface is able to read packets from the network it is connected to. The output from the watch-net program looks like this:

Internal Loopback test - succeeded External Loopback test - succeeded Looking for Ethernet packets. '.' is a good packet. 'X' is a bad packet. Type any key to stop ......X.........XXXX.....….XX............ In this case, a number of packets are marked as bad, even though the system has been connected successfully to the network.

In addition to the watch-net command, the OpenBoot monitor can perform a number of other diagnostic tests. For example, all of the SCSI devices attached to the system can be detected by using the probe-scsi command. The probe-scsi command displays all of the SCSI devices attached to the system. The output of probe-scsi looks like this:

ok probe-scsi Target 1 Unit 0 Disk SUN0104 Copyright (C) 1995 Sun Microsystems All rights reserved Target 1 Unit 0 Disk SUN0207 Copyright (C) 1995 Sun Microsystems All rights reserved Here, we can see that two SCSI disks have been detected. If any other disks or SCSI devices were attached to the chain, they have not been detected, indicating a misconfiguration or hardware error.

Tip If you are using a PCI system, then SCSI devices may or may not appear. Troubleshooting Booting Problems

If a system fails to start correctly in multiuser mode, it’s likely that one of the scripts being run in /etc/rc2.d is the cause. In order to prevent the system from going multiuser, it is possible to boot directly into single-user mode from the ok prompt:

ok boot –s ... INIT: SINGLE USER MODE Type Ctrl-d to proceed with normal startup, (or give root password for system maintenance):

At this point, the root password can be entered, and the user will be given a root shell. However, not all file systems will be mounted, although individual scripts can then be checked individually for misbehaving applications.

If the system will not boot into single-user mode, the solution is more complicated because the default boot device cannot be used. For example, if an invalid entry has been made in the /etc/passwd file for the root user, the system will not boot into single- or multiuser mode. To recover the installed system, the host needs to be booted from the installation CD-ROM into single-user mode. At this point, the default root file system can be mounted on a separate mount point, the /etc/passwd file edited, and the system rebooted with the default boot device. This sequence of steps is shown next, assuming that /etc is located on /dev/dsk/c0t0d0s1:

ok boot cdrom ... INIT: SINGLE USER MODE Type Ctrl-d to proceed with normal startup, (or give root password for system maintenance): # mkdir /temp # mount /dev/dsk/c0t0d0s1 /temp # vi /temp/etc/passwd # sync; init 6

STOP Commands

The STOP commands are executed on the SPARC platform by holding down the special STOP key located on the left-hand side of the keyboard, and another key that specifies the operation to be performed. The following functions are available:

STOP Enters the POST environment. STOP-A Enters the PROM monitor environment. STOP-D Performs diagnostic tests. STOP-F Enters a program in the Forth language. STOP-N Initializes the nonvolatile RAM settings to their factory defaults.

[/tech/unix/solaris] | [permalink] | [2005.10.24-23:47.00]

Mar 02, 2005

Switcher Diary (Sort of)

Tim Bray of Ongoing is keeping a Diary of notes relating to his move to Solaris after many years of using a variety of Unix and Linux flavours. He does work for Sun afterall :-)

Some interesting tidbits in there - its really interesting to see even the Sun guys plugging the Blastwave pkg-get system for getting open source apps onto their machines. Pkg-get works just like the Debian apt-get which makes it a very useful addition to a System Admins arsenal.

[/tech/unix/solaris] | [permalink] | [2005.03.02-01:36.00]

Mar 10, 2004

Basic OpenFirmware

Check attached devices (in this case drives)

ok> probe-scsi

Use probe-ide on a non-scsi machine

To boot from the default device use

ok> boot

To boot from cdrom

ok> boot cdrom

To reset the system

ok> reset

To check current settings

ok> printenv

The two commands to switch to keyboard/screen are:

ok> setenv input-device keyboard

ok> setenv output-device screen

And the two commands for setting the serial console as the input/out are:

ok> setenv input-device ttya

ok> setenv output-device ttya

From the Sun OpenBoot Reference Manual

[/tech/unix/solaris] | [permalink] | [2004.03.10-10:32.00]

Mar 08, 2004

Prevent Halt When Keyboard is removed

This behaviour can be stopped by editing /etc/default/kbd and changing the value of KEYBOARD_ABORT to disable.

[/tech/unix/solaris] | [permalink] | [2004.03.08-12:54.00]