UNIX硬盘分区简介

写这份文档的初衷是在网络上和一些朋友聊天的时候,常常会被问到这个问题,回答了很多次 。为了一劳永逸的解决这个问题,决定写一份文档,方便以后再次被问到的时候copy,呵呵 。同时,也是为了帮助自己不断巩固这些知识,算是一份粗糙的笔记吧 。
“Unix硬盘分区简介”这个标题有些大,本来只是为了介绍一下Solaris和Linux的分区,但是也希望对其他UNIX熟悉的朋友们分享你们的知识,将你们所熟悉的UNIX,例如FreeBSD,ScoUNIX,HpUNIX等的硬盘分区知识,share出来 。如果发现了文章之中的错误,请联系我(E-Mail:cqwlyh@263.net;MSN:cqwlyh@263.net),如果对文章进行了修改,请留下您的名字和联系方式 。
ok,闲话少说,让我们进入正题吧:



1.Solaris硬盘分区简介

Solaris下,一个磁盘包含8个分区,标记为0-7 。此信息可以通过format命令,然后选择一个硬盘来看到,例如,在我自己的系统中(Solaris 9,Ultra 60),显示出来的信息如下:
# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1f,4000/scsi@3/sd@0,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>
不要看到内容这么多,就被吓住了,其实,format命令之后0. c0t0d0 /pci@1f,4000/scsi@3/sd@0,0所显示出来的含义很简单,0. c0t0d0就代表这台Ultra 60里面只装了一个硬盘(至于c0t0d0的具体含义,稍后会介绍),代表的是这个硬盘的大小和柱面信息,/pci@1f,4000/scsi@3/sd@0,0所代表的,就是这个硬盘的实际物理地址 。这些信息看起来很复杂,其实一般都只需要看看format命令抓出来的硬盘数量,是不是我们装在系统上的数量,例如你装了两个硬盘,但是这里只有一个硬盘的信息,就需要认真面对了 。
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
这里所列出来的,是可以使用的命令,比如我在最下面format>,就是用了p这个命令(慢点,上面没有p这个命令啊?其实,这里p就是partition的简写),然后,列出了以下内容:
PARTITION MENU:
0 - change `0" partition

推荐阅读