Solaris 10 x86系統上添加新硬盤

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 *****


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章