About the partition and label disk partition label on Sun Solaris

Source: Internet
Author: User

A pdf reference of all solaris commands is provided, which is also a description of all man's content.
Download please CLICK: http://dlc.sun.com/pdf/816-0211/816-0211.pdf

Under Solaris, a disk contains eight partitions marked as 0-7. You can see this information through the format command and select a hard disk,
For example, in my own system (Solaris 9, Ultra 60), the following information is displayed:

# Format
Searching for disks... done
Available disk selections:
0. c0t0d0s2
/Pci @ 1f, 4000/scsi @ 3/sd @ 0, 0
1. c0t1d0s2
/Pci @ 1f, 4000/scsi @ 3/sd @ 1, 0
2. c0t2d0s2
/Pci @ 1f, 4000/scsi @ 3/sd @ 2, 0

Specify disk (enter its number): 0
Selecting c0t0d0

[Disk formatted]
Warning: Current Disk has mounted partitions.
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
Volname-set 8-character volume name
! -Execute, then return

Quit
Format> p

Partition menu:
0-change '0' partition
1-change '1' partition
2-change '2' partition
3-change '3' partition
4-change '4''' partition
5-change '5' partition
6-change '6'' partition
7-change '7'' partition
Select-select a predefined table
Modify-modify a predefined partition table
Name-name the current table
Print-display the current table
Label-write partition map and label to the disk
! -Execute, then return
Quit
Partition>

Don't be scared when you see so much content. In fact, after the format command 0. c0t0d0 <SUN18G cyl 7506 alt 2 hd 19 sec
248>/pci @ 1f, 4000/scsi @ 3/sd @ 0,
0. c0t0d0 indicates that only one hard disk is installed in this Ultra 60 instance (for the specific meaning of c0t0d0, we will introduce it later ),
<SUN18G cyl 7506 alt 2 hd 19 sec 248> indicates the disk size and cylinder information,
/Pci @ 1f, 4000/scsi @ 3/sd @ represents the actual physical address of the hard disk.
This information looks complicated. In fact, you generally only need to check the number of hard disks captured by the format command,
Is it the number of disks we have mounted on the system? For example, if you have installed two hard disks, but there is only one hard disk information here...

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
Volname-set 8-character volume name
! -Execute, then return
Quit

Format> p

Is short for partition

The following content is listed:
Partition menu:
0-change '0' partition
1-change '1' partition
2-change '2' partition
3-change '3' partition
4-change '4''' partition
5-change '5' partition
6-change '6'' partition
7-change '7'' partition
Select-select a predefined table
Modify-modify a predefined partition table
Name-name the current table
Print-display the current table
Label-write partition map and label to the disk
! -Execute, then return

Quit

Partition>

This information should clearly prove that a disk in Solaris contains eight partitions marked as 0-7. The following are still available
For the specific meaning of these commands, you can refer to the English description after the command.
Next, we will focus on the following: before writing data to a hard disk, We need to partition and format it. This process can generally be divided into three

Steps:

1. Physical Formatting, also known as Low-Level Formatting (LLF );
2. partitions;
3. Logical Formatting (HLF)

During Low-Level formatting, the hard disk is divided into several channels. These channels are divided into several sectors, each of which is filled with random data.
Almost all hard disks have been low-level formatted before leaving the factory. Therefore, you only need to perform the following two steps (partition and logical formatting) on the hard disk)
You can. The partitioning action divides the hard disk into several parts to become a partition or partition.
(Note: The previous "partition" is a verb, followed by a noun ). Each partition/Shard is composed of several cylinders. In most cases,
One partition in Solaris corresponds to one file system one by one. A partition cannot contain multiple file systems. Similarly,
A file system cannot span multiple partitions. In Solaris, partitioning the hard disk is the format command we used at the beginning.

When Solaris performs advanced formatting, each partition is divided into many cylindrical groups, each of which includes several consecutive cylindrical groups. The file system creates files and directories in these cylindrical groups, and stores the data of the same file in the same cylindrical group as much as possible. This mechanism ensures that the head moves at least when reading data, thus speeding up Data Reading. In Solaris, The newfs command is used for advanced formatting. The default File System is a UNIX File System (UFS: Unix File System), which uses the following types of blocks:
1. Boot block: stores the information required when the system is started.
2. Super block: stores File System Information
3. Index node (I node): stores the information of a single file in the file system.
4. Storage block/data block: stores file data
The following describes these types of blocks in detail.

Boot block:

Information required when the boot block storage system starts. The boot block is always located in the first cylindrical Group of the hard disk, occupying the first 8 KB of the partition.

Super block:

