Solved

Physical device of file

Posted on 2004-03-24
5
386 Views
Last Modified: 2013-12-06
Hi Everyone,

Could anyone tell me which command will tell me which physical device a file resides on?

In particular, I have a database sitting on a SAN, and I want to see which disks different database files reside.

Thanks!
0
Comment
Question by:marcus78
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Alf666
ID: 10670893
df <filename>

This will give you the Filesystem in the first column.
This is not df's main use, but it works pretty well.
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 10671566
df will tell you the filesystem, but not the physical device.

Once you've got the filesystem from df, you can get the /dev device the filesystem is mounted on using the mount command.

Sometimes this will tell you the phyical device (/dev/sda3).

Sometimes this will tell you a logical device and you'll have to keep digging (/dev/vx/dsk/rootdg/lv_home). How you get the physical device from the logical device varies widely from one Unix flavor to another, from one version to another of the same flavor, etc.
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10671634
chris, I don't know which system you're using, but, yes, df will give you the filesystem on most UNIXes :

> df .bashrc

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2             19036436   3672780  15363656  20% /
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 10671688
Oops, you're right, most df's will give you the device these days.
Still need to deal with logical volumes, though.
0
 
LVL 20

Accepted Solution

by:
tfewster earned 125 total points
ID: 10671692
Which Unix?  Alf666 has given you the first part; The next step is to work out what LUNs/ disks the filesystem uses.  Assuming you're using journalled filesystems based on Veritas volume manager, work out what logical volume the filesystem is on, then what logical disks the logical volume uses.  Under HP-UX you'd use "lvdisplay -v /dev/vg_name/lv_name" - See http://bhami.com/rosetta.html#files  for hints as to the commands for other Unixen.

Finally, you need use your SAN management tools to work out what physical disks those logical disks are made up of, e.g. slices of a RAID 5 set. Then you're in a position to be able to predict hotspots and move data around on the disk array to improve performance.  Bearing in mind that the cache on a disk array and buffer caching on the Unix server will mask and ease the load on a particular spindle...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now