so there is no way to know the size occupied by data ?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users so there is no way to know the size occupied by data ?
# 1  
Old 11-08-2007
so there is no way to know the size occupied by data ?

I want to find out how many disk blocks are used by only data (and not metadata) by a file.

But as far as I can tell, if the file has holes, then there is no way to know this.

You can find out the logical size of the file (physical size + hole blocks).
You can get the physical size of the file (data + metadata).
But no matter what calculation you do or whatever program you write, you cannot get the blocks occupied by data.
# 2  
Old 11-08-2007
What metadata are you worried about?

Are you on an XFS system?

What is the actual requirement here?

Quote:
Originally Posted by the_learner
But no matter what calculation you do or whatever program you write, you cannot get the blocks occupied by data.
That cannot be true because a disk file system driver is a program which does calculations.
# 3  
Old 11-08-2007
hmm, I am sorry, by metadata I think I meant Indirect blocks

what I mean is, whatever shell cmds I have to get a file size.. they will give me the total disk space occuiped by the file (data + other stuff). But I want to know whats the space occupied by data only.

ls -ls for example...

Quote:
$ ls -ls temp
104 -rwxr--r-- 1 vqw engr 101300 Nov 7 16:25 temp
Here 104 is the total physical disk space occupied by the file. As far as I understand this includes space occupied by data, metadata, Indirect blocks, (Inode) etc etc...

Sure, a file system level program might be able to give the answer.. but how can a user level program find out the number of data blocks ?

(A program might read the file and calculate the number of blocks read, but if the file has holes.. it will read those too.. )
# 4  
Old 11-08-2007
locate holes in a sparse file.

The most portable solution is "dd" the file into another file and compare the difference, dd will happily write out the full size.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Php number array from max, min, step size mysql data

I want to create a form with data values in a dropdown list. The values in the dropdown list need to be generated on the fly from max, min and increment values contained in a mysql database. Hopefully this makes sense, I really have no idea where to start :confused: Thanks (6 Replies)
Discussion started by: barrydocks
6 Replies

2. Shell Programming and Scripting

Help with script to fully occupied all available cpu

I have long list of file wanna processed by a program: data_1.txt data_2.txt data_3.txt data_4.txt data_5.txt data_6.txt data_7.txt data_8.txt . . data_1_2.txt data_2_2.txt data_3_2.txt data_4_2.txt data_5_2.txt data_6_2.txt . (12 Replies)
Discussion started by: perl_beginner
12 Replies

3. Cybersecurity

Effects on data size during encrypted transfer

Hi There, I wonder if any one can help me. I want to transfer a file from one site to another over an encrypted link. I want to know if there will be any imcrease in the data that will travel on the link? For example, I want to transfer a 1 GB file from one site to another, using an encrypted... (4 Replies)
Discussion started by: ahmerin
4 Replies

4. UNIX for Dummies Questions & Answers

Space occupied by core

Guys, Can some one help me? I need to find the total percent of space occupied by core files on my unix system. I know df -k will give me the percent space utilization for a directory but how do we replicate the space for a file? (3 Replies)
Discussion started by: yabhi_22
3 Replies

5. Shell Programming and Scripting

script to display occupied and non occupied ports in unix

I want to extend this script. This must also be able to show me that a port is already assigned to a service but not running now there must be three different messages port 8949 is open but not listening port 8959 is open port 8999 hasn't been assigned to any service. I know that... (1 Reply)
Discussion started by: charan314
1 Replies

6. Linux

how I can find size of incoming or outgoing data

Hi, I'm using SLES10, I want to know the user size of the data that is downloaded or uploaded the data who connects to the server. In other words, a user utilization of my server in terms of size. Thanks, Kris (1 Reply)
Discussion started by: krisdasword
1 Replies

7. Solaris

Command used for checking space occupied by files & sub-direc's inside a mount in %?

Hi, I want to know the command which can be used for finding the % of disk space occupied by files & sub-folders inside a given mount in Sun Solaris For eg: I have /tmp/ folder when I sat df -k it will give the percentage of space used by /tmp/. Say if I want to see how much % the files &... (2 Replies)
Discussion started by: weblogicsupport
2 Replies

8. Solaris

How to find size of data trasnfered between 2 servers ?

Hi, I have setup 2 Sun Solaris server at my home. I put them in network.. Network is ok. How can I find that how much data is transfered between these 2 servers and on specific port ? Thanks NeeleshG (7 Replies)
Discussion started by: neel.gurjar
7 Replies

9. Programming

How to find out the stack size occupied for a process?

Hi, In Linux how to find out what will be the stack size allocated for a process? Actually i have to fork n number of processess, and will call exec. I will be execing an executable which is already multithreaded and each thread size is defined. My doubt is how to know if the size of the... (2 Replies)
Discussion started by: rvan
2 Replies

10. UNIX for Advanced & Expert Users

Creating data of size

Hello, I need to create 100kb,1000kb,10000kb etc files of no particular substance but I need them a exact size. I think they are .dat's I need but im unsure of the command I issue to create them Any help appreciated :) Mr Pink (4 Replies)
Discussion started by: Mr Pink
4 Replies
Login or Register to Ask a Question