The prtconf Command

The prtconf Command

If you’re ever confused about the devices that have been detected on a system and are currently active, you can use the prtconf command to display their configuration details:

# prtconf
System Configuration:  Sun Microsystems  sun4u
Memory size: 128 Megabytes

Initially, the system architecture is displayed (sun4u in the case of an Ultra 5 workstation), along with the amount of physical RAM. What follows is a hierarchical list of all system peripherals and attached drivers (where appropriate), arranged in logical order—for example, all PCI devices listed under the pci node being associated with either pci instance #0 or pci instance #1:

System Peripherals (Software Nodes):
SUNW,Ultra-5_10
    packages (driver not attached)
        terminal-emulator (driver not attached)
        deblocker (driver not attached)
        obp-tftp (driver not attached)
        disk-label (driver not attached)
        SUNW,builtin-drivers (driver not attached)
        sun-keyboard (driver not attached)
        ufs-file-system (driver not attached)
    chosen (driver not attached)
    openprom (driver not attached)
        client-services (driver not attached)
    options, instance #0
    aliases (driver not attached)
    memory (driver not attached)
    virtual-memory (driver not attached)
    pci, instance #0
        pci, instance #0
            ebus, instance #0
                auxio (driver not attached)
                power, instance #0
                SUNW,pll (driver not attached)
                se, instance #0
                su, instance #0
                su, instance #1
                ecpp (driver not attached)
                fdthree, instance #0
                eeprom (driver not attached)
                flashprom (driver not attached)
                SUNW,CS4231 (driver not attached)
            network, instance #0
            SUNW,m64B (driver not attached)
            ide, instance #0
                disk (driver not attached)
                cdrom (driver not attached)
                dad, instance #0
                sd, instance #30
        pci, instance #1
            scsi, instance #0
                disk (driver not attached)
                tape (driver not attached)
                sd, instance #0 (driver not attached)
                sd, instance #1 (driver not attached)
                sd, instance #2 (driver not attached)
                sd, instance #3
                sd, instance #4 (driver not attached)
                sd, instance #5 (driver not attached)
                sd, instance #6 (driver not attached)
                sd, instance #7 (driver not attached)
                sd, instance #8 (driver not attached)
                sd, instance #9 (driver not attached)
                sd, instance #10 (driver not attached)
                sd, instance #11 (driver not attached)
                sd, instance #12 (driver not attached)
                sd, instance #13 (driver not attached)
                sd, instance #14 (driver not attached)
            scsi, instance #1
                disk (driver not attached)
                tape (driver not attached)
                sd, instance #15 (driver not attached)
                sd, instance #16 (driver not attached)
                sd, instance #17 (driver not attached)
                sd, instance #18 (driver not attached)
                sd, instance #19 (driver not attached)
                sd, instance #20 (driver not attached)
                sd, instance #21 (driver not attached)
                sd, instance #22 (driver not attached)
                sd, instance #23 (driver not attached)
                sd, instance #24 (driver not attached)
                sd, instance #25 (driver not attached)
                sd, instance #26 (driver not attached)
                sd, instance #27 (driver not attached)
                sd, instance #28 (driver not attached)
                sd, instance #29 (driver not attached)
    SUNW,UltraSPARC-IIi (driver not attached)
    SUNW,ffb, instance #0
    pseudo, instance #0

mkfile

The mkfile command creates a file of a specified size that is padded with zeros. File sizes can be specified in gigabytes "g," megabytes "m," bytes "b," or kilobytes "k." For example, to create a 1-gigabyte file in /tmp/newfile, the following command would be used:

# mkfile 1g /tmp/newfile

If disk blocks should not be allocated until a request from an application, then the -n option should be passed on the command line. This conserves disk space while ensuring that the file created does not exceed its maximum flagged size.

mkfs

