Friday, January 3, 2014

How to determine unmounted filesystem in solaris10

www.unixbabuforum.inCould you please tell me the command which shows unmounted filesystem in 

I know the command mountall and umountall which is of different use.. 

My requirement is basically to know the filesystem which are currently not 
mounted on the system... 

www.unixbabuforum.inThere is no such command but you can check from the /etc/vfstab file or you 
should make a script for checking which filesystem is unmounted. 

www.unixbabuforum.inYou've really got a number of options depending upon what kind of volume 
manager you've got installed. Then you have to know what type of file- 
systems your system supports. 

First off, you need to find all of your disks. 

# format < /dev/null 

This gives a listing of all the drives the kernel knows about. 
From a system here: 

0. c3t0d0 <DEFAULT cyl 3892 alt 2 hd 255 sec 63> 
1. c4t0d0 <DEFAULT cyl 30398 alt 2 hd 255 sec 63> 
2. c5t0d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@0,0 
3. c5t1d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@1,0 
4. c5t2d0 <WDC-WD2500JB-00GVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@2,0 
5. c5t3d0 <WDC-WD2500JB-57REA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@3,0 
6. c5t4d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@4,0 
7. c5t5d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@5,0 
8. c5t6d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@6,0 
9. c5t8d0 <WDC-WD2500JB-00EVA0-R001-232.89GB> 
/pci@0,0/pci10de,375@e/pci10b5,8114@0/pci1000, 50c0@8/sd@8,0 
10. c6t0d0 <DEFAULT cyl 30399 alt 2 hd 255 sec 63> 

each of those cNtNdN is a pathname component of a symlink in /dev/dsk. So, 
number 10 in the list is /dev/dsk/c6t0d0. But that's not all. The disk 
can have 
subdivisions (it most assuredly will in an older system), which are the 
suffix s 
and a number 0-... So /dev/dsk/c0t0d0s2 would be the second slice on 
that drive. 

Notice I do not say partitions. Partitions are a PC BIOS nomenclature, 
which refer 
to one of 4 (or more in later PC BIOSs) subdivisions of a disk. Solaris 
these partitions on x86 systems. Solaris' disk subdivisions are called 
slices, thus 
the "s." It's just a name. But you can write a filesystem on a 
partition, and you 
can sub-divide a partition with slices in an x86 Solaris system. Sparcs 
are simpler. 

Now, each of those partitions/slices may or may not have a filesystem on 

There also exists a logical volume manager (the old Solaris DiskSuite) 
which can 
package disks and slices into raid5, mirror, and stripe sets. It can 
also use slices 
for it's own databases. Thus, you need to know whether lvm is in charge 
of any 
of your drives. 

# metastat 

will give you a listing. Here is a sample output: 

d3: Mirror 
Submirror 0: d103 
State: Okay 
Pass: 1 
Read option: roundrobin (default) 
Write option: serial (-S) 
Size: 8498000 blocks (4.1 GB) 

d103: Submirror of d3 
State: Okay 
Size: 8498000 blocks (4.1 GB) 
Stripe 0: 
Device Start Block Dbase State Reloc Hot Spare 
c1t0d0s3 0 No Okay Yes 

d0: Mirror 
Submirror 0: d100 
State: Okay 
Pass: 1 
Read option: roundrobin (default) 
Write option: serial (-S) 
Size: 9712000 blocks (4.6 GB) 

d100: Submirror of d0 
State: Okay 
Size: 9712000 blocks (4.6 GB) 
Stripe 0: 
Device Start Block Dbase State Reloc Hot Spare 
c1t0d0s0 0 No Okay Yes 

Those Submirrors are not interesting to us, only the Mirror devices. To 
the metadevice number to /dev/dsk for d0: e.g. /dev/md/dsk/d0 is where any 
filesystem would be. 

You should look in /etc/vfstab for any that are already set up. I doubt 
that you 
have any that are not, and are not in vfstab. However, you can use 
fsck(1m) to 
test for the presence of a filesystem on a disk slice. 

# fsck -n -o preen /dev/dsk/c6t0d0s1 

Will respond very differently in case there is not a filesystem on a 
slice. This will 
be your main method of looking for UFS filesystems. This works on 
metadisk slices 
as well: 

#fsck -n -o preen /dev/md/dsk/d0 

Now, Symmantec offers a disk manager and filesystem called Veritas. 
You'll have 
to check in your system docs and logs to see if it is installed and so 
forth. I don't 
use it. 

Finally, if you are an up to date Solaris user, you will have ZFS 
filesystems. ZFS 
is a volume manager and filesystem in one. Very cool stuff. Use zpool to 
see if 
you have any volumes under ZFS control. 

$zpool list 

If any show up, you likely have zfs filesystems set up on each pool. The 
pool name 
is the last field of the zpool list. You can just jump straight to: 

$zfs list 

To see whether you have zfs filesystems available. If you do, they are 
very likely 
automatically mounted (and NOT in vfstab,) but you will see them in a df 

$df -h 

/dev/md/dsk/d0 4.6G 3.1G 1.4G 70% / 
/dev/md/dsk/d3 4.0G 1.8G 2.1G 46% /var 

clemens 7.9G 24K 980M 1% /clemens 
clemens/home 7.9G 29K 980M 1% /home 
clemens/home/docs 7.9G 214K 980M 1% /home/docs 
clemens/home/jepeway 7.9G 20M 980M 2% /home/jepeway 
clemens/popstore 7.9G 6.9G 980M 88% /home/popkorn 
clemens/home/scion 7.9G 75M 980M 8% /home/scion 

I've taken the virtual filesystems out of this listing. Note that 
I have both metadisk filesystems and zfs volumes. This system was 
build just as zfs was introduced, and I wanted my root and /var on 
(at the time) the more stable platform. I use this system for the 
examples. All my other systems are ZFS based. 

So, to recap: 

use format to find drives 
use fsck to validate UFS filesytems 
use zpool and zfs to find and list zfs volumes. 

www.unixbabuforum.inyou can take a look on metastat if you have SVM and format command for 
slices, which are not mounted

www.unixbabuforum.inyou have to match output from several commands/files: 

a) pfexec prtvtoc /dev/rdsk/c?[t?]d?s2 (ls -al /dev/rdsk/*c2 to get the 
list of the disks) - that command will show to you all slices on the disk 
b) check /etc/vfstab to see what is mounted from where (you will see 
also which disks ARE in use) 
c) check if other special software keeps disk slices (Veritas, SVM, ZFS 
- maybe slice is in use) 

www.unixbabuforum.inScript to look at /etc/mnttab (system currently mounted filesystems) against /etc/vfstab (system mountable filesystems)

www.unixbabuforum.inWith Extension from Sam Nicholson, even you have to trace the vxprint -htv output and check for fstyp against this and you have to cross verify against /etc/mnttab. 

Am i not sure why you want to find unmounted file systems, because just consider the fact that if we have minimum 25 disks, and even if you are using normal slice based format , you can create 7 * 25 filesystem ( 175 file systems ) . It is absolutley very difficult to go by each and every disk , as we must have the server build records initially how the server has been lived


Post a Comment

Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM