Wednesday, April 29, 2015

how do i find the ip address of a vm running on a kvm server

 How do I find out the IP address of a VM on a KVM server?  
 Fill the ARP table and using virsh figure it out!   
 for i in {1..249}  
  ping -c 1 -n -q -r -t 1 -s 1 -W 1  10.6.66.$i > /dev/null &  
 for name in `virsh list | grep running | awk '{ print $2 }'`  
  printf "\n$name\n "  
  arp -e | grep "`virsh dumpxml $name | grep "mac address"|sed "s/.*'\(.*\)'.*/\1/g"`" |  
  awk '{ printf $1 ; printf " " ; printf $3 }'  

tasty slices

solaris disk slices are nice.  because i am tired of opening up all kinds of oracle pages that may one day vanish or make me pay...

Solaris 10 10/09: In previous Solaris releases, you could not install and boot the Solaris OS from a disk that was greater than 1 TB in size. In this Solaris release, you can install and boot the Solaris OS from a disk that is up to 2 TB in size. In previous releases, you also had to use an EFI label for a disk that is larger than 1 TB. In this release, you can use the VTOC label on any size disk, but the addressable space by the VTOC is limited to 2 TB.
The Solaris disk drivers and disk utilities have been updated to provide the following support:

  • Installing and booting the Solaris OS on a two-terabyte disk must be connected to a system that runs a 64-bit kernel, with a minimum of 1 GB of memory.
  • You can use the format -e utility to label a disk of any size with a VTOC label, but the addressable space is limited to 2 TB.
  • The default label that is used by the format utility and the installation software for a disk that is less than 2 TB in size is a VTOC label.
  • You can use the fdisk utility on a disk that is greater than 1 TB on x86 systems. Support is added for up to 2-TB partitions in the MBR for non-EFI partition types. This support means that Solaris partitions can go up to 2 TB. Other non-EFI partitions may be subject to a limit depending on partition type.
    When the fdisk utility is run on a disk that is greater than 2 TB in size, a warning message is displayed to indicate that you cannot create a non-EFI partition that is greater than 2 TB.
  • The Solaris Volume Manager software has been modified to create metadevices that support physical disks with VTOC labels up to 2 TB in size.
Keep in mind that you cannot move a disk over 1 TB with a legacy MBR or a legacy VTOC to a previous Solaris release. EFI labeled disks continue to work as in previous Solaris releases.
For more information about the EFI label changes in this release, see EFI Disk Label.

iSNS Support in the Solaris iSCSI Target and Initiator

Solaris 10 8/07: This Solaris release provides support for the Internet Storage Name Service (iSNS) protocol in the Solaris iSCSI target and initiator software. The iSNS protocol allows for the automated discovery, management, and configuration of iSCSI devices on a TCP/IP network.
In this Solaris release, you can use the iscsitadm command to add access to an existing third-party iSNS server or you can user the Solaris iSNS server to automatically discover the iSCSI devices in your network. The iSNS server can be specified by hostname or IP address. After you add the iSNS server information, you will need to enable access to the server.
See the following resources for step-by-step instructions:

Solaris iSCSI Target Support

Solaris 10 8/07: This Solaris release provides support for iSCSI target devices, which can be disk or tape devices. Previous Solaris releases provide support for iSCSI initiators. The advantage of setting up Solaris iSCSI targets is you might have existing Fibre-Channel devices that can be connected to clients without the cost of Fibre-Channel HBAs. In addition, systems with dedicated arrays can now export replicated storage with ZFS or UFS file systems.
You can use the iscsitadm command to set up and manage your iSCSI target devices. For the disk device that you select as your iSCSI target, you'll need to provide an equivalently sized ZFS or UFS file system as the backing store for the iSCSI daemon.
After the target device is set up, use the iscsiadm command to identify your iSCSI targets, which will discover and use the iSCSI target device.
For more information, see Chapter 14, Configuring Oracle Solaris iSCSI Targets and Initiators (Tasks), iscsiadm(1M), and iscsitadm(1M).

Note –
A previous version of this guide incorrectly indicated that the Solaris iSCSI target support was available in the Solaris 10 11/06 release. This feature is available starting in the Solaris 10 8/07 release.

Solaris iSCSI Initiator Support

