File size difference when nulling a file

unix

    Next

  • 1. Popen not returning NULL on failure
    Popen is not behaving as per the man page in Solaris 5.8 fptr = popen("exe", "r") Even though , file "exe" does not exist , fptr is not set to NULL. Is there a way that can tell the failure of popen. Even the errono is not set. errono is still 0. Just a message " sh : exe could not be found " is printed when pclose() is called. This time errno is set. Thanks
  • 2. strip for Solaris 9 / Sparc
    Hello Solaris wizards and users. I use Solaris 9 on Sparc. I installed gcc from Companion Software CD, but I have problem with strip. When I use strip my binary won't work because it can't find ELF. I read about that problem and people suggested using original Solaris (Sun?) strip. But where is it? How to find one?
  • 3. /var/spool/pkg
    I fear I have done a foolish thing... Sometime in the past, likely November 2003, I moved /var/spool/pkg from the real /var to another disk and created a link from the real /var/spool/pkg to the directory elsewhere (probably because /var was short of disk space). In the intervening period, I seem to have lost the entire contents of the directory, with the exception of SMClibgcc/ SMCperl/ SMCsamba/ I don't suppose (he said, pathetically hopefully) there's any way of recreating this directory (or rather it's contents), is there? I have no backups that old. Also, rather oddly, pkginfo no longer produces any output at all, not even about the packages that remain in /var/spool/pkg. Why's that? I successfully installed the Solaris 8 Recommended patch cluster a few weeks ago, and I thought that wouldn't work without a valid /var/spool/pkg? patchadd -p no longer works; anubis{root}40: patchadd -p /usr/sbin/patchadd[6]: /var/sadm/pkg: not found grep: can't open */pkginfo grep: can't open */pkginfo /usr/sbin/patchadd[15]: /var/sadm/pkg: not found No patches installed I've done this on two boxes, too. (One an Ultra-2, the other an Ultra-10, both with Sol 8). I suspect I did something dumb in order to get the patch kit to install. Help! -- "Other people are not your property." [email me at huge [at] huge [dot] org [dot] uk]
  • 4. root can't execute chown on NFS mountpoint
    Hi group, today I was made aware of one of my Solaris 9 machines behaving somewhat strangely. A local directory which serves as NFS mountpoint does not let root execute chown: | # ls -l | drwxrwxrwx 3 root root 4096 Oct 13 09:38 GNE | # chown oracle:dba GNE | chown: GNE: Not owner | # Unfortunately I can't umount that share at the moment because the database thereon can't be shut down before next week (I was hoping that if the NFS mount was gone, the chown would work). Is this the regular behavior of a NFS mountpoint? Or am I missing some other detail which would explain this? Mark -- Ich bin ein freier Mensch und werde jetzt von meinen Freiheitsrechten Gebrauch machen - und zwar ausgiebig - natlich nur in dem Rahmen, den Otto Schily mir noch zur Verfung stellt. -- Wolfgang Clement

File size difference when nulling a file

Postby wenglee68 » Thu, 03 Jun 2004 11:52:30 GMT

I'm currently using the > /myfile.log command to reset the file size
to 0 byte. However, this > command does not necessary work for all
logs. Sometimes the file size is not set to 0 instead lots of empty
spaces are pipe into the file instead. When this happen, the file size
show using "ls -l /myfile.log" and "du -sk" show dispute size. Anyone
has any idea why the diff in file size using the 2 different command?

Re: File size difference when nulling a file

Postby Neil W Rickert » Thu, 03 Jun 2004 12:40:26 GMT

 XXXX@XXXXX.COM  (Fetch68) writes:


Most likely there is another program writing to the file, and
remembering a seek position for the next write.  After you truncate
the file, it still seeks to beyond where it last wrote to the file,
resulting in a sparse file as it seeks past unallocated space.


Re: File size difference when nulling a file

Postby Casper H.S. Dik » Thu, 03 Jun 2004 18:42:22 GMT

 XXXX@XXXXX.COM  (Fetch68) writes:


"ls -l" will show the index of the last byte in the file; but since
most are 0s, "du -sk" will show only a few blocks used.

The difference between the behavioru between programs is whether or not
the programs used "O_APPEND" when opening the file; with O_APPEND each write 
is preceeded by a seek(fd, 0, SEEK_END) (pointer repositioned at EOF); without
each write will follow the previous write even if the file was truncated
in between.

Casper
-- 
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

Similar Threads:

1.Size difference when copying a large file in solaris

Hi, Im trying to take a database backup. one of the files is 26 GB. I
am using cp -pr to create a backup copy of the database. after the
copying is complete, if i do du -hrs on the folders i saw a difference
of 2GB.

The weird fact is that the BACKUP folder was 2 GB more than the
original one!

when i did du -hrs * inside each of the 2 folders and compared the
output, i found the culprit. it was a file temp.dbf which was 26 GB on
the source(original) folder and 28 GB in the BACKUP folder. I tried the
copy procedure twice and I am getting the same result.

does anyone have any explanation for this. please let me know. I want
to make sure everything is right here in the copy.

PS:- Solaris SPARC 32 BIT.

Thanks

2.Size difference when copying LARGE file

Hi, Im trying to take a database backup. one of the files is 26 GB. I
am using cp -pr to create a backup copy of the database. after the
copying is complete, if i do du -hrs on the folders i saw a difference
of 2GB.

The weird fact is that the BACKUP folder was 2 GB more than the
original one!

when i did du -hrs * inside each of the 2 folders and compared the
output, i found the culprit. it was a file temp.dbf which was 26 GB on
the source(original) folder and 28 GB in the BACKUP folder. I tried the
copy procedure twice and I am getting the same result.

does anyone have any explanation for this. please let me know. I want
to make sure everything is right here in the copy.

PS:- Solaris SPARC 23 BIT.

Thanks

3.difference between normal file and named pipe file

HI,
        will anyone let me know the differences between the normal unix
file and named pipe file?

Regards

4.all files show differences with Unix files

We are trying to use SourceSafe to manage changes for Unix code. The SourceSafe Database is hosted on a Windows server, if we show the differences for a file that was just checked in it displays the last line as being different but no difference is seen. If I copy the file to a Windows system no difference is shown. I suspect the End-Of-File character is causing the difference. Is there any way to correct or work around this?

5.the difference between binary file and ASCII file

hello,

if I have a unix shell script with permission ---x--x--x,
how can a unix shell detect that it is not an execuable binary 
application and gives an error message  "permission denied"?

Thanks,

Peter

6. Binary File Differences: When Do Differences Matter?

7. Apache proxy server returns empty file (file size 0)

8. Looking for C++ code to get file informations like file size, date created, etc



Return to unix

 

Who is online

Users browsing this forum: No registered users and 19 guest