The preceding chapters described generic hardware management tools that
you use to manage many aspects of all devices, such as the
hwmgr
command described in
Chapter 3.
The following
sections describe hardware management tools that are targeted at a particular
kind of device and perform a specific task:
Finding device utilities (Section 5.1)
Using SCSI utilities (Section 5.2)
Partitioning (formatting) disks by using the
diskconfig
GUI (Section 5.3)
Partitioning (formatting) disks by using the
disklabel
command (Section 5.4)
Copying disks (Section 5.5)
Monitoring disks (Section 5.6)
Many of the device utilities are documented elsewhere
in this manual or at other locations in the documentation set.
For example,
utilities that enable you to configure network devices are documented in detail
in the
Network Administration: Services
manual.
Table 5-1
provides references
to utilities, including those listed in this chapter.
Other utilities are
documented in reference pages.
Table 5-2
provides references
to utilities documented in the reference pages and also provides pointers
to reference data such as the Section 7 interface reference pages.
Table 5-1: Device Utilities Documented in the Manuals
| Device | Task | Location |
| Processor | Starting or Stopping | System Administration |
| Sharing Resources | System Configuration and Tuning | |
| Monitoring | System Administration | |
| Power Management | System Administration,
dxpower |
|
| Testing Memory | System Administration | |
| Error and Event Handling | System Administration | |
| SCSI buses | Advanced Configuration and Management | Section 5.2.1,
scu |
| Disks | Partitioning | diskconfig,
disklabel |
| Copying | Section 5.5,
dd |
|
| Monitoring Usage | Section 5.6,
df
and
du |
|
| Power Management | System Administration | |
| File Systems Status | System Administration | |
| Testing and Exercising | System Administration | |
| Tapes (and disks) | Archiving | System Administration |
| Testing and Exercising | System Administration | |
| Clock | Setting | System Administration |
| Modem | Configuring | System Administration |
Table 5-2: Device Utilities Documented in the Reference Pages
| Device | Task | Location |
| Devices (General) | Configuring |
hwmgr(8)devswmgr(8)dsfmgr(8) |
| Device Special Files |
kmknod(8)mknod(8)MAKEDEV(8)dsfmgr(8) |
|
| Interfaces |
atapi_ide(7)devio(7)emx(7) |
|
| Processor | Starting and Stopping |
halt(8)psradm(8)reboot(2) |
| Allocating CPU Resources |
class_scheduling(4)processor_sets(4)runon(1) |
|
| Monitoring |
dxsysinfo(8)psrinfo(1) |
|
| SCSI buses | Managing |
sys_attrs_cam(5)ddr.dbase(4)ddr_config(8) |
| Disks | Partitioning |
diskconfig(8)disklabel(4)disklabel(8)disktab(4) |
| Monitoring |
dxsysinfo(8)diskusg(8)acctdisk(8)df(1)du(1)quota(1) |
|
| Testing and Maintenance |
diskx(8)zeero(8) |
|
| Interfaces |
ra(7)radisk(8)ri(7)rz(7) |
|
| Swap Space |
swapon(8) |
|
| Tapes (and Disks) | Archiving |
bttape(8)dxarchiver(8)rmt(8) |
| Testing and Maintenance |
tapex(8) |
|
| Interfaces |
tz(7)mtio(7)tms(7) |
|
| Floppy | Tools |
dxmtools(1)mtools(1) |
| Testing and Maintenance |
fddisk(8) |
|
| Interfaces |
fd(7) |
|
| Terminals, ports | Interfaces |
ports(7) |
| Modem | Configuring |
chat(8) |
| Interfaces |
modem(7) |
|
| Keyboard, mouse | Interfaces |
dc(7)scc(7) |
See the
System Administration
manual for a list of the utilities provided
by the SysMan graphical user interface.
5.2 SCSI and Device Driver Utilities
The following sections describe utilities that you use to manage SCSI
devices and device drivers.
5.2.1 Using the SCSI Configuration Utility, scu
The SCSI/CAM Utility Program,
scu, provides commands
for advanced maintenance and diagnostics of SCSI peripheral devices and the
CAM I/O subsystem.
For most daily operations, you use the
hwmgr
command.
The
scu
program has an extensive help feature
that describes its options and conventions.
See
scu(8)
You can use
scu
to:
Format disks
Reassign a defective disk block
Reserve and release a device
Display and set device and program parameters
Enable and disable a device
Note
For Digital Storage Architecture (DSA) disks, use the
radiskprogram. Seefor information. radisk(8)
Examples of
scu
usage are:
# scu
scu> set nexus bus 0 target 0 LUN 0
Device: RZ1CB-CA, Bus: 0, Target: 0, LUN: 0, Type: Direct Access
scu> show capacity
Disk Capacity Information:
Maximum Capacity: 8380080 (4091.836 megabytes)
Block Length: 512
scu> show scsi status 0
SCSI Status = 0 = SCSI_STAT_GOOD = Command successfully completed
5.2.2 Using the Device Switch Manager, devswmgr
The
devswmgr
command enables you to manage the device switch table by
displaying information about the device drivers in the table.
You can also
use the command to release device switch table entries.
Typically, you release
the entries for a driver after you have unloaded the driver and do not plan
to reload it later.
Releasing the entries frees them for use by other device
drivers.
Examples of
devswmgr
usage for device data are:
# devswmgr -display device switch database read from primary file device switch table has 200 entries # devswmgr -getnum
Device switch reservation list
(*=entry in use)
driver name instance major
----------------------- -------- -----
pfm 1 71*
fdi 2 58*
xcr 2 57
kevm 1 56*
cam_disk 2 55*
emx 1 54
TMSCP 2 53
MSCP 2 52
xcr 1 44
LSM 4 43
LSM 3 42
LSM 2 41*
LSM 1 40*
ace 1 35*
parallel_port 1 34*
cam_uagt 1 30
MSCP 1 28
TMSCP 1 27
scc 1 24
presto 1 22
cluster 2 21*
cluster 1 19*
fdi 1 14*
cam_tape 1 9
cam_disk 1 8*
pty 2 7
pty 1 6
tty 1 1
console 1 0
5.3 Partitioning Disks Using diskconfig
The Disk Configuration graphical user interface (diskconfig) enables you to perform the following tasks:
Display attribute information for existing disks
Modify disk configuration attributes
Administer disk partitions
See
diskconfig(8)diskconfig).
An online help volume describes
how you use the graphical interface.
See
disklabel(8)
The Disk Configuration GUI provides a graphical interface to several disk maintenance tasks that you can perform manually, by using the following commands:
disklabel
-
Use this command to install, examine, or modify the label on a disk drive
or pack.
The disk label contains information about the disk, such as type,
physical parameters, and partitioning.
See also the
/etc/disktab
file, described in
disklabel(4)
newfs
- This command creates a new UFS file system on the specified
device.
You cannot use the
newfs
command to create Advanced
File System (AdvFS) domains.
Instead, use the
mkfdmn
command,
as described in
mkfdmn(8)
mkfdmn
and
mkfset
- Use these commands
to create Advanced File System (AdvFS) domains and filesets.
Invoke the Disk Configuration interface in either of the following ways:
At the system prompt, enter
diskconfig.
From the CDE Front Panel, SysMan Applications pop-up menu, choose Configuration. Then select the Disk icon from the SysMan Configuration folder.
Caution
Disk Configuration displays appropriate warnings when you attempt to change partition sizes. Plan the changes in advance to ensure that you do not overwrite any required data. Back up any data partitions before attempting this task.
The system displays a window titled Disk Configuration on hostname. This main window for the DiskConfig utility lists the following information for each disk:
The disk basename, such as
dsk10.
See
Section 1.5
for information on disk names.
The device model, such as
RZ1CB-CA.
The physical location of the device, specifying Bus, Target and LUN (logical unit number). See Chapter 3 for information on the device location.
When you select a device by doubleclicking on the list item (or click on the configure button when a disk is highlighted), the two windows are displayed at the same time. The windows are displayed overlapped. Move the cursor to the appropriate window to configure partitions or edit the disk's partition table as follows:
This window provides the following information and options:
A graphical representation of the disk partitions, in a horizontal bar-chart format. The currently-highlighted partition is a different color, and the details of that partition are displayed in the Selected Partition box. You can use the bar chart handles (or flags) to change the partition sizes. Position the cursor as follows:
On the center handle to change both adjacent partitions
On the top flag to move up the start of the right hand partition
On the bottom flag to move down the end of the left-hand partition
Press MB1 and drag the mouse to move the handles.
A pull-down menu that enables you to choose how the utility displays disk size information. You can choose megabytes, bytes, or blocks.
A statistics box, which displays disk information such as the device name, the total size of the disk, and usage information. This box enables you to assign or edit the disk label, and create an alias name for the device.
The Selected Partition box, which displays dynamic sizes for the selected partition. These sizes are updated as you change the partitions by using the bar chart. You can also type the partition sizes directly into these windows to override the current settings. This box also enables you to select the file system for the partition and, if using AdvFS, the domain name and fileset name.
The Disk Attributes... option.
This button displays some of the physical attributes of the device.
The Partition Table... option, which displays the window titled Disk Configuration: Partition Table.
This window displays a bar chart of the current partitions in use, their sizes, and the file system in use. You can choose from the following:
The partitions that are currently displayed
The default table for the disk device
Reset the partitions to their original settings when this session started (the on-disk partition table).
If you make errors on a manual partition change, you can use this window to reset the partition table.
Refer to the online help for more information on these windows.
After making partition adjustments, use the SysMan Menu options to mount any newly created file systems as follows:
Invoke the SysMan Menu.
Expand the Storage options, and select Basic File System Utilities - Mount File Systems.
In the Mount Operation window, select the option to mount a specific file system and click on the Next button.
In the Name and Mount Point window:
Type a mount point, such as
/usr/newusers
Type the partition name, such as
/dev/disk/dsk0g
or a domain name, such as
newusr_domain#usr.
Click on the OK button to implement the partition adjustment.
Your new file system is now accessible.
5.4 Manually Partitioning Disks
This section provides the information you need to change the partition scheme of your disks. In general, you allocate disk space during the initial installation or when adding disks to your configuration. Usually, you do not have to alter partitions; however, there are cases when it is necessary to change the partitions on your disks to accommodate changes and to improve system performance.
The disk label provides detailed information about the geometry of the
disk and the partitions into which the disk is divided.
You can change the
label with the
disklabel
command.
You must be the root
user to use the
disklabel
command.
There are two copies of a disk label, one located on the disk and one
located in system memory.
Because it is faster to access system memory than
to perform I/O, when the system boots, it copies the disk label into memory.
Use the
disklabel
-r
command
to directly access the label on the disk instead of going through the in-memory
label.
Caution
Before you change disk partitions, back up all the file systems if there is any data on the disk. Changing a partition overwrites the data on the old file system, destroying the data.
When changing partitions, remember that:
You cannot change the offset, which is the beginning sector, or shrink any partition on a mounted file system or on a file system that has an open file descriptor.
If you need a single partition on the entire disk, use partition
c.
Unless it is mounted, you must specify the raw device for
partition
a, which begins at the start of the disk (sector
0), when you change the label.
If partition
a
is mounted,
you must then use partition
c
to change the label.
Partition
c
must also begin at sector 0.
Caution
If partition
ais mounted and you attempt to edit the disk label using device partitiona, you cannot change the label. Furthermore, you do not receive any error messages indicating that the label is not written.
Before changing the size of a disk partition, review
the current partition setup by viewing the disk label.
The
disklabel
command allows you to view the partition sizes.
The bottom, top,
and size of the partitions are in 512-byte sectors.
To review the current disk partition setup, use the following
disklabel
command:
/sbin/disklabel -r device
Specify the device with its directory name
(/dev)
followed by the raw device name, drive number, and partition
a
or
c.
You can also specify the disk unit and number, such
as
dsk1.
An example of using the
disklabel
command to view
a disk label follows:
# disklabel -r /dev/rdisk/dsk3a type: SCSI disk: rz26 label: flags: bytes/sector: 512 sectors/track: 57 tracks/cylinder: 14 sectors/cylinder: 798 cylinders: 2570 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0
8 partitions: # size offset fstype [fsize bsize cpg] a: 131072 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 164*) b: 262144 131072 unused 1024 8192 # (Cyl. 164*- 492*) c: 2050860 0 unused 1024 8192 # (Cyl. 0 - 2569) d: 552548 393216 unused 1024 8192 # (Cyl. 492*- 1185*) e: 552548 945764 unused 1024 8192 # (Cyl. 1185*- 1877*) f: 552548 1498312 unused 1024 8192 # (Cyl. 1877*- 2569*) g: 819200 393216 unused 1024 8192 # (Cyl. 492*- 1519*) h: 838444 1212416 4.2BSD 1024 8192 16 # (Cyl. 1519*- 2569*)
Take care when you change partitions
because you can overwrite data on the file systems or make the system inefficient.
If the partition label becomes corrupted while you are changing the partition
sizes, you can return to the default partition label by using the
disklabel
command with the
-w
option, as
follows:
# disklabel -r -w /dev/rdisk/dsk1a rz26
The
disklabel
command allows you to change the partition label of an individual
disk without rebuilding the kernel and rebooting the system.
Use the following
procedure:
Display disk space information about the file systems by using
the
df
command.
View the
/etc/fstab
file to determine if
any file systems are designated as swap space.
Examine the disk's label by using the
disklabel
command with the
-r
option.
(See
rz(7)ra(7)disktab(4)
Back up the file systems.
Unmount the file systems on the disk whose label you want to change.
Calculate the new partition parameters. You can increase or decrease the size of a partition. You can also cause partitions to overlap.
Edit the disk label by using the
disklabel
command with the
-e
option to
change the partition parameters, as follows:
# /sbin/disklabel -e disk
An editor, either the
vi
editor or that specified
by the EDITOR environment variable, is invoked so you can edit the disk label,
which is in the format displayed with the
disklabel
-r
command.
The
-r
option writes the label directly to
the disk and updates the system's in-memory copy, if possible.
The
disk
parameter specifies the unmounted disk (for example,
dsk0
or
/dev/rdisk/dsk0a).
After you quit the editor and save the changes, the following prompt is displayed:
write new label? [?]:
Enter
y
to write the new label or
n
to discard the
changes.
Use the
disklabel
command with the
-r
option to view the new disk label.
5.4.1 Finding Overlapping Partitions
Commands to mount or create file systems, add a new
swap device, and add disks to the Logical Storage Manager first check whether
the disk partition specified in the command already contains valid data, and
whether it overlaps with a partition that is already marked for use.
The
fstype
field of the disk label enables you to determine when a partition
or an overlapping partition is in use.
If the partition is not in use, the command continues to execute.
In
addition to mounting or creating file systems, commands such as
mount,
newfs,
fsck,
voldisk,
mkfdmn,
rmfdmn, and
swapon
also modify the disk label, so that the
fstype
field specifies partition usage.
For example, when you add a disk partition
to an AdvFS domain, the
fstype
field is set to
AdvFS.
If the partition is not available, these commands return an error message and prompt you to continue or abort the operation, as shown in the following example:
# newfs /dev/disk/dsk8c WARNING: disklabel reports that basename,partition currently is being used as "4.2BSD" data. Do you want to continue with the operation and possibly destroy existing data? (y/n) [n]
Applications, as well as operating system commands, can modify the
fstype
of the disk label, to indicate that a partition is in use.
See
check_usage(3)set_usage(3)5.5 Copying Disks
You can use the
dd
command to copy a complete disk
or a disk partition; that is, you can produce a physical copy of the data
on the disk or disk partition.
Note
Because the
ddcommand is not meant for copying multiple files, copy a disk or a partition only to a disk that you are using as a data disk, or to a disk that does not contain a file system. Use thedumpandrestorecommands, as described in the System Administration manual, to copy disks or partitions that contain a UFS file system. Use thevdumpandvrestorecommands, as described in the AdvFS Administration manual, to copy disks or partitions that contain an AdvFS fileset.
UNIX protects the first block of a disk with a valid disk label because this is where the disk label is stored. As a result, if you copy a partition to a partition on a target disk that contains a valid disk label, you must decide whether you want to keep the existing disk label on that target disk.
If you want to maintain the disk label on the target disk, use the
dd
command with the
skip
and
seek
options to move past the protected disk label area on the target disk.
The
target disk must be the same size as or larger than the original disk.
To determine whether the target disk has a label,
use the following
disklabel
command:
# /sbin/disklabel -r target_disk
You must specify the target device directory name
(/dev)
followed by the raw device name, drive number, and partition
c.
If the disk does not contain a label, the following message is displayed:
Bad pack magic number (label is damaged, or pack is unlabeled)
The following example shows a disk that already contains a label:
# disklabel -r /dev/rdisk/dsk1c type: SCSI disk: rz26 label: flags: bytes/sector: 512 sectors/track: 57 tracks/cylinder: 14 sectors/cylinder: 798 cylinders: 2570 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0
8 partitions: # size offset fstype [fsize bsize cpg] a: 131072 0 unused 1024 8192 # (Cyl. 0 - 164*) b: 262144 131072 unused 1024 8192 # (Cyl. 164*- 492*) c: 2050860 0 unused 1024 8192 # (Cyl. 0 - 2569) d: 552548 393216 unused 1024 8192 # (Cyl. 492*- 1185*) e: 552548 945764 unused 1024 8192 # (Cyl. 1185*- 1877*) f: 552548 1498312 unused 1024 8192 # (Cyl. 1877*- 2569*) g: 819200 393216 unused 1024 8192 # (Cyl. 492*- 1519*) h: 838444 1212416 unused 1024 8192 # (Cyl. 1519*- 2569*)
If the target disk already contains a label and you do not want to keep
the label, you must clear the label by using the
disklabel
-z
command.
For example:
# disklabel -z /dev/rdisk/dsk1c
To copy the original disk to the target disk and keep the target disk
label, use the
dd
command, specifying the device directory
name
(/dev)
followed by the raw device name, drive number,
and the original and target disk partitions.
For example:
# dd if=/dev/rdisk/dsk0c of=/dev/rdisk/dsk1c \ skip=16 seek=16 bs=512k
To ensure an adequate amount of free disk space, regularly monitor the disk use of your configured file systems. You can do this in any of the following ways:
Check available free space by using the
df
command (Section 5.6.1)
Check disk use by using the
du
command
or the
quot
command (Section 5.6.2)
Verify disk quotas (if imposed) by using the
quota
command (Section 5.6.3)
You can use the
quota
command only if you are the
root user.
5.6.1 Checking Available Free Space
To ensure sufficient space for your configured
file systems, use the
df
command regularly to determine
the amount of free disk space in all of the mounted file systems.
The
df
command displays statistics about the amount of free disk space
on a specified file system or on a file system that contains a specified file.
With no arguments or options, the
df
command displays
the following:
The amount of free disk space on all of the mounted file systems.
Each file system's configured size, in 512-byte blocks.
If
you specify the
-k
option, size information is provided
in kilobyte blocks.
The total amount of space, the amount in use, the amount available (free), the percentage in use, and the directory on which the file system is mounted.
For AdvFS file domains, the
df
command
displays disk space usage information for each fileset.
If you specify a device that has no file systems mounted on it,
df
displays the information for the root file system.
You can also
specify a file path name to display the amount of available disk space on
the file system that contains the file.
See
df(1)
Note
You cannot use the
dfcommand with the block or character special device name to find free space on an unmounted file system. Instead, use thedumpfscommand.
The following example displays disk space information about all the mounted file systems:
# /sbin/df Filesystem 512-blks used avail capacity Mounted on /dev/disk/dsk2a 30686 21438 6178 77% / /dev/disk/dsk0g 549328 378778 115616 76% /usr /dev/disk/dsk2g 101372 5376 85858 5% /var /dev/disk/dsk3c 394796 12 355304 0% /usr/users /usr/share/mn@tsts 557614 449234 52620 89% /usr/share/mn domain#usr 838432 680320 158112 81% /usr
Note
The
newfscommand reserves a percentage of the file system disk space for allocation and block layout. This can cause thedfcommand to report that a file system is using more than 100 percent of its capacity. You can change this percentage by using thetunefscommand with the-minfreeflag.
If
you determine that a file system has insufficient space available, you might
want to find out who is using the space.
You can do this with the
du
command or the
quot
command.
The
du
command returns disk space allocation by directory.
With this information you can decide who is using the most space and who
should free up disk space.
The
du
command displays the number of blocks contained
in all directories (listed recursively) within each specified directory, file
name, or (if none are specified) the current working directory.
The block
count includes the indirect blocks of each file in 1-kilobyte units, independent
of the cluster size in use by the system
If you do not specify any options, an entry is generated for each directory.
See
du(1)
The following example displays a summary of blocks that all main subdirectories
in the
/usr/users
directory use:
# /usr/bin/du -s /usr/users/* 440 /usr/users/barnam 43 /usr/users/broland 747 /usr/users/frome 6804 /usr/users/morse 11183 /usr/users/rubin 2274 /usr/users/somer
From this information, you can determine that user Rubin is using the most disk space.
The following example displays the space that each file and subdirectory
in the
/usr/users/rubin/online
directory uses:
# /usr/bin/du -a /usr/users/rubin/online 1 /usr/users/rubin/online/inof/license 2 /usr/users/rubin/online/inof 7 /usr/users/rubin/online/TOC_ft1 16 /usr/users/rubin/online/build . . . 251 /usr/users/rubin/online
Note
As an alternative to the
ducommand, you can use thels -scommand to obtain the size and usage of files. Do not use thels -lcommand to obtain usage information;ls -ldisplays file sizes only.
You can use the
quot
command to list the number of
blocks in the named file system currently owned by each user.
You must be root user to use the
quot
command.
The following example displays the number of blocks that each user owns
and the number of files owned by each user in the
/dev/disk/dsk0h
file system:
# /usr/sbin/quot -f /dev/disk/dsk0h
Note
You must specify the character device special file to return the information, because when the device is mounted the block special device file is busy.
See
quot(8)