添加硬盘的步骤

刚开始学习Solaris,错漏之处,望指教

基本步骤:
1)关闭机器,接上硬盘
2)devfsadm
3)format记下认识出来的cXdX
4)format->fdisk->partition生成需要的分区(记得保存)
5)newfs 记得此时设备名称中的s要与上面生成的partition对应
6)建立必要的目录然后挂上?
===========================================================================================================
下面是第一块磁盘的信息:

bash-2.05# prtvtoc /dev/rdsk/c0d0s0
* /dev/rdsk/c0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*      15 tracks/cylinder
*     945 sectors/cylinder
*   24388 cylinders
*   24386 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
* Unallocated space:
*       First     Sector    Last
*       Sector     Count    Sector
*    23043825       945  23044769
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00       2835   1434510   1437344   /
       1      7    00    1437345   1229445   2666789   /var
       3      3    01    2666790   1206765   3873554
       5      0    00    3873555  14049315  17922869   /opt
       6      4    00   17922870   4096575  22019444   /usr
       7      8    00   22019445   1024380  23043824   /export/home
       8      1    01          0       945       944
       9      9    01        945      1890      2834

partition> print
Current partition table (original):
Total disk cylinders available: 24386 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       3 -  1520      700.44MB    (1518/0/0)   1434510
  1        var    wm    1521 -  2821      600.31MB    (1301/0/0)   1229445
  2     backup    wm       0                0         (0/0/0)            0
  3       swap    wu    2822 -  4098      589.24MB    (1277/0/0)   1206765
  4 unassigned    wm       0                0         (0/0/0)            0
  5 unassigned    wm    4099 - 18965        6.70GB    (14867/0/0) 14049315
  6        usr    wm   18966 - 23300        1.95GB    (4335/0/0)   4096575
  7       home    wm   23301 - 24384      500.19MB    (1084/0/0)   1024380
  8       boot    wu       0 -     0        0.46MB    (1/0/0)          945
  9 alternates    wu       1 -     2        0.92MB    (2/0/0)         1890

下面增加第二个硬盘:
SunOS 5.9

login: root
Password:
Last login: Sat Jul  3 17:23:22 from :0
Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
# bash
bash-2.05# devfsadm
bash-2.05# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1
          /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
        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
        !     - execute , then return
        quit
format> partition
Please run fdisk first.
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
        ! - execute , then return
        quit
partition> print
Current partition table (original):
Total disk cylinders available: 8319 + 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 - 8319        4.00GB    (8320/0/0) 8386560
  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
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]: root
Enter partition permission flags[wm]: wm
Enter new starting cyl[3]:
Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: 400mb
partition> print
Current partition table (unnamed):
Total disk cylinders available: 8319 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       3 -  815      400.15MB    (813/0/0)   819504
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 8319        4.00GB    (8320/0/0) 8386560
  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> 1
Part      Tag    Flag     Cylinders        Size            Blocks
  1 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]: swap
Enter partition permission flags[wm]: wu
Enter new starting cyl[3]: 816
Enter partition size[0b, 0c, 816e, 0.00mb, 0.00gb]: 100mb
partition> print
Current partition table (unnamed):
Total disk cylinders available: 8319 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       3 -  815      400.15MB    (813/0/0)   819504
  1       swap    wu     816 - 1019      100.41MB    (204/0/0)   205632
  2     backup    wu       0 - 8319        4.00GB    (8320/0/0) 8386560
  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> 3
Part      Tag    Flag     Cylinders        Size            Blocks
  3 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]: home
Enter partition permission flags[wm]:
Enter new starting cyl[3]: 1020
Enter partition size[0b, 0c, 1020e, 0.00mb, 0.00gb]: $
partition> print
Current partition table (unnamed):
Total disk cylinders available: 8319 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       3 -  815      400.15MB    (813/0/0)   819504
  1       swap    wu     816 - 1019      100.41MB    (204/0/0)   205632
  2     backup    wu       0 - 8319        4.00GB    (8320/0/0) 8386560
  3       home    wm    1020 - 8318        3.51GB    (7299/0/0) 7357392
  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> label
Ready to label disk, continue? y

partition> name
Enter table name (remember quotes): diskmy

partition> quit


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
        !     - execute , then return
        quit
format> save
Saving new disk and partition definitions
Enter file name["./format.dat"]:
format> save
Saving new disk and partition definitions
Enter file name["./format.dat"]: /etc/format.dat
format> quit
bash-2.05# prtvtoc /dev/rdsk/c0d1s0
* /dev/rdsk/c0d1s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*      16 tracks/cylinder
*    1008 sectors/cylinder
*    8321 cylinders
*    8319 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00       3024    819504    822527
       1      3    01     822528    205632   1028159
       2      5    01          0   8385552   8385551
       3      8    00    1028160   7357392   8385551
       8      1    01          0      1008      1007
       9      9    00       1008      2016      3023
