ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Solaris下mount一个磁盘

Solaris下mount一个磁盘

原创 Linux操作系统 作者:yangtingkun 时间:2007-02-16 00:00:00 0 删除 编辑

在安装Solaris的时候,默认安装只装在了一个磁盘上。而没有使用另一个磁盘。简单记录一下mount磁盘的步骤。


首先检查一下当前的配置:

# df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1t0d0s0 10232602 873037 9257239 9% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
/dev/dsk/c1t0d0s1 1016122 8549 946606 1% /var
swap 11815608 24 11815584 1% /var/run
/dev/dsk/c1t0d0s5 5161437 2133 5107690 1% /opt
swap 11815600 16 11815584 1% /tmp
/dev/dsk/c1t0d0s7 10323610 9 10220365 1% /export/home
# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000004cfd99114,0
1. c1t1d0
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w2100000c50acf424,0
Specify disk (enter its number): 1
selecting c1t1d0
[disk formatted]


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> p
Current partition table (original):
Total disk cylinders available: 24620 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wu 0 0 (0/0/0) 0
2 backup wu 0 - 24619 33.92GB (24620/0/0) 71127180
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 - 24618 33.91GB (24619/0/0) 71124291

可以看到,目前使用的只是c1t0d0这块磁盘,而c1t1d0并没有使用。

# mkdir /data
# mount /dev/dsk/c1t1d0s7 /data
# df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1t0d0s0 10232602 873038 9257238 9% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
/dev/dsk/c1t0d0s1 1016122 8549 946606 1% /var
swap 11815640 24 11815616 1% /var/run
/dev/dsk/c1t0d0s5 5161437 2133 5107690 1% /opt
swap 11815632 16 11815616 1% /tmp
/dev/dsk/c1t0d0s7 10323610 9 10220365 1% /export/home
/dev/dsk/c1t1d0s7 35007716 9470804 25186835 28% /data

首先建立mount点目录,然后通过mount就可以加载了,注意磁盘上原始的数据并没有清除。如果需要清除数据的话,可以在mount之前使用newfs命令:

# umount /dev/dsk/c1t1d0s7
# newfs /dev/rdsk/c1t1d0s7
newfs: /dev/rdsk/c1t1d0s7 last mounted as /data
newfs: construct a new file system /dev/rdsk/c1t1d0s7: (y/n)? y
Cylinder groups must have a multiple of 16 cylinders with the given parameters
Rounded cgsize up to 256
Warning: 1 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s7: 71124290 sectors in 24619 cylinders of 27 tracks, 107 sectors
34728.7MB in 770 cyl groups (32 c/g, 45.14MB/g, 5632 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 92592, 185152, 277712, 370272, 462832, 555392, 647952, 740512, 833072,
925632, 1018192, 1110752, 1203312, 1295872, 1388432, 1480992, 1573552,
1666112, 1758672, 1851232, 1943792, 2036352, 2128912, 2221472, 2314032,
.
.
.
70726000, 70818560, 70911120, 71000096, 71092656,
# mount /dev/dsk/c1t1d0s7 /data
# df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1t0d0s0 10232602 873038 9257238 9% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
/dev/dsk/c1t0d0s1 1016122 8549 946606 1% /var
swap 11813160 24 11813136 1% /var/run
/dev/dsk/c1t0d0s5 5161437 2133 5107690 1% /opt
swap 11813152 16 11813136 1% /tmp
/dev/dsk/c1t0d0s7 10323610 897713 9322661 9% /export/home
/dev/dsk/c1t1d0s7 35007716 9 34657630 1% /data

不过这个mount动作只对本次启动有效,如果希望下次启动后仍然生效,需要手工将信息添加到/etc/vfstab文件中。

# more /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s3 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no -
/dev/dsk/c1t0d0s1 /dev/rdsk/c1t0d0s1 /var ufs 1 no -
/dev/dsk/c1t0d0s7 /dev/rdsk/c1t0d0s7 /export/home ufs 2 yes -
/dev/dsk/c1t0d0s5 /dev/rdsk/c1t0d0s5 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -
# cp /etc/vfstab /etc/vfstab.bak
# echo "/dev/dsk/c1t1d0s7 /dev/rdsk/c1t1d0s7 /data ufs 1 yes -" >> /etc/vfstab
# more /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s3 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no -
/dev/dsk/c1t0d0s1 /dev/rdsk/c1t0d0s1 /var ufs 1 no -
/dev/dsk/c1t0d0s7 /dev/rdsk/c1t0d0s7 /export/home ufs 2 yes -
/dev/dsk/c1t0d0s5 /dev/rdsk/c1t0d0s5 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -
/dev/dsk/c1t1d0s7 /dev/rdsk/c1t1d0s7 /data ufs 1 yes -

在修改/etc/vfstab文件之前最好先做好备份。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-69172/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10486800