The mkfs command creates a new file system on the raw disk device specified on the command line. The file system type is determined by the contents of the file /etc/ default/fs. In most Solaris systems, the contents of this file are "LOCAL=ufs," indicating that UFS file systems are the default. If a different file system type is to be created, the -F option can be passed on to the command line, followed by the file system type. For example, to create a file system of type pcfs, which uses a standard FAT type on a floppy disk, the following command would be used:

# mkfs -F pcfs /dev/rdiskette

A number of aliases to the mkfs command are also available, which can be used to create file systems of different types directly. These commands include:

  • mkfs_udfs Creates a Universal Disk File System (UDFS) format file system.

  • mkfs_pcfs Creates a FAT format file system.

  • mkfs_udfs Creates a UFS format file system.

In addition, passing the -m option displays the complete command string that was used to create the file system. This is useful for extracting and storing in a script to re- create the file system on another disk.

newfs

The newfs command uses the mkfs command to create UFS file systems. The main difference is the number of parameters that can be passed to newfs to tune the file system during creation. The following parameters can be used to specify file system parameters:

  • -a n Specifies n blocks to be held in reserve to replace bad blocks.

  • -b n Sets the block size on the file system to be n bytes.

  • -c n Indicates that n cylinders should be allocated to each cylinder group.

  • -C n Specifies n as the maximum number of contiguous disk blocks per file.

  • -d n Sets the rotational delay to n milliseconds.

  • -f n Sets the smallest disk fragment for a single file to n bytes.

  • -i n Specifies that n bytes should be allocated to each inode.

  • -m n Specifies that n percent of the physical file system should be reserved as free.

  • -n n Sets the number of different group cylinder rotations to n.

  • -r n Sets the disk speed to n revolutions per minute.

  • -s n Sets the disk size to n sectors.

  • -t n Specifies that n tracks be allocated to each cylinder.

For most applications, the defaults selected by newfs will provide adequate performance. However, some specialized applications do require smaller or larger disk minimum fragments or block sizes for their file systems, and these can easily be set during file system creation. Since most modern disks are greater than 1G in capacity, most capacities will be specified in gigabytes.

lofiadm

The lofiadm command is used to initialize a file on an existing partition that is labeled as a raw device, by making use of the loopback file device driver. A new file system can then be created on the device by using newfs or mkfs as if it was a separate partition. This can be useful if a new partition needs to be created, but the disk cannot be easily reformatted—particularly if it’s only required temporarily.

To create a file system on a file, the mkfile command should be used to create a file to be a specific size. Next, the association between the file and the loopback file device driver needs to be made. For example, if the file /tmp/datafile was created with mkfile, the following command would create the association:

# lofiadm -a /tmp/datafile /dev/lofi/2

Finally, a new file system can be created by using the newfs command:

# newfs /dev/rlofi/2
newfs: construct a new file system /dev/rlofi/2: (y/n)? y

The file system can then be mounted on a mount point (such as /testdata) as required:

# mount /dev/lofi/2 /testdata

When the file system is no longer required, the umount command can be used to remove the file system from operation, while the lofiadm command can be used to remove the association between the file and the loopback file device driver:

# umount /testdata
# lofiadm -d /tmp/datafile

sync

The sync command is generally executed prior to a shutdown or halt, to flush all disk buffers and write the superblock. This ensures data integrity is preserved when the system is either rebooted or where the run level is modified. It is simply executed without options as shown next:

# sync

tunefs

The tunefs command allows a file system’s performance to be tuned to specific requirements. The key setting that can be modified is optimization for speed of execution or amount of disk space required. Generally, unless a system is critically low on disk space, it is best to optimize for speed. The following options are supported:

  • -a n Specifies n blocks be written before a pause in rotation.

  • -e n Specifies n as the maximum number of contiguous disk blocks per file.

  • -d n Sets the rotational delay to n milliseconds.

  • -m n Specifies that n percent of the physical file system should be reserved as free.

  • -o key Optimizes the file system for a key, which is either “time” or “space.”



Part I: Solaris 9 Operating Environment, Exam I