我没有SUN的小型机。这是用的X86的服务器,以下内容不保证在Solaris Sparc的版本下好用。
df添加新硬件后有以下几种办法让系统识别新硬件
touch /reconfigure ; sync 重启电脑
在系统的启动过程当中根据系统提示按ESC进入交互启动模式,添加硬件
不重启而让系统识别顺序输入如下命令
modunload -i 0
drvconfig
devlinks
disks
接下来为硬盘分区
# 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
Specify disk (enter its number): 1 //选择新添加硬盘
selecting c0d1
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
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
!<cmd> - execute <cmd>, then return
quit
format> fdisk //相当于windows系统上新添加硬盘的初始化(我是这么理解的)。
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 - 7828 59.97GB (7829/0/0) 125772885
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 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
partition> 0 //选择0分区
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
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]: 50gb //或 7000e 就是结束的柱面号加e 一共是7828
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 - 7828 59.97GB (7829/0/0) 125772885 //0-7828是启始与结束柱面。
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 7828 59.97GB (7829/0/0) 125772885 //这是整个硬盘,分区时千万不要选这个分区。
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 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
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
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
!<cmd> - execute <cmd>, then return
quit
format> q
分区完成后,分区名为硬盘名加s加你选的分区数。
如:硬盘1为 c0d1 0号分区为 c0d1s0
建立文件系统也就是格式化
# newfs /dev/dsk/c0d1s0 // 也可以使用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
#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)
另外我们编辑/etc/vfstab文件,使系统每次启动自动挂载文件系统
当文件系统顺坏的时候可以使用fsck进行修复,注意fsck只能修复例如超级块顺坏,inode同时存在于空闲和使用链表中这类结构性的数据损坏。
-bash-3.2# vi /etc/vfstab
"/etc/vfstab" 13 行,467 字符
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s1 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no -
/dev/dsk/c1t0d0s7 /dev/rdsk/c1t0d0s7 /export/home ufs 2 yes -
/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 /aa ufs 3 yes -
/dev/dsk/c1t1d0s1 /dev/rdsk/c1t1d0s1 /bb ufs 4 yes -
/devices - /devices devfs - no -
sharefs - /etc/dfs/sharetab sharefs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
~
~
~
~
~
~
~
"/etc/vfstab" 15 行,633 字符
原创文章请注明转载自技术小站本文地址:http://www.i5i6.net/post/32.html,标题:solaris10 for x86 添加硬盘并分区