Solaris 10 1/06: iSCSI is an Internet Protocol (IP)-based storage networking standard for linking data storage subsystems. By carrying SCSI commands over IP networks, the iSCSI protocol enables you to mount disk devices, from across the network, onto your local system. On your local system, you can use the devices like block devices.
For more information, see Chapter 14, Configuring Oracle Solaris iSCSI Targets and Initiators (Tasks).

Solaris iSCSI Initiator Support Enhancements

Solaris 10 6/06: The following enhancements have been added to the Solaris iSCSI initiator support:

  • Dynamic target removal support – Provides the ability to remove (or log out) an iSCSI target without rebooting the system. If you try to remove or disable a discovery method or address, and the target is not in use, the target is removed and related resources are released. If the target is in use, the discovery address or method remains enabled, and in use message is displayed.
    For more information, see How to Remove Discovered iSCSI Targets.
  • Internet Storage Name Service (iSNS) client support – Enables the iSCSI initiator to discover the targets to which it has access using as little configuration as possible. It also provides state change notification functionality to notify the iSCSI initiator when changes in operational state of storage nodes occur. The iscsiadm command has been enhanced to support iSNS discovery.
    For more information, see How to Configure iSCSI Target Discovery.
  • Multiple session target (MS/T) support – Provides the ability to create more iSCSI sessions or paths to a target on demand. The additional iSCSI paths provide higher bandwidth aggregation and availability in specific configurations, such as iSCSI arrays that support login redirection. The iSCSI MS/T feature should be used in combination with MPxIO or other multipathing software. The iscsiadm command has been enhanced to support MS/T.
For more information about configuring Solaris iSCSI initiators, see Chapter 14, Configuring Oracle Solaris iSCSI Targets and Initiators (Tasks) and iscsiadm(1M).

x86: Disk Management in the GRUB Boot Environment

Solaris 10 1/06: The GRUB boot menu has replaced the previous method for booting an x86 system. In the area of disk management, you use the GRUB interface when booting from an alternative device to replace a system disk or when installing the bootblocks.
The GRUB boot environment provides the following features:

  • Solaris failsafe boot – A Solaris failsafe boot option that boots into the miniroot so you can recover from a problem that is preventing the system from booting without having to boot from an alternative device. Use the arrow keys to select the following option from the GRUB boot menu and then press return:

    Solaris failsafe
    You'll need to reboot the system after using the Solaris failsafe boot option.
  • Network boot – Boot from the network by pressing the F12 key during the BIOS configuration phase.
  • Single-user boot – Boot to single-user mode by selecting this option from the Solaris failsafe boot menu:

    kernel /platform/i86pc/multiboot
    Then, use the e (edit) option to add the -s single-user option. For example:

    kernel /platform/i86pc/multiboot -s
    Press return and then press the b key to boot the system. Press control-D to boot the system back to multiuser mode.
In the GRUB environment, you cannot use the fmthard command to install the boot blocks automatically when run on an x86 system. You must install the boot blocks separately.
For detailed feature information and instructions on using the new GRUB based booting on x86 systems, see Booting an x86 Based System by Using GRUB (Task Map) in System Administration Guide: Basic Administration.
For instructions for managing disks in the GRUB boot environment, see the following references:

This feature is not available on SPARC systems.

Support for SCSI Disks That are Larger Than 2 Terabytes

Solaris 10 1/06: The SCSI driver, ssd or sd, supports 2 terabytes and greater. The SCSI driver, ssd or sd, is limited to 2 TB in previous Solaris releases.
The format utility can be used to label, configure, and partition these larger disks. For information about using the EFI disk label on large disks and restrictions with the fdisk utility, see Restrictions of the EFI Disk Label.

Where to Find Disk Management Tasks

Use these references to find step-by-step instructions for managing disks.

Disk Management Task For More Information 
Format a disk and examine a disk label. Chapter 11, Administering Disks (Tasks)
Add a new disk to a SPARC system. Chapter 12, SPARC: Adding a Disk (Tasks)
Add a new disk to an x86 system. Chapter 13, x86: Adding a Disk (Tasks)
Hot-plug a SCSI or PCI disk. Chapter 6, Dynamically Configuring Devices (Tasks)

Overview of Disk Management

