[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Matching file to a physical medium
On Thu 14 Oct 2010 at 03:10:08 PM +0100, Sad Clouds wrote:
>On Thu, 14 Oct 2010 14:49:12 +0100
>Sad Clouds <cryintothebluesky%googlemail.com@localhost> wrote:
>> Hi, does anyone know if there is a way to match a file to a particular
>> physical medium, such as a disk.
>> With the help of stat(2) I can get st_dev for this file, but st_dev is
>> unique for each file system, even if those file systems reside on the
>> same physical disk. What I need is something that can uniquely
>> identify a physical disk.
>> Any ideas?
>OK never mind, I think there is a better solution:
>Let the user partition mounted file systems into zones, this way NFS
>mounted file systems can be aggregated into one zone, local file systems
>into another zone. Each zone is serviced by a it's own set of threads.
>This way asynchronous I/O on slow NFS will not delay I/O on faster
I don't completely follow your situation; but I generally avoid
nested mounts for a variety of reasons. Your I/O issue may be one
of them, if I follow correctly.
In any event, here is a multi-step process to identify the device
of a file.
Compare the file stat output with mount -v, you will need some
hex/decimal conversion. When you match the fsid, get the device
from that line. If you are doing this as a NFS client, you have
special challenges. :)
Whenever I provision a disk I sharpie YYMMx on it, label the
outside of the box with it and put that same value in the label
field of the disklabel. If it happens to be a data partition I
mount it with that name too. Gives me a unique identifier of the
media. So, I know 1002a was the first disk I put in service
February 2010. To verify the backup directory bk0804b is on that
eval $(stat -s /1002a/bk0804b) ; mount -v | grep $(printf '0x%x' $st_dev) | awk
sudo disklabel wd1e 2>/dev/null | grep label
Unix filesystems are not designed to do this efficiently (map
inode to path/device), so it's a convoluted process. FWIW, I
always use hostname/realpath of the nfs server in my nfs mounts,
keeps everyone on the same page.
Main Index |
Thread Index |