Thursday, March 19, 2015

add a disk to solaris 10

 i have a new/old seagate disk that i have just un-bad magic'd.  
 i want it to mount to /opt.  
   
 here's what we need to do:  
   
 detect the disk.  
 # devfsadm  
   
 see if the disk shows up.  
 # ls /dev/rdsk/*s0  
   
 format the disk.  
 # format  
   
 put a ufs fs on the disk.  
 # newfs /dev/rdsk/c1t1d0s0  
   
 check the disk.  
 # fsck /dev/rdsk/c1t1d0s0  
   
 put the disk notation in vfstab/  
 # vi /etc/vfstab  
   
 mount the disk.  
 # mount /opt  
   
 see if the disk is really as big as we think it is.  
 # df -h /opt/  
   
 [root@blackholesun /]# ls /dev/rdsk/*s0  
 /dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0 /dev/rdsk/c1t1d0s0  
   
 [root@blackholesun /]# format  
 Searching for disks...done  
   
 AVAILABLE DISK SELECTIONS:  
     0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>  
      /pci@0/pci@0/pci@2/scsi@0/sd@0,0  
     1. c1t1d0 <SEAGATE-ST9146802SS-S229-136.73GB>  
      /pci@0/pci@0/pci@2/scsi@0/sd@1,0  
 Specify disk (enter its number): 1  
 selecting c1t1d0  
 [disk formatted]  
   
 format> label  
 Ready to label disk, continue? y  
   
 format> partition  
   
 partition> print  
   
 Current partition table (original):  
 Total disk sectors available: 286733062 + 16384 (reserved sectors)  
   
 Part   Tag  Flag   First Sector     Size     Last Sector  
  0    usr  wm        34   136.72GB     286733062  
  1 unassigned  wm         0      0        0  
  2 unassigned  wm         0      0        0  
  3 unassigned  wm         0      0        0  
  4 unassigned  wm         0      0        0  
  5 unassigned  wm         0      0        0  
  6 unassigned  wm         0      0        0  
  8  reserved  wm     286733063    8.00MB     286749446  
   
 partition> 0  
 Part   Tag  Flag   First Sector     Size     Last Sector  
  0    usr  wm        34   136.72GB     286733062  
   
 Enter partition id tag[usr]:  
 Enter partition permission flags[wm]:  
 Enter new starting Sector[34]:  
 Enter partition size[286733029b, 286733062e, 140006mb, 136gb, 0tb]: 286733029b  
   
 partition> label  
 Ready to label disk, continue? y  
   
 partition> quit  
   
 format> quit  
   
 [root@blackholesun /]# newfs /dev/rdsk/c1t1d0s0  
   
 newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y  
 Warning: 1308 sector(s) in last cylinder unallocated  
 /dev/rdsk/c1t1d0s0:   286733028 sectors in 46669 cylinders of 48 tracks, 128 sectors  
     140006.4MB in 2917 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)  
 super-block backups (for fsck -F ufs -o b=#) at:  
  32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,  
 Initializing cylinder groups:  
 ..........................................................  
 super-block backups for last 10 cylinder groups at:  
  285773216, 285871648, 285970080, 286068512, 286166944, 286265376, 286363808,  
  286462240, 286560672, 286659104  
   
 [root@blackholesun /]# fsck /dev/rdsk/c1t1d0s0  
   
 ** /dev/rdsk/c1t1d0s0  
 ** Last Mounted on  
 ** Phase 1 - Check Blocks and Sizes  
 ** Phase 2 - Check Pathnames  
 ** Phase 3a - Check Connectivity  
 ** Phase 3b - Verify Shadows/ACLs  
 ** Phase 4 - Check Reference Counts  
 ** Phase 5 - Check Cylinder Groups  
 2 files, 9 used, 141196195 free (11 frags, 17649523 blocks, 0.0% fragmentation)  
   
 [root@blackholesun /]# vi /etc/vfstab  
 add this line:  
 /dev/dsk/c1t1d0s0    /dev/rdsk/c1t1d0s0   /opt  ufs   2    yes   -  
   
 "/etc/vfstab" 12 lines, 428 characters  
 #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/c1t0d0s0    /dev/rdsk/c1t0d0s0   /    ufs   1    no   -  
 /dev/dsk/c1t1d0s0    /dev/rdsk/c1t1d0s0   /opt  ufs   2    yes   -  
 /devices    -    /devices    devfs  -    no   -  
 ctfs  -    /system/contract    ctfs  -    no   -  
 objfs  -    /system/object objfs  -    no   -  
 swap  -    /tmp  tmpfs  -    yes   -  
 sharefs     -    /etc/dfs/sharetab    sharefs -    no   -  
   
 [root@blackholesun /]# mount /opt  
   
 [root@blackholesun /]# df -h /opt/  
   
 Filesystem       size  used avail capacity Mounted on  
 /dev/dsk/c1t1d0s0   135G  64M  133G   1%  /opt  
   
 yay.  
Post a Comment