Compared to Linux, Solaris is quite similar except for certain aspects which I will clarify here. This guide will not only cover Solaris but also include general information about disk architecture and filesystems.
Physical Operation
Files, Inodes and Blocks
On your hard drive, where you store your data, there is a hierarchical structure:
Directories and files
Inodes
Blocks
Inodes are what know exactly where each directory/file is located. When you create or call a file, it points to an inode. This inode is then able to identify which data block it belongs to (binary slice). Here's a small explanation with an image:
Hardware Recognition
To recognize where a specific device is located on our system, here's a brief explanation: Assuming we have a file in /dev like: c0t0d0s0. This means:
c0: On Controller 0
t0: On SCSI Target 0
d0: I have Disk 0
s0: And I am positioned on Slice 0
Here are some examples:
SCSI
IDE
Slices
Then, the slices (also called partitions) are defined as follows for better performance optimization:
What About My Machine?
To start, you should know what's on your machine. For this, there are 3 solutions:
Then, simply connect your device and restart your machine. Once done, configure the slices.
Without Reboot
If it's a "critical" machine, you need to run the "devfsadm" command. This command will try to match the loaded kernel drivers with the devices in /devices.
Here are some usage examples:
Defining devices such as disk, tape, port, audio or pseudo:
The disk partitioning is made of slices that are delimited by cylinders. Indeed, a slice occupies a strip of cylinders (ex: 1 to 2850). Then the next slice will go from 2850 to 5000.
The partitions are therefore determined from the first cylinder of each slice:
Slice 1: Cylinder 0 to 2850
Slice 2: Cylinder 2850 to 5000
...
Waste
Wasting cylinders creates a potentially empty slice. You can use it later. However, in case of defective sectors, it is possible that the partition will shrink due to lost cylinders.
Overlapping
Overlapping occurs when multiple slices access the same cylinder (usually one slice encroaching on another). To fix this problem, when you edit your partition, use the "modify" command:
Select partitioning base:
0. Current partition table (unnamed)
1. All Free Hog
Choose base (enter number) [0]? 0
Warning: Overlapping partition (1) in table.
Warning: Fix, or select a different partition table.
Defining Partitions
The format command automatically handles partitioning according to data in /etc/format.dat. The advantage is that it's super fast and easy when adding a disk. Now, manually, here's how to do it:
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <ST38410A cyl 16706 alt 2 hd 16 sec 63>
/pci@1f,0/pci@1,1/ide@3/dad@0,0
1. c1t3d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
/pci@1f,0/pci@1/scsi@1/sd@3,0
Specify disk (enter its number):
Now we have the list of detected disks. We'll choose the second disk and continue:
Specify disk (enter its number): 1
selecting c1t3d0
[disk formatted]
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
scsi - independent SCSI mode selects
cache - enable, disable or query SCSI disk cache
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format>
In the menus that we can see, change or confirm partition choices, we have:
Elements
Functions
partition
Displays the partition menu
label
Writes the current partition name list to the disk
Expecting one of the following: (abbreviations ok):
unassigned boot root swap
usr backup stand var
home alternates reserved
Enter partition id tag[unassigned]:
minimum percentage of free space changes from 10% to 1%
Checking Disk Status
The fsck command, like in Linux, allows you to check the integrity of the filesystem to repair any orphaned inodes (don't forget to unmount the partition before performing this operation):
** /dev/rdsk/c0t0d0s7
** Last Mounted on /export/home
** Phase 1 - Check Blocks and Sizes
INCORRECT BLOCK COUNT I=743 (5 should be 2)
CORRECT?
If there are files that can be recovered, you will find them in "lost+found". Check if they are correct with the "file" command. It is estimated that if "file" can determine what type of file it is, then it's correct.
Vfstab
The /etc/vfstab file is the equivalent of /etc/fstab in Linux. It lists all partitions and their mount points.
/ on /dev/dsk/c0t0d0s0 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=2200008 on Sun Oct 24 08:57:24 2004
/devices on /devices read/write/setuid/devices/dev=4a80000 on Sun Oct 24 08:57:00 2004
/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Sun Oct 24 08:57:00 2004
/proc on proc read/write/setuid/devices/dev=4b00000 on Sun Oct 24 08:57:00 2004
/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Sun Oct 24 08:57:00 2004
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Sun Oct 24 08:57:00 2004
/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Sun Oct 24 08:57:00 2004
/usr on /dev/dsk/c0t0d0s6 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=220000e on Sun Oct 24 08:57:25 2004
/dev/fd on fd read/write/setuid/devices/dev=4d40001 on Sun Oct 24 08:57:25 2004
/var on /dev/dsk/c0t0d0s3 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=220000b on Sun Oct 24 08:57:27 2004
/var/run on swap read/write/setuid/devices/xattr/dev=4b80002 on Sun Oct 24 08:57:27 2004
/tmp on swap read/write/setuid/devices/xattr/dev=4b80003 on Sun Oct 24 08:57:27 2004
/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=220000f on Sun Oct 24 08:57:41 2004
Mounting Partitions
To manually mount partitions, there is the mount command. Here are some examples:
Boot device: /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f File and args -s
SunOS Release 5.10 Generic 64 bit
Copyright 1983-2004 by Sun Microsystems, Inc. All rights reserved.
Booting to milestone "milestone/single-user:default"
Configuring /dev and /devices
Use is subject to license terms
Using RPC Bootparams for network configuration information.
Skipping interface hme0
-
INIT: SINGLE USER MODE