This chapter discusses system administration tasks related to the administration of disks, including:
A discussion on partitioning disks using a graphical user interface (Section 5.1)
A description on partitioning disks manually (Section 5.2)
A discussion on copying disks (Section 5.3)
See the
AdvFS Administration
manual for information on administering AdvFS.
5.1 Partitioning Disks Using the Disk Configuration Utility
The Disk Configuration graphical
user interface (GUI),
diskconfig, enables you to perform
the following tasks:
Display attribute information for existing disks
Modify disk configuration attributes
Administer disk partitions
Administer disk aliases
See
diskconfig(8)diskconfig).
An online help volume describes
how you use the GUI.
Invoke the Disk Configuration GUI using either of these methods:
Enter
/usr/sbin/diskconfig
at the system
prompt.
Use the following procedure:
Select the SysMan Applications pop-up menu from the CDE Front Panel.
Select Configuration. The SysMan Configuration folder opens.
Select the Disk icon from the SysMan Configuration folder.
Caution
Disk Configuration displays appropriate warnings when you attempt to change partition sizes. However, you should plan the changes in advance to ensure that you do not overwrite any required data. Back up any data partitions before attempting this task.
A window titled
Disk Configuration on
hostname
is displayed.
This is the main window for the Disk Configuration application,
and lists each disk on the system, and gives the following information for
each disk:
The disk basename, such as
dsk10.
See the
Hardware Management
manual 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 Hardware Management manual for information on the device location.
Select a device in the list then select
Configure...
to configure a specific disk; an alternate method is double clicking on the
device in the list.
Two windows,
Configure Partitions
and
Partition Table, open.
This window allows you to set the start address, end address, size, and usage options for the disk partitions.
This window displays the current partitions, their start addresses, their end addresses, and their sizes.
See 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:
Add the new file system to the
/etc/fstab
file.
Invoke the SysMan Menu. See Chapter 1 for further information.
Select
File Systems.
Additional options
are displayed.
Select
General File System Utilities.
Additional
options are displayed.
Select
Mount File Systems.
The Mount File
Systems main window opens.
Select
Mount an AdvFS/UFS file system,
then select
Next>.
The Steps dialog box opens.
Select
Next>.
The Select File System dialog
box opens.
Select the file system in the List of File Systems, then enter
Next>.
The Mount dialog box opens.
Enter a mount point, such as
/usr/newusers
in the Mount Directory field.
Alternatively, use
Browse...
to find and select a
directory for the mount point.
Select the Access Mode.
Select
Next>.
The Summary dialog box opens.
Select
Finish.
Select
Exit
to close the SysMan
Menu.
Your new file system is now accessible.
5.1.1 Configure Partitions Window
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 toggle the sizing information between megabytes, bytes, and 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 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 is described in the following section.
This window displays a bar-chart of the current partitions in use, their
sizes, and the file system in use.
You can toggle between the current partition
sizes, the default table for this device, and the original (starting table)
when this session started.
If you make errors on a manual partition change,
you can use this window to reset the partition table.
5.2 Manually Partitioning Disks
The following sections provide 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.
5.2.1 Utilities
These commands allow you to perform several disk maintenance tasks manually:
disklabelUse 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
disklabel(4)/etc/disktab
file.
newfsUse this command to create
a new UFS file system on the specified device.
Do not use the
newfs
command to create Advanced File System (AdvFS) domains; use the
mkfdmn
command instead.
mkfdmn
and
mkfset
Use these commands
to create Advanced File System (AdvFS) domains and filesets.
See
mkfdmn(8)
5.2.2 Using the disklabel Utility
The disk label provides detailed information about the geometry of the
disk and the partitions into which the disk is divided.
As root, you can
change the label with the
disklabel
command.
See
disklabel(8)
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 access
the label on the disk directly 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,
use partition
c
to change the label.
Partition
c
must 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 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. Also, you can 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.2.3 Examining for Overlapping Partitions with the newfs Command
Commands to mount or create file systems, add a new
swap device, and add disks to the Logical Storage Manager first verify whether
the disk partition specified in the command already contains valid data, and
whether it overlaps with a partition that is marked for use already.
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 ask if you want to continue, 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.3 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 Chapter 9, 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.
The operating system 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 if 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