Managing disks in the Oracle Solaris OS usually involves setting up the system and running the Solaris installation program to create the appropriate disk slices and file systems and to install the Oracle Solaris OS. Occasionally, you might need to use the format utility to add a new disk drive or replace a defective disk drive.

Disk Terminology

Before you can effectively use the information in this section, you should be familiar with basic disk architecture. In particular, you should be familiar with the following terms:

Disk Term Description 
Track A concentric ring on a disk that passes under a single stationary disk head as the disk rotates. 
Cylinder The set of tracks with the same nominal distance from the axis about which the disk rotates. 
Sector Section of each disk platter. A sector holds 512 bytes.  
Block A data storage area on a disk. A disk block is 512 bytes. 
Disk controller A chip and its associated circuitry that controls the disk drive. 
Disk label The first sector of a disk that contains disk geometry and partition information. 
Device driver A kernel module that controls a hardware or virtual device. 
For additional information, see the product information from your disk's manufacturer.

About Disk Labels

A special area of every disk is set aside for storing information about the disk's controller, geometry, and slices. This information is called the disk's label. Another term that is used to described the disk label is the VTOC (Volume Table of Contents) on a disk with a VTOC label. To label a disk means to write slice information onto the disk. You usually label a disk after you change its slices.
The Solaris release supports the following two disk labels:

  • SMI – The traditional VTOC label for disks that are less than 2 TB in size.
  • EFI – Provides support for disks that are larger than 2 TB on systems that run a 64-bit Solaris kernel. The Extensible Firmware Interface GUID Partition Table (EFI GPT) disk label is also available for disks less than 2 TB that are connected to a system that runs a 32-bit Solaris kernel.
If you fail to label a disk after you create slices, the slices will be unavailable because the OS has no way of “knowing” about the slices.

EFI Disk Label

The EFI label provides support for physical disks and virtual disk volumes that are greater than 2 TB in size. This release also includes updated disk utilities for managing disks greater than 2 TB in size. The UFS file system is compatible with the EFI disk label, and you can create a UFS file system greater than 2 TB. For information on creating a multiterabyte UFS file system, see 64-bit: Support of Multiterabyte UFS File Systems.
The unbundled Sun QFS file system is also available if you need to create file systems greater than 1 TB. For information on the Sun QFS file system, see Sun QFS, Sun SAM-FS, and Sun SAM-QFS File System Administrator’s Guide.
The Solaris Volume Manager software can also be used to manage disks greater than 1 TB in this Solaris release. For information on using Solaris Volume Manager, see Solaris Volume Manager Administration Guide.
The VTOC label is still available for disks less than 2 terabytes in size. If you are only using disks smaller than 2 TB on your systems, managing disks will be the same as in previous Solaris releases. In addition, you can use the format-e command to label a disk 2 TB in size or less with an EFI label. For more information, see Example 11–6.
You can use the format -e command to apply an EFI label to a disk if the system is running the appropriate Solaris release. However, you should review the important information in Restrictions of the EFI Disk Label before attempting to apply an EFI label.
You can also use the format -e command to reapply a VTOC label if the EFI label is no longer needed. For example:

# format
Specify disk (enter its number): 2
selecting c0t5d0
[disk formatted]
format> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]: 0
Warning: This disk has an EFI label. Changing to SMI label will erase all
current partitions.
Continue? yes
Auto configuration via format.dat[no]? 
Auto configuration via generic SCSI-2[no]? 
format> quit

Caution – Caution –
Keep in mind that changing disk labels will destroy any data on the disk.

Comparison of the EFI Label and the VTOC Label

The EFI disk label differs from the VTOC disk label in the following ways:

  • Provides support for disks greater than 2 terabytes in size.
  • Provides usable slices 0-6, where slice 2 is just another slice.
  • Partitions (or slices) cannot overlap with the primary or backup label, nor with any other partitions. The size of the EFI label is usually 34 sectors, so partitions usually start at sector 34. This feature means that no partition can start at sector zero (0).
  • No cylinder, head, or sector information is stored in the EFI label. Sizes are reported in blocks.
  • Information that was stored in the alternate cylinders area, the last two cylinders of the disk, is now stored in slice 8.
  • If you use the format utility to change partition sizes, the unassigned partition tag is assigned to partitions with sizes equal to zero. By default, the format utility assigns the usr partition tag to any partition with a size greater than zero. You can use the partition change menu to reassign partition tags after the partitions are changed. However, you cannot change a partition with a non-zero size to the unassigned partition tag.

