solaris10添加一块硬盘并分区

 
残阳泪泊
 
主页 博客 相册 | 个人档案 | 好友 | i贴吧
 
查看文章
   
Solaris10上添加一块新硬盘并创建文件系统
2009-03-30 11:50

添加新硬件后有以下几种办法让系统识别新硬件

  1. touch /reconfigure ; sync 重启电脑
  2. 在系统的启动过程当中根据系统提示按ESC进入交互启动模式,添加硬件
  3. 不重启而让系统识别顺序输入如下命令

modunload -i 0

drvconfig

devlinks

disks

接下来为硬盘分区


hZ.b8R?7590422

# format 说明:-e 选项可以打开expert级菜单,比如可以进行写缓存的设置

Searching for disks...done

AVAILABLE DISK SELECTIONS:

0. c0d0 < DEFAULT cyl 17728 alt 2 hd 15 sec 63>

/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0

1. c0d1 < DEFAULT cyl 2077 alt 2 hd 16 sec 63>

/pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0

2. c1d1 < DEFAULT cyl 1038 alt 2 hd 16 sec 63>

/pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0

Specify disk (enter its number): 2

selecting c1d1

Controller working list found

[disk formatted, defect list found]

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

fdisk - run the fdisk program

repair - repair a defective sector

show - translate a disk address

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

volname - set 8-character volume name

!< cmd> - execute < cmd> , then return

quit

format> fdisk

No fdisk table exists. The default partition for the disk is:

a 100% " SOLARIS System" partition

Type " y" to accept the default partition, otherwise type " n" to edit the

partition table.

y

format> partition

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

!< cmd> - execute < cmd> , then return

quit

partition> print

Current partition table (original):

Total disk cylinders available: 1037 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 0 (0/0/0) 0

1 unassigned wm 0 0 (0/0/0) 0

2 backup wu 0 - 1037 510.89MB (1038/0/0) 1046304

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wm 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

8 boot wu 0 - 0 0.49MB (1/0/0) 1008

9 alternates wm 1 - 2 0.98MB (2/0/0) 2016

partition> 0 选择0分区

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]: ?

Expecting one of the following: (abbreviations ok):

unassigned boot root swap

usr backup stand var

home alternates reserved

Enter partition id tag[unassigned]: unassigned

Enter partition permission flags[wm]: wm

Enter new starting cyl[0]: 0 分区的起始柱面,1分区(c1d1s1)的起始柱面要大于等于0分区(c1d1s0)的结束柱面+1,虽然小于0分区的结束柱面也能建立分区,但是两个分区无法同时使用,并且newfs 1分区会使0分区的数据丢失

Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 0.1gb

partition> label 将信息写入磁盘

Ready to label disk, continue? yes

partition> print

Current partition table (unnamed):

Total disk cylinders available: 1037 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0 unassigned wm 0 - 208 102.87MB (209/0/0) 210672

1 unassigned wm 0 0 (0/0/0) 0

2 backup wu 0 - 1037 510.89MB (1038/0/0) 1046304

3 unassigned wm 0 0 (0/0/0) 0

4 unassigned wm 0 0 (0/0/0) 0

5 unassigned wm 0 0 (0/0/0) 0

6 unassigned wm 0 0 (0/0/0) 0

7 unassigned wm 0 0 (0/0/0) 0

8 boot wu 0 - 0 0.49MB (1/0/0) 1008

9 alternates wm 1 - 2 0.98MB (2/0/0) 2016

partition> q

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

fdisk - run the fdisk program

repair - repair a defective sector

show - translate a disk address

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

volname - set 8-character volume name

!< cmd> - execute < cmd> , then return

quit

format>

format> q

# newfs /dev/dsk/c1d1s0 建立文件系统 可以使用newfs -N /dev/dsk/c1d1s0先预览下

newfs: 建构新的文件系统 /dev/rdsk/c1d1s0: (y/n) y

警告:inode/柱面组 (115) > = 最后一个柱面组中的数据块 (63)

此表明 1008 扇区不能分配。

/dev/rdsk/c1d1s0: 208 磁道上,16 扇区的 63 柱面的 209664 扇区

102.4MB 13 柱面群组 (16 c/g, 7.88MB/g, 3776 i/g)

超块 (fsck -F ufs -o b=#) 备份在:

32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,

161952, 178144, 194336,

# mkdir /testfs

# mount /dev/dsk/c1d1s0 /testfs

# df -h | grep /testfs

/dev/dsk/c1d1s0 96M 1.0M 86M 2% /testfs

另外我们编辑/etc/vfstab文件,使系统每次启动自动挂载文件系统

当文件系统顺坏的时候可以使用fsck进行修复,注意fsck只能修复例如超级块顺坏,inode同时存在于空闲和使用链表中这类结构性的数据损坏。

#fuser -u /testfs 查看那些用户在使用文件系统

/testfs: 752c(root) c代表root的当前目录在/testfs文件上

#fuser -uk /testfs 可以kill掉访问/testfs的进程

/testfs: 752c(root)

#umount /testfs

# newfs -N /dev/dsk/c1d1s0 查看超级块的备份块

警告:inode/柱面组 (115) > = 最后一个柱面组中的数据块 (63)

此表明 1008 扇区不能分配。

/dev/rdsk/c1d1s0: 208 磁道上,16 扇区的 63 柱面的 209664 扇区

102.4MB 13 柱面群组 (16 c/g, 7.88MB/g, 3776 i/g)

超块 (fsck -F ufs -o b=#) 备份在:

32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,

161952, 178144, 194336,

# fsck -F ufs -o b=16224 /dev/dsk/c1d1s0 16224备份块恢复主超级块

Alternate super block location: 16224.

** /dev/dsk/c1d1s0

** Last Mounted on

** Phase 1 - Check Blocks and Sizes

** Phase 2 - Check Pathnames

** Phase 3 - Check Connectivity

** Phase 4 - Check Reference Counts

** Phase 5 - Check Cyl groups

FREE BLK COUNT(S) WRONG IN SUPERBLK

SALVAGE? yes

2 files, 9 used, 98462 free (14 frags, 12306 blocks, 0.0% fragmentation)

***** FILE SYSTEM WAS MODIFIED *****

你可能感兴趣的:(list,cmd,Solaris,table,menu,disk)