1822736 Members
3846 Online
109644 Solutions
New Discussion юеВ

FileDisk map location

 
Keith Tyson
New Member

FileDisk map location

I am trying to write a script that will let map what files are on what disks, % of file/disk, size of file... But I'm not sure what utility is used in HP-UX to discover the location of a file. On AIX it's 'fileplace'... Can anyone point me in the right dirrection? Thanks very much for any assistance
10 REPLIES 10
Rick Garland
Honored Contributor

Re: FileDisk map location

Don't believe one exists. If I am reading the post correctly, you are talking one long out put.

What may help is a utility called "locate" Same thing as doing find on the system for all files and redirecting into a file. As for size/usage, etc. that will probably be up to the script you are writing. I would think it is a very CPU intensive application.

Re: FileDisk map location

Keith:

Have you tried using the 'find' command similar to the following:


find . -name filename -exec ll {} ;

This will locate the filename and perform a long listing of it (including file size). You can then extract the file size using 'awk' or 'cut', e.g.

find . -name filename -exec ll {} ;|awk '{print $5}'

I hope this helps.

Patrick Wessel
Honored Contributor

Re: FileDisk map location

Keith,
Maybe the df command can help you. It reports the number of free file system disk blocks, but the output contains the name of the file system.

example:
#df wtmp
/var (/dev/vg00/lvol8): 899572 blocks 119866 i-nodes
There is no good troubleshooting with bad data
Andy Monks
Honored Contributor

Re: FileDisk map location

The 'du' command might help.

something like 'du -k /'
Keith Tyson
New Member

Re: FileDisk map location

find & du only let me know the location of the file in relationship to the volume or file system. I'm trying to write a script that will tell me which disk or disks a file actually resides on. In AIX there is a add-on utility calle 'fileplace'. Among other things, it tells the location of the file in relationship to the disks and how that files is stripped.
Rick Garland
Honored Contributor

Re: FileDisk map location

I would have to say that you can do your search by filesystem, get the LVM info for that filesystem, then do the lvdisplay, vgdisplay, pvdisplay on the filesystem. The use of these commands will provide the info you are seeking.

There are scripts available out there (in this forum for example) that will detail the mirroring and stripping info but these do not go to the file level. I would question why going to the file level to find the stripping setup? It isn't necessary by the file, do it by the logical volume or the volume group.
Andreas Voss
Honored Contributor

Re: FileDisk map location

Hi,

i have written (quick and dirty) a C programm
that does something like fileplace.
Look at the attachment.

Cheers

Andrew
Andy Monks
Honored Contributor

Re: FileDisk map location

du has an -x option that only reports on a specific device (so lvol) and find can do the same.

as both find and du will report the full path name it wouldn't be impossible to do it by filesystem.
Andy Monks
Honored Contributor

Re: FileDisk map location

also something like utree http://hpux.cs.utah.edu/ftp/hpux/Users/utree-3.4/ might be ok

or even better might be vtree :- http://hpux.cs.utah.edu/ftp/hpux/Users/vtree-1.0/
Patrick Wessel
Honored Contributor

Re: FileDisk map location

I'm not sure what you are looking for. But this is a solution to what I understood. It prints an lvdisplay of the lvol the file belongs to. And the lvdisplay contains the divice file of the disk..:

lvdisplay -v ` df -n $FILE_YOU_ARE_LOOKING_FOR | awk '{print $2}' | tr -d "("` | awk '{print $2}' | grep /dev/dsk


It's not really nice... but maybe it helps
There is no good troubleshooting with bad data