Restrictions of the EFI Disk Label

Keep the following restrictions in mind when determining whether using disks greater than 1 terabyte is appropriate for your environment:

  • Layered software products intended for systems with VTOC-labeled disks might be incapable of accessing a disk with an EFI disk label.
  • A disk with an EFI label is not recognized on systems running previous Solaris releases.
  • You cannot boot from a disk with an EFI disk label.
  • On x86-based systems, you can use the fdisk command on a disk with an EFI label that is greater than 2 TB in size.
  • You cannot use the Solaris Management Console's Disk Manager tool to manage disks with EFI labels. Use the format utility to partition disks with EFI labels. Then, you can use the Solaris Management Console's Enhanced Storage Tool to manage volumes and disk sets with EFI-labeled disks.
  • The EFI specification prohibits overlapping slices. The entire disk is represented by cxtydz.
  • The EFI disk label provides information about disk or partition sizes in sectors and blocks, but not in cylinders and heads.
  • The following format options are either not supported or are not applicable on disks with EFI labels:
    • The save option is not supported because disks with EFI labels do not need an entry in the format.dat file.
    • The backup option is not applicable because the disk driver finds the primary label and writes it back to the disk.

Support for EFI-Labeled Disks on x86 Systems

Solaris support for the EFI disk label is available on x86 systems. Use the following command to add an EFI label on an x86 system:

# format -e
> [0] SMI Label
> [1] EFI Label
> Specify Label type[0]: 1
> WARNING: converting this device to EFI labels will erase all current
> fdisk partition information. Continue? yes
Previous label information is not converted to the EFI disk label.
You will have to recreate the label's partition information manually with the format command. You cannot use the fdisk command on a disk with an EFI label that is 2 terabytes in size. If the fdisk command is run on disk that is greater than 2 TB in size to create a Solaris partition, the Solaris partition is limited to 2 TB. For more information about EFI disk labels, see the preceding section.

Installing a System With an EFI-Labeled Disk

The Solaris installation utilities automatically recognize disks with EFI labels. However, you cannot use the Solaris installation program to repartition these disks. You must use the format utility to repartition an EFI-labeled disk before or after installation. The Solaris Upgrade and Live Upgrade utilities also recognize a disk with an EFI label. However, you cannot boot a system from an EFI-labeled disk.
After the Solaris release is installed on a system with an EFI-labeled disk, the partition table appears similar to the following:

Current partition table (original):
Total disk sectors available: 2576924638 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector          Size          Last Sector
  0       root    wm                34         1.20TB           2576924636
  1 unassigned    wm                 0            0                0    
  2 unassigned    wm                 0            0                0    
  3 unassigned    wm                 0            0                0    
  4 unassigned    wm                 0            0                0    
  5 unassigned    wm                 0            0                0    
  6 unassigned    wm                 0            0                0    
  8   reserved    wm        2576924638         8.00MB           2576941021

Managing Disks With EFI Disks Labels

Use the following table to locate information on managing disks with EFI disk labels.

Task For More Information 
If the system is already installed, connect the disk to the system and perform a reconfiguration boot. SPARC: Adding a System Disk or a Secondary Disk (Task Map) or x86: Adding a System Disk or a Secondary Disk (Task Map)
Repartition the disk by using the format utility, if necessary.SPARC: How to Create Disk Slices and Label a Disk or x86: How to Create Disk Slices and Label a Disk
Create disk volumes, and if needed, create soft partitions by using Solaris Volume Manager. Or, set up a ZFS storage pool. Chapter 2, Storage Management Concepts, in Solaris Volume Manager Administration Guide or Creating a ZFS Storage Pool in Oracle Solaris ZFS Administration Guide
Create UFS file systems for the new disk by using the newfs command.SPARC: How to Create a UFS File System or x86: How to Create File Systems
Or, create a ZFS file system. How to Create ZFS File Systems in Oracle Solaris ZFS Administration Guide
Clone a disk with an EFI label Example 28–2

Troubleshooting Problems With EFI Disk Labels

