Thursday 5 March 2020

Solaris 10 PART-I basics(devices/formating/FileSystems/mounting/unmounting)


====Solaris 10 PART-I basics(devices/formating/FileSystems/mounting/unmounting)====

bash-3.2# cat /etc/release
                    Oracle Solaris 10 1/13 s10x_u11wos_24a X86
  Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
                            Assembled 17 January 2013
bash-3.2#
bash-3.2# uptime
  3:41pm  up 55 min(s),  1 user,  load average: 0.04, 0.04, 0.05
bash-3.2#
bash-3.2# uname -a
SunOS solaris10node1 5.10 Generic_147148-26 i86pc i386 i86pc


Device Names:-
logical names:(/dev)
/dev/dsk/c1t0d0s0

physical names:(/devices)
/devices/pci@0,0/pci1000,8000@14/sd@0,0:a

instance names:
bash-3.2# ls -l /etc/path_to_inst
-r--r--r--   1 root     root         987 Feb 25 14:57 /etc/path_to_inst




bash-3.2# prtconf |grep -v not
System Configuration:  Oracle Corporation  i86pc
Memory size: 2048 Megabytes
System Peripherals (Software Nodes):


bash-3.2# prtdiag -v|more


#sysdef
*
* Hostid
*
  35c0c98c
*

to see disks:-
bash-3.2# echo|format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <ATA    -VBOX HARDDISK  -1.0  cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci8086,2829@d/disk@0,0
       1. c1t0d0 <VBOX-HARDDISK-1.0 cyl 1019 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,8000@14/sd@0,0
       2. c1t1d0 <VBOX-HARDDISK-1.0 cyl 680 alt 2 hd 64 sec 48>
          /pci@0,0/pci1000,8000@14/sd@1,0
       3. c1t2d0 <VBOX-HARDDISK-1.0 cyl 680 alt 2 hd 64 sec 48>
          /pci@0,0/pci1000,8000@14/sd@2,0
       4. c1t3d0 <VBOX-HARDDISK-1.0 cyl 680 alt 2 hd 64 sec 48>
          /pci@0,0/pci1000,8000@14/sd@3,0
       5. c1t4d0 <VBOX-HARDDISK-1.0 cyl 2387 alt 2 hd 128 sec 48>
          /pci@0,0/pci1000,8000@14/sd@4,0
Specify disk (enter its number): Specify disk (enter its number):


to check processor

bash-3.2# psrinfo -v
Status of virtual processor 0 as of: 03/03/2020 16:00:50
  on-line since 03/03/2020 14:47:06.
  The i386 processor operates at 2000 MHz,
        and has an i387 compatible floating point processor.


to offline/onlie Processor threads

bash-3.2# psradm -f 0
psradm: processor 0: Device busy
bash-3.2# psradm -n 0


to scan devices dynamically:
bash-3.2# devfsadm
bash-3.2# devfsadm -c disk
bash-3.2# devfsadm -c tape
bash-3.2# devfsadm -c audio
bash-3.2# devfsadm -i sd
bash-3.2# devfsadm -i st
devfsadm: driver failed to attach: st
bash-3.2# devfsadm -v

To reconfigure reboot
touch /reconfigure
reboot server


# prtvtoc /dev/rdsk/c1t0d0s2

* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      0    00          0    204800    204799   /mount1
       1      0    00     204800    204800    409599
       2      5    01          0   2086912   2086911
       3      0    00     409600    204800    614399
       4      0    00     614400    204800    819199
       5      0    00     819200    204800   1023999
       8      1    01          0      2048      2047


bash-3.2# prtvtoc /dev/rdsk/c1t1d0s2
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       2      5    01          0   2086912   2086911
       8      1    01          0      2048      2047


bash-3.2# prtvtoc /dev/rdsk/c1t0d0s2|fmthard -s - /dev/rdsk/c1t1d0s2

* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      0    00          0    204800    204799
       1      0    00     204800    204800    409599
       2      5    01          0   2086912   2086911
       3      0    00     409600    204800    614399
       4      0    00     614400    204800    819199
       5      0    00     819200    204800   1023999
       8      1    01          0      2048      2047




To label multiple disks:-

for i in `cat disks`
do
format $i <<EOF
l
y
q
EOF
done

bash-3.2# format c1t4d0 <<EOF
> l
> y
> q
> EOF


File systems:-
ufs
hsfs
devfs
swapfs
zfs
tmpfs
fdfs
procfs
objfs
ctfs