Super block storage file system information, which contains the following information:
1. Total number of parts in the file system (file system size)
2. Number of data blocks in the file system
3. Number of index nodes
4. Number of cylindrical groups
5. Block Size
6. Disk shard size
7. Number of idle Blocks
8. Number of idle index nodes
Super blocks are extremely important to the file system, so the Solairs system uses multiple backups to ensure its security. Occasionally, when the system is not properly shut down or the hard disk fails, the default Super block cannot be correctly read or is inconsistent with the super block backed up by the system. In this case, repair is required. Generally, the system will call the fsck command to automatically restart the system. When fsck finds that the default Super block is damaged and cannot be repaired automatically, it will prompt you to manually repair it.

You can perform the following steps for manual repair:
1. Enter the system as a single user, for example, in the PROM mode (that is, in the OK status)
Run the command boot-s to enter single-user mode or sync, sync, and sync in the system;
Init 0 can also enter the single-user mode (as to what is single-user mode, we will introduce it in detail later)

2. If the damaged file has been installed in the file tree, you can enter another directory and uninstall the damaged file system, for example:
# Cd/
# Umount/var

3. Use the newfs-N command to display the value of the super block. This command will list the backup super block in the file system.

Location:
# Newfs-N/dev/dsk/c0t0d0s1
/Dev/rdsk/c0t0d0s1: 961248 sectors in 204 cylinders of 19 tracks, 248 sectors
469.4 MB in 13 cyl group (16 c/g, 36.81 MB/g, 17664 I/g)
Super-block backups (for fsck-F ufs-o B = #):

32,756 80, 151328,226 976, 302624,378 272, 453920,529 568, 605216,680 864, 756512,
832160,907,

4. Select an option for The fsck command from the backup super block listed by the newfs-N command to fix it:
# Fsck-F ufs-o B = 453920/dev/rdsk/c0t0d0s1

Index Node

The index node contains all information except the file name. An index node occupies 128 bytes of disk space. It contains the following information:
1. file type: common files, directories, block device files, character device files, links, etc.
2. File Permissions: A combination of read, write, and execution Permissions
3. Number of hard links to the file
4. User ID of the file owner
5. ID of the group to which the file belongs
6. File size (number of bytes)
7. An array containing 15 disk block addresses
8. Last file access date and time
9. Date and time of the last File Modification
10. date and time when the file was created

Each file on the hard disk has an index node describing its information. When a file system is created,
A certain number of index nodes are created simultaneously in the hard disk cylindrical group. Sometimes, these index nodes may not be enough,
For example, when a program generates a large number of small files, the file system needs to add an index node.
Similarly, if we know that this file system is only used to store a few large files, we can reduce the number of index nodes to achieve
The purpose of saving disk space-after all, each index node occupies 128 bytes. When creating a file system,
You can use the-I option of the newfs command to increase or decrease the number of index nodes.

The df command in the/usr/ucb directory can view the status of cited nodes in the file system. For example:

# Usr/ucb/df-I
Filesystem iused ifree % iused Mounted on
/Dev/dsk/c0t0d0s0 131672 1929384/
Note: Once a file system is created, the number of its index nodes cannot be changed. Therefore, when the index node is not enough,
First, you should back up the data of this file system, then create a new file system that contains more index nodes, and then restore the backup data
The new file system is ready.

Storage block/data block

A storage block, also called a data block, occupies all other space in the file system. These blocks contain data files stored on disks.
The size of each block is determined when a file system is created. For a common file, the storage block stores the file content,
For a directory, the storage block stores the index node number and file name information of all files in this directory.

Disk name

Here we will explain in detail the detailed meaning of c0t0d0 when we first use the format command.
In the Solaris system, device names are used to represent disks. The disk device name is a series of letters and numbers similar to the cXtXdX format,
For example, we can see c0t0d0. The letters (c, t, d) in the device name are the same, but X represents a number indicating a specific disk or system.
For example, c0t0d0 indicates the No. 0 controller, the No. 0 disk, and the No. 0 LUN. This usually refers to the first hard disk in the system,
It is often the boot disk of the system ).

Sun uses the following naming method to define the logical device name:

/Dev/[r] dsk/cXtXdXsX

C: Logical Controller number (Logical Controller)
T: Physical Bus Target number
D: disk or logical unit number (LUN)
S: Partition Number

CX: X indicates the disk controller. When SUN collects information about the disk controller installed in the system, it returns a value to each disk controller,
The value depends on the sequence of the System Monitoring controller. The first detected controller assigned a value of 0,
The second controller is 1, and so on. For the IDE system, the first IDE channel is 0, and the second (if any) channel is 1.