bash-2.05# newfs /dev/rdsk/c0d1s0
newfs: construct a new file system /dev/rdsk/c0d1s0: (y/n)? y
/dev/rdsk/c0d1s0:       819504 sectors in 813 cylinders of 16 tracks, 63 sectors
        400.1MB in 51 cyl groups (16 c/g, 7.88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
 661856, 678048, 694240, 710432, 726624, 742816, 759008, 774176, 790368,
 806560,
bash-2.05# newfs /dev/rdsk/c0d1s1
newfs: construct a new file system /dev/rdsk/c0d1s1: (y/n)? y
/dev/rdsk/c0d1s1:       205632 sectors in 204 cylinders of 16 tracks, 63 sectors
        100.4MB in 13 cyl groups (16 c/g, 7.88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
 161952, 178144, 194336,
bash-2.05# newfs /dev/rdsk/c0d1s3
newfs: construct a new file system /dev/rdsk/c0d1s3: (y/n)? y
/dev/rdsk/c0d1s3:       7357392 sectors in 7299 cylinders of 16 tracks, 63 sectors
        3592.5MB in 83 cyl groups (88 c/g, 43.31MB/g, 5504 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 88800, 177568, 266336, 355104, 443872, 532640, 621408, 710176, 798944,
 6476000, 6564768, 6653536, 6742304, 6831072, 6919840, 7008608, 7096352,
 7185120, 7273888,
bash-2.05# mount /dev/dsk/c0d1s0 /disk2root
bash-2.05# mount /dev/dsk/c0d1s1 /disk2swap
bash-2.05# mount /dev/dsk/c0d1s3 /disk2home
bash-2.05# fstyp -v /dev/rdsk/c0d1s0 | head -10
ufs
magic   11954   format  dynamic time    Sat Jul  3 17:34:08 2004
sblkno  16      cblkno  24      iblkno  32      dblkno  504
sbsize  2048    cgsize  2048    cgoffset 32     cgmask  0xfffffff0
ncg     51      size    409752  blocks  384847
bsize   8192    shift   13      mask    0xffffe000
fsize   1024    shift   10      mask    0xfffffc00
frag    8       shift   3       fsbtodb 1
minfree 10%     maxbpg  2048    optim   time
maxcontig 7     rotdelay 0ms    rps     60
Broken Pipe
Unknown_fstyp (no matches)
bash-2.05# prtvtoc /dev/rdsk/c0d1s0
* /dev/rdsk/c0d1s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*      16 tracks/cylinder
*    1008 sectors/cylinder
*    8321 cylinders
*    8319 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00       3024    819504    822527   /disk2root
       1      3    01     822528    205632   1028159   /disk2swap
       2      5    01          0   8385552   8385551
       3      8    00    1028160   7357392   8385551   /disk2home
       8      1    01          0      1008      1007
       9      9    00       1008      2016      3023
bash-2.05# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        657M    65M   533M    11%    /
/dev/dsk/c0d0s6        1.9G   1.3G   530M    72%    /usr
/dev/dsk/c0d0p0:boot    10M   1.5M   8.5M    16%    /boot
/proc                    0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
fd                       0K     0K     0K     0%    /dev/fd
/dev/dsk/c0d0s1        563M    65M   442M    13%    /var
swap                   759M    24K   759M     1%    /var/run
swap                   759M     4K   759M     1%    /tmp
/dev/dsk/c0d0s5        6.6G   613M   5.9G    10%    /opt
/dev/dsk/c0d0s7        469M     9K   422M     1%    /export/home
/dev/dsk/c0d1s0        376M     9K   338M     1%    /disk2root
/dev/dsk/c0d1s1         94M     9K    85M     1%    /disk2swap
/dev/dsk/c0d1s3        3.5G     9K   3.4G     1%    /disk2home
bash-2.05# mount
/ on /dev/dsk/c0d0s0 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980000 on Sat Jul  3 17:22:39 2004
/usr on /dev/dsk/c0d0s6 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980006 on Sat Jul  3 17:22:40 2004
/boot on /dev/dsk/c0d0p0:boot read/write/setuid/nohidden/nofoldcase/dev=19a3010 on Sat Jul  3 17:22:37 2004
/proc on /proc read/write/setuid/dev=2e80000 on Sat Jul  3 17:22:39 2004
/etc/mnttab on mnttab read/write/setuid/dev=2f40000 on Sat Jul  3 17:22:39 2004
/dev/fd on fd read/write/setuid/dev=2f80000 on Sat Jul  3 17:22:40 2004
/var on /dev/dsk/c0d0s1 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980001 on Sat Jul  3 17:22:42 2004
/var/run on swap read/write/setuid/xattr/dev=1 on Sat Jul  3 17:22:42 2004
/tmp on swap read/write/setuid/xattr/dev=2 on Sat Jul  3 17:22:44 2004
/opt on /dev/dsk/c0d0s5 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980005 on Sat Jul  3 17:22:44 2004
/export/home on /dev/dsk/c0d0s7 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980007 on Sat Jul  3 17:22:44 2004
/disk2root on /dev/dsk/c0d1s0 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980040 on Sat Jul  3 17:33:35 2004
/disk2swap on /dev/dsk/c0d1s1 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980041 on Sat Jul  3 17:33:45 2004
/disk2home on /dev/dsk/c0d1s3 read/write/setuid/intr/largefiles/xattr/οnerrοr=panic/dev=1980043 on Sat Jul  3 17:33:52 2004
bash-2.05#

将下面的内容添加到/etc/vfstab中即可实现自动挂载
/dev/dsk/c0d1s0 /dev/rdsk/c0d1s0        /disk2root      ufs     1       yes     logging
对其它对应的分区挂载即可

你可能感兴趣的:(Solaris)