Use the following error messages and solutions to troubleshoot problems with EFI-labeled disks.

Error Message

Dec  3 09:26:48 holoship scsi: WARNING: /sbus@a,0/SUNW,socal@d,10000/
sf@1,0/ssd@w50020f23000002a4,0 (ssd1):
Dec  3 09:26:48 holoship disk has 2576941056 blocks, which is too large 
for a 32-bit kernel
You attempted to boot a system running a 32-bit SPARC or x86 kernel with a disk greater than 1 terabyte.
Boot a system running a 64-bit SPARC or x86 kernel with a disk greater than 1 terabyte.
Error Message

Dec  3 09:12:17 holoship scsi: WARNING: /sbus@a,0/SUNW,socal@d,10000/
sf@1,0/ssd@w50020f23000002a4,0 (ssd1):
Dec  3 09:12:17 holoship corrupt label - wrong magic number
You attempted to add a disk to a system running an older Solaris release.
Add the disk to a system running the Solaris release that supports the EFI disk label.

About Disk Slices

Files stored on a disk are contained in file systems. Each file system on a disk is assigned to a slice, which is a group of sectors set aside for use by that file system. Each disk slice appears to the Oracle Solaris OS (and to the system administrator) as though it were a separate disk drive.
For information about file systems, see Chapter 16, Managing File Systems (Overview).

Note –
Slices are sometimes referred to as partitions. Certain interfaces, such as the format utility, refer to slices as partitions.

When setting up slices, remember these rules:

  • Each disk slice holds only one file system.
  • No file system can span multiple slices.
Slices are set up slightly differently on SPARC and x86 platforms. The following table summarizes the differences.
Table 10–1 Slice Differences on SPARC and x86 Platforms
SPARC Platform x86 Platform 
The entire disk is devoted to Oracle Solaris OS. Disk is divided into fdisk partitions, one fdisk partition per operating system.
VTOC – The disk is divided into 8 slices, numbered 0-7.
EFI – The disk is divided into 7 slices, numbered 0-6.
VTOC – The Solaris fdisk partition is divided into 10 slices, numbered 0–9.
EFI – The disk is divided into 7 slices, numbered 0-6
Solaris Volume Manager, previously the Solstice DiskSuite, has a partitioning feature, soft partitions. Soft partitions enable more than eight partitions per disk.
For general information about Solaris Volume Manager, see Chapter 2, Storage Management Concepts, in Solaris Volume Manager Administration Guide. For information on soft partitions, see Chapter 12, Soft Partitions (Overview), in Solaris Volume Manager Administration Guide.

Disk Slices

The following table describes the slices that might be found on a system that runs the Oracle Solaris OS.
On x86 systems:

  • Disks are divided into fdisk partitions. An fdisk partition is a section of the disk that is reserved for a particular operating system, such as the Oracle Solaris OS.
  • The Oracle Solaris OS places ten slices, numbered 0-9, on a Solaris fdisk partition.
Table 10–2 Customary Disk Slices
Slice File System Usually Found on Client or Server Systems? Comments 
root (/)Both Holds files and directories that make up the OS.
EFI – You cannot boot from a disk with an EFI label.
swap Both Provides virtual memory, or swap space.
— Both VTOC – Refers to the entire disk, by convention. The size of this slice should not be changed.
EFI – Optional slice to be defined based on your site's needs.
/export, for exampleBoth Optional slice that can be defined based on your site's needs.
Can be used on a server to hold alternative versions of operating systems that are required by client systems. 
Both Optional slice to be defined based on your site's needs. 
/opt, for exampleBoth Optional slice to be defined based on your site's needs.
Can be used to hold application software added to a system. If a slice is not allocated for the /opt file system during installation, the /opt directory is put in slice 0.
/usr Both Holds OS commands (also known as executables). This slice also holds documentation, system programs (init and syslogd, for example), and library routines.
/home or
Both Holds files that are created by users. 
N/A N/A VTOC – Contains GRUB boot information.
EFI – A reserved slice created by default. This area is similar to the VTOC's alternate cylinders. Do not modify or delete this slice.
9 (x86 only)— Both EFI – Not applicable.
VTOC – Provides an area that is reserved for alternate disk blocks. Slice 9 is known as the alternate sector slice.

