Solved

Physical device of file

Posted on 2004-03-24
5
393 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 21

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AIX Server 10 95
Convert OverPunch 25 68
remove one line from a file in solaris 8 65
Field name with special character (Ñ) in Oracle 11 185
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

738 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