TX: X indicates the destination number of the disk. This number is sometimes called a SCSI identifier. Each disk on the disk controller has
A unique destination number. The controller can use this destination number to independently address each disk. For IDE disks,
The target number of the master disk is 0, and the target number of the slave disk is 1.

DX: X indicates the logical unit number (LUN) of the disk ). In some disk arrays, Luns are used to differentiate disks in the system.
An array can use a target number to represent a group of disks, and then LUN to represent a single disk in the disk group.
This method is widely used in SCSI disk arrays and disc conversion devices. For a single disk or IDE disk, this number is always set to 0.

SX: X indicates the Partition Number on the disk. It corresponds to the partition of the disk. As we mentioned earlier, "under Solaris,
A disk contains eight partitions marked as 0-7, because the value of X can only be 0-7.

The above content gives a detailed description of c0t0d0s0.

Tired. Let's talk about the introduction of Disk Label.
Disk label in Solaris

Disk Lable always records the Disk information and data storage format at the beginning of the Disk, including the Label type, Disk size, Disk partition information, and Disk geometry information in the VTOC Label. Next we will introduce the two types of labels supported by Solaris, VTOC and EFI, respectively on the Linux and x86 platforms.

1. VTOC Label is available on the iSCSI Platform
Layout of VTOC label disk on the iSCSI Platform

S stands for slice, which is the partition we call. The VTOC Label supports eight partitions on the instance. Therefore, it is also called VTOC8. S2 represents the entire disk, and its Tag is always backup. In the/dev/rdsk/directory, we can see these device files, c * t * d * s0 ~ C * t * d * s7. The partition table of vtoc is placed in the first sector of the disk, with a total of 512 bytes.

2. VTOC Label on X86 Platform
Layout of VTOC label disk on the X86 Platform

The concept of FDISK partitioning is different from that on the X86 platform. The FDISK partition table is in the first sector of the disk (MBR ). Solaris supports four logical partitions and does not support extended partitions. Solaris can be installed in any logical partition, or different versions of solaris can be installed in different logical partitions, but only one partition of Solaris is active. In/dev/rdsk/, we can see c * t * d * p0 ~ C * t * d * p4. p0 indicates the entire disk, and p1 to p4 indicates four partitions respectively. In the example in the figure, the active solairs partition is installed in the first partition.
The disk label of the active solaris partition has 512 bytes in the first sector of the solaris partition. VTOC Lable supports 16 partitions on x86, so it is also called VTOC16. S2 indicates all Solaris FDISK partitions, And the tag is backup. In the/dev/rdsk directory, we can see these device files, c * t * d * s0 ~ C * t * d * s15. However, with the format tool, we can only see 10 partitions, s0 to s9.

3. The EFI Label is available on both the Linux and X86 platforms.
Extended Firmware Interface (Extensible Firmware Interface or EFI) is an upgrade solution launched by Intel to replace BIOS in PC-like computer systems in the future. In the EFI specification, a GUID disk partition system (GPT) that breaks through the limitation of the traditional MBR disk partition structure is introduced. In the new structure, the number of partitions on the disk is no longer limited (only four primary partitions can exist under the MBR structure), and the partition type is represented by GUID.
The EFI Label has the same layout. Therefore, disks with the EFI Label can be freely switched between the Linux and X86 platforms. Currently, VTOC Label cannot do this.

LBA0 is a PMBR, which is basically useless in the EFI Label. It is only a legacy product of MBR, But it identifies the disk using the EFI Label.
LBA1 is the GPT (Global Partition Table) Header, that is, the Header of the EFI Label. It records the location of the EFI Label, the location of the user region, and the location of the backup label.
LBA2 to LBA33 are specific GPT Entries. Each LBA can have four entries. Solaris only uses nine entries, and the others are 0.
The LBA34 to LBAn-33 is nine partitions.
LBAn-32 to LBAn-1 is the backed up GPT Entries. (N is the number of LBA disks, capacity-1)
LBAn is the GPT Header of the backup.

Although the EFI Label does not specify the number of partitions, the number of EFI labels created by Solaris is limited. The EFI Label created by Solaris supports nine partitions, S0 to s8. S2 does not represent a full disk, but a common partition. S7 is used to indicate a full disk, which is invisible to users, you can only see that the device file of c * t * d * is used to indicate the full disk. S8 is used as a reserved partition and no device file is created. You cannot use it. Therefore, the partitions that users can use are S0 to s6.
However, the EFI Label created on other operating systems, Solaris, can also be identified, and there is no limit on the number of partitions, using format (1 M) or prtvtoc (1 M) you can see the specific partition table. However, only S0 to S6 can be read and written. Other partitions do not have device nodes and cannot be read or written.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.