Note –
On a disk with a VTOC label, do not modify slice or use slice 2 to store a file system. Products, such as Solaris Volume Manager, Solaris Live Upgrade, and installgrub, do not work correctly if slice 2 is modified in any way.

Using Raw Data Slices

The disk label is stored in block 0 of each disk. So, third-party database applications that create raw data slices must not start at block 0. Otherwise, the disk label will be overwritten, and the data on the disk will be inaccessible.
Do not use the following areas of the disk for raw data slices, which are sometimes created by third-party database applications:

  • Block 0 where the disk label is stored
  • Slice 2, which represents the entire disk with a VTOC label

Slice Arrangements on Multiple Disks

Although a single large disk can hold all slices and their corresponding file systems, two or more disks are often used to hold a system's slices and file systems.

Note –
A slice cannot be split between two or more disks. However, multiple swap slices on separate disks are allowed.

For instance, a single disk might hold the root (/) file system, a swap area, and the /usr file system, while another disk holds the /export/home file system and other file systems that contain user data.
In a multiple disk arrangement, the disk that contains the OS and swap space (that is, the disk that holds the root (/) and /usr file systems and the slice for swap space) is called the system disk. Other disks are called secondary disks or non-system disks.
When you arrange a system's file systems on multiple disks, you can modify file systems and slices on the secondary disks without having to shut down the system or reload the OS.
When you have more than one disk, you also increase input-output (I/O) volume. By distributing disk load across multiple disks, you can avoid I/O bottlenecks.

Determining Which Slices to Use

When you set up a disk's file systems, you choose not only the size of each slice, but also which slices to use. Your decisions about these matters depend on the configuration of the system to which the disk is attached and the software you want to install on the disk.
System configurations that need disk space are as follows:

  • Servers
  • Stand-alone systems
Each system configuration can use slices in a different way. The following table lists some examples.
Table 10–3 System Configurations and Slices
Slice Servers Stand-alone Systems 
root root 
swap swap 
— — 
/export — 
/usr /usr
/export/home /home
For more information about system configurations, see Overview of System Types in System Administration Guide: Basic Administration.

Note –
The Solaris installation utility provides default slice sizes based on the software you select for installation.

format Utility

Read the following overview of the format utility and its uses before proceeding to the “how-to” or reference sections.
The format utility is a system administration tool that is used to prepare hard disk drives for use on your Solaris system.
The following table shows the features and associated benefits that the format utility provides.
Table 10–4 Features and Benefits of the format Utility
Feature Benefit 
Searches your system for all attached disk drives Reports on the following:
  • Target location
  • Disk geometry
  • Whether the disk is formatted
  • If the disk has mounted partitions
Retrieves disk labels Convenient for repair operations 
Repairs defective sectors Allows administrators to repair disk drives with recoverable errors instead of sending the drive back to the manufacturer 
Formats and analyzes a disk Creates sectors on the disk and verifies each sector 
Partitions a disk Divides a disk into slices so that individual file systems can be created on separate slices 
Labels a disk Writes disk name and configuration information to the disk for future retrieval (usually for repair operations) 
The format utility options are described in Chapter 15, The format Utility (Reference).

When to Use the format Utility

Disk drives are partitioned and labeled by the Solaris installation utility when you install the Solaris release. You can use the format utility to do the following:

  • Display slice information
  • Partition a disk
  • Add a disk drive to an existing system
  • Format a disk drive
  • Label a disk
  • Repair a disk drive
  • Analyze a disk for errors
The main reason a system administrator uses the format utility is to partition a disk. These steps are covered in Chapter 12, SPARC: Adding a Disk (Tasks) and Chapter 13, x86: Adding a Disk (Tasks).
See the following section for guidelines on using the format utility.

Guidelines for Using the format Utility

Table 10–5 format Utility Guidelines
Task Guidelines For More Information 
Format a disk. 
  • Any existing data is destroyed when you reformat a disk.
  • The need for formatting a disk drive has decreased as more and more manufacturers ship their disk drives formatted and partitioned. You might not need to use the format utility when you add a disk drive to an existing system.
  • If a disk has been relocated and is displaying many disk errors, you can attempt to reformat it. Reformatting automatically remaps any bad sectors.
