Solved

Physical device of file

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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 …
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.:
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.

840 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