bash-3.2# fstyp /dev/dsk/c1t0d0s0
ufs

bash-3.2# mount -v
/dev/dsk/c0t0d0s0 on / type ufs read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=840000 on Tue Mar  3 17:08:59 2020

to create VXFS:-

bash-3.2# mkfs -F vxfs /dev/rdsk/c1t0d0s0
    version 7 layout
    204800 sectors, 102400 blocks of size 1024, log size 1024 blocks
    largefiles supported
bash-3.2# fstyp /dev/rdsk/c1t0d0s0
vxfs
bash-3.2#

To create ufs:-

bash-3.2# newfs /dev/rdsk/c1t0d0s0
newfs: construct a new file system /dev/rdsk/c1t0d0s0: (y/n)? y
/dev/rdsk/c1t0d0s0:     204800 sectors in 100 cylinders of 64 tracks, 32 sectors
        100.0MB in 7 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 32832, 65632, 98432, 131232, 164032, 196832,

bash-3.2# fstyp /dev/rdsk/c1t0d0s0
ufs
bash-3.2#


Tune fs:-

bash-3.2# newfs -m 10 /dev/rdsk/c1t4d0s2
newfs: construct a new file system /dev/rdsk/c1t4d0s2: (y/n)? y
/dev/rdsk/c1t4d0s2:     14665728 sectors in 2387 cylinders of 128 tracks, 48 sectors
        7161.0MB in 141 cyl groups (17 c/g, 51.00MB/g, 6208 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 104528, 209024, 313520, 418016, 522512, 627008, 731504, 836000, 940496,
 13682864, 13787360, 13891856, 13996352, 14100848, 14205344, 14309840,
 14414336, 14518832, 14623328
bash-3.2# mount /dev/dsk/c1t4d0s2 /mount1
bash-3.2# df -h /mount1
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t4d0s2      6.9G   7.0M   6.2G     1%    /mount1
bash-3.2#
bash-3.2#
bash-3.2# tunefs -m 1 /dev/rdsk/c1t4d0s2
minimum percentage of free space changes from 10% to 1%
bash-3.2#
bash-3.2# df -h /mount1
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t4d0s2      6.9G   7.0M   6.8G     1%    /mount1

to check File System Consistency.

bash-3.2# fsck /dev/dsk/c1t4d0s2
** /dev/rdsk/c1t4d0s2
** Last Mounted on /mount1
** 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, 7213988 free (12 frags, 901747 blocks, 0.0% fragmentation)

bash-3.2# fsck -o f,p /dev/dsk/c1t4d0s2
/dev/rdsk/c1t4d0s2: 2 files, 9 used, 7213988 free (12 frags, 901747 blocks, 0.0% fragmentation)


bash-3.2# fstyp /dev/dsk/c1t4d0s2
ufs
bash-3.2#


bash-3.2# du -sh /
 7.7G
bash-3.2# quot -af
/dev/rdsk/c0t0d0s0 (/):
6929244 252909  root
32318     393   bin
  780      44   uucp
  328       1   #1019604
  201      10   adm
  138       3   svctag
  131      16   noaccess
   13      13   lp
   11      14   nobody
    8       8   postgres
    4       4   #4237
    4       4   daemon
    2       2   gdm
    2       2   smmsp
    2       2   webservd
/dev/rdsk/c1t0d0s0 (/mount1):
    9       2   root
bash-3.2#

bash-3.2# quot -f /dev/rdsk/c1t0d0s0
/dev/rdsk/c1t0d0s0:
    9       2   root



AWK:-
bash-3.2# cat /tmp/passwd|awk -F":" '{if (NR==3) print}'
     3  bin:x:2:2::/usr/bin:

bash-3.2# cat /tmp/passwd|awk -F":" '{if (NR%3) print}'
     1  root:x:0:0:Super-User:/:/sbin/sh
     2  daemon:x:1:1::/:
     4  sys:x:3:3::/:
     5  adm:x:4:4:Admin:/var/adm:
     7  uucp:x:5:5:uucp Admin:/usr/lib/uucp:
     8  nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
    10  listen:x:37:4:Network Admin:/usr/net/nls:
    11  gdm:x:50:50:GDM Reserved UID:/:
    13  postgres:x:90:90:PostgreSQL Reserved UID:/:/usr/bin/pfksh
    14  svctag:x:95:12:Service Tag UID:/:
    16  nobody:x:60001:60001:NFS Anonymous Access User:/:
    17  noaccess:x:60002:60002:No Access User:/:

ash-3.2# cat /tmp/passwd|awk -F":" '{if (!NR%3) print}'
     3  bin:x:2:2::/usr/bin:
     6  lp:x:71:8:Line Printer Admin:/usr/spool/lp:
     9  smmsp:x:25:25:SendMail Message Submission Program:/:
    12  webservd:x:80:80:WebServer Reserved UID:/:
    15  unknown:x:96:96:Unknown Remote UID:/:
    18  nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:

mounting:-
bash-3.2# mount -o ro /dev/dsk/c1t0d0s0 /mount1
bash-3.2# cd /mount1/
bash-3.2# ls
lost+found
bash-3.2# touch a b c
touch: cannot create a: Read-only file system
touch: cannot create b: Read-only file system
touch: cannot create c: Read-only file system
bash-3.2# cd
bash-3.2# mount -o remount,rw /dev/dsk/c1t0d0s0 /mount1
bash-3.2# cd /mount1
bash-3.2# touch a b c
bash-3.2# ll

bash-3.2# ls -l
total 16
-rw-r--r--   1 root     root           0 Mar  5 17:47 a
-rw-r--r--   1 root     root           0 Mar  5 17:47 b
-rw-r--r--   1 root     root           0 Mar  5 17:47 c
drwx------   2 root     root        8192 Mar  3 17:43 lost+found

bash-3.2# mount|grep mount1
/mount1 on /dev/dsk/c1t0d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=840080 on Thu Mar  5 17:47:06 2020
bash-3.2# mount -o remount,nolargefiles /dev/dsk/c1t0d0s0 /mount1
bash-3.2# mount|grep mount1
/mount1 on /dev/dsk/c1t0d0s0 read/write/setuid/devices/rstchown/intr/nolargefiles/logging/xattr/onerror=panic/dev=840080 on Thu Mar  5 17:49:15 2020
bash-3.2#

bash-3.2# cat /etc/default/fs
LOCAL=ufs
bash-3.2# cat /etc/dfs/fstypes
nfs NFS Utilities
autofs AUTOFS Utilities
cachefs CACHEFS Utilities
bash-3.2#
bash-3.2# cat /etc/vfstab
#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      -

to mount CDrom:
bash-3.2# mount -F hsfs -o ro /dev/dsk/c0t0d0s0 /cdrom

bash-3.2# umountall
bash-3.2# df -h|tail
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   3.1G   1.1M   3.1G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
fd                       0K     0K     0K     0%    /dev/fd
swap                   3.1G    36K   3.1G     1%    /tmp
swap                   3.1G    32K   3.1G     1%    /var/run
bash-3.2#
bash-3.2#
bash-3.2# mountall
/dev/rdsk/c1t0d0s0 is clean
mount: /tmp is already mounted or swap is busy
bash-3.2#
bash-3.2#
bash-3.2# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      9.9G   6.7G   3.1G    69%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   3.1G   1.1M   3.1G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
fd                       0K     0K     0K     0%    /dev/fd
swap                   3.1G    36K   3.1G     1%    /tmp
swap                   3.1G    32K   3.1G     1%    /var/run
/dev/dsk/c1t0d0s0       93M   1.0M    83M     2%    /mount1

bash-3.2# fuser -cu /
bash-3.2# fuser -ck /mount1
bash-3.2# fuser -cu /


To correct /etc/vfstab file
#bash# fsck /dev/rdsk/c1t0d0s0
#mount /dev/dsk/c1t0d0s0 /a
#TERM=vt100
#export TERM
#vi /etc/fstab
remove unwanted entry
:wq!

#cd /

#umount /a

#init 6

Volume Mgt:-
bash-3.2# svcs volfs
STATE          STIME    FMRI
online         17:35:03 svc:/system/filesystem/volfs:default
bash-3.2# svcadm restart volfs
bash-3.2# svcs volfs
STATE          STIME    FMRI
online         18:04:48 svc:/system/filesystem/volfs:default
bash-3.2#
bash-3.2# /etc/init.d/volmgt stop
bash-3.2#
bash-3.2# svcs volfs
STATE          STIME    FMRI
disabled       18:05:05 svc:/system/filesystem/volfs:default
bash-3.2#
bash-3.2# /etc/init.d/volmgt start
volume management starting.
bash-3.2#
bash-3.2# svcs volfs
STATE          STIME    FMRI
online         18:05:18 svc:/system/filesystem/volfs:default
bash-3.2#