Solved

Physical device of file

Posted on 2004-03-24
5
394 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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

688 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