How to Format a Disk
Replace a system disk. 
  • Data from the damaged system disk must be restored from a backup medium. Otherwise, the system will have to be reinstalled by using the installation utility.
SPARC: How to Connect a System Disk and Boot, x86: How to Connect a System Disk, or, if the system must be reinstalled, Oracle Solaris 10 9/10 Installation Guide: Basic Installations
Divide a disk into slices. 
  • Any existing data is destroyed when you repartition and relabel a disk with existing slices.
  • Existing data must be copied to backup media before the disk is repartitioned and restored.
SPARC: How to Create Disk Slices and Label a Disk or x86: How to Create Disk Slices and Label a Disk
Add a secondary disk to an existing system. 
  • Any existing data must be restored from backup media if the secondary disk is reformatted or repartitioned.
SPARC: How to Connect a Secondary Disk and Boot or x86: How to Connect a Secondary Disk and Boot
Repair a disk drive. 
  • Some customer sites prefer to replace rather than repair defective drives. If your site has a repair contract with the disk drive manufacturer, you might not need to use the format utility to repair disk drives.
  • The repair of a disk drive usually means that a bad sector is added to a defect list. New controllers remap bad sectors with no system interruption.
  • If the system has an older controller, you might need to remap a bad sector and restore any lost data.
Repairing a Defective Sector

Formatting a Disk

In most cases, disks are formatted by the manufacturer or reseller. So, they do not need to be reformatted when you install the drive. To determine if a disk is formatted, use the format utility. For more information, see How to Determine if a Disk Is Formatted.
If you determine that a disk is not formatted, use the format utility to format the disk.
When you format a disk, you accomplish two steps:

  • The disk media is prepared for use.
  • A list of disk defects based on a surface analysis is compiled.

A small percentage of total disk space that is available for data is used to store defect and formatting information. This percentage varies according to disk geometry, and decreases as the disk ages and develops more defects.
Formatting a disk might take anywhere from a few minutes to several hours, depending on the type and size of the disk.

Partitioning a Disk

The format utility is most often used by system administrators to partitioning a Disk. The steps are as follows:

  • Determining which slices are needed
  • Determining the size of each slice or partition
  • Using the format utility to partition the disk
  • Labeling the disk with new partition information
  • Creating the file system for each partition
The easiest way to partition a disk is to use the modify command from the partition menu of the format utility. The modify command allows you to create partitions by specifying the size of each partition without having to keep track of the starting cylinder boundaries. The modify command also keeps tracks of any disk space that remains in the “free hog” slice.

Partition Table Terminology

An important part of the disk label is the partition table. The partition table identifies a disk's slices, the slice boundaries (in cylinders), and the total size of the slices. You can display a disk's partition table by using the format utility. The following describes partition table terminology.
Table 10–6 Partition Table Terminology
Partition Term Value Description 
Number 0–7 VTOC – Partitions or slices, numbered 0–7.
EFI – Partitions or slices, numbered 0–6.
Tag 0=UNASSIGNED 1=BOOT 2=ROOT 3=SWAP 4=USR 5=BACKUP 7=VAR 8=HOME 11=RESERVED A numeric value that usually describes the file system mounted on this partition. 
Flags wm The partition is writable and mountable. 
wu rm The partition is writable and unmountable. This state is the default for partitions that are dedicated for swap areas. (However, the mount command does not check the “not mountable” flag.)
rm The partition is read only and mountable. 
Partition flags and tags are assigned by convention and require no maintenance.
For more information on displaying the partition table, see the following references:

Displaying Partition Table Information

The following format utility output shows an example of a partition table from a 74-GB disk with a VTOC label displayed:

Total disk cylinders available: 38756 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       3 -  2083        4.00GB    (2081/0/0)    8390592
  1       swap    wu    2084 -  3124        2.00GB    (1041/0/0)    4197312
  2     backup    wm       0 - 38755       74.51GB    (38756/0/0) 156264192
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7       home    wm    3125 - 38755       68.50GB    (35631/0/0) 143664192
  8       boot    wu       0 -     0        1.97MB    (1/0/0)          4032
  9 alternates    wu       1 -     2        3.94MB    (2/0/0)          8064

The partition table displayed by the format utility contains the following information.

Column Name Description 
Part Partition or slice number. See Table 10–6 for a description of this column.
Tag Partition tag. See Table 10–6 for a description of this column.
Flag Partition flag. See Table 10–6 for a description of this column.
Cylinders The starting and ending cylinder number for the slice. Not displayed on EFI-labeled disks. 
Size The slice size in MB. 
Blocks The total number of cylinders and the total number of sectors per slice. Not displayed on EFI-labeled disks. 
First Sector EFI – The starting block number. Not displayed on VTOC-labeled disks.
Last Sector EFI – The ending block number. Not displayed on VTOC-labeled disks.
The following is an example of an EFI disk label displayed by using the prtvtoc command.

# prtvtoc /dev/rdsk/c4t1d0s0
* /dev/rdsk/c4t1d0s0 partition map
* Dimensions:
*     512 bytes/sector
* 2576941056 sectors
* 2576940989 accessible sectors
* Flags:
*   1: unmountable
*  10: read-only
*                           First     Sector    Last
* Partition  Tag  Flags     Sector     Count    Sector   Mount Directory
       0      2    00          34   629145600  629145633
       1      4    00   629145634   629145600 1258291233
       6      4    00  1258291234  1318633404 2576924637
       8     11    00  2576924638       16384 2576941021
The output of the prtvtoc command provides information in the following three sections:

  • Dimensions
  • Flags
  • Partition Table

prtvtoc Column NameDescription  
Partition Partition or slice number. For a description of this column, see Table 10–6.
Tag Partition tag. For a description of this column, see Table 10–6.
Flags Partition flag. For a description of this column, see Table 10–6.
First Sector The first sector of the slice. 
Sector Count The total number of sectors in the slice. 
Last Sector The last sector of the slice. 
Mount Directory The last mount point directory for the file system. 

Using the Free Hog Slice

When you use the format utility to change the size of one or more disk slices, you designate a temporary slice that will expand and shrink to accommodate the resizing operations.
This temporary slice donates, or “frees,” space when you expand a slice, and receives, or “hogs,” the discarded space when you shrink a slice. For this reason, the donor slice is sometimes called the free hog.
The free hog slice exists only during installation or when you run the format utility. There is no permanent free hog slice during day-to-day operations.

Monday, April 13, 2015

adventures in h5ai with php

 i am running an ubuntu 8.04 server and i want it to have pretty directory entries and restrict access. i do.  
 h5ai is the new hotness when it comes to this.  
 first off, you need php5.3. i am running an ubuntu 8.04 lts server. don't ask why, but it has to do something with userlan nfs.  
 php 5.3 and hardy are not friends. they will never be friends and don't do dotdeb because aptitude and apt-get will break things. don't do it?  
 so, you'll get all some crap errors. but don't give up just because you're lame and you're running php5.2!  
 Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /your/dir/_h5ai/server/php/inc/util.php on line 147  
 hash out line 147  
 register_shutdown_function(function () { time_log('ex'); });  
 Warning: file_put_contents(/your/dir/_h5ai/cache/cmds.json) [function.file-put-contents]: failed to open stream: Permission denied in /your/dir/_h5ai/server/php/inc/util.php on line 80  
 hash out line 80  
 return file_put_contents($path, $json) !== false;  
 do that and all will be well. really.  
 in your site file, plop this in for your multi-domain security groups:  
     Options Indexes FollowSymLinks MultiViews  
         IndexOptions +FancyIndexing +HTMLTable +NameWidth=*  
         AllowOverride None  
         Order deny,allow  
         deny from all  
     AuthBasicProvider ldap  
     AuthzLDAPAuthoritative on  
      # binding information  
     AuthLDAPBindDN "CN=bindaccount,OU=here,DC=not,DC=there,DC=com"  
     AuthLDAPBindPassword "notcreatedhere"  
     AuthType Basic  
     AuthName "the party is over"  
     AuthLDAPUrl "ldap://,DC=com?sAMAccountName?sub?(objectCategory=*)"  
     AuthLDAPGroupAttribute memberOf  
     AuthLDAPGroupAttributeIsDN off  
     # authorized groups  
     Require ldap-attribute memberOf="cn=a-special-group,OU=here,DC=not,DC=there,DC=com"  
     Require ldap-attribute memberOf="cn=another-special-group,OU=nothere,DC=not,DC=there,DC=com"  
     Satisfy any