- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Corruption of a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 01:53 AM
09-06-2005 01:53 AM
Corruption of a file
I would like to have some hints on this problem.I had a binary file in which all the zeros (0) are missing(!).We never saw a corruption like that.
Comparing the Good file againt the corrupted one we discovered that the two files are equivalent except for the fact that within the Bad file
all the zeros (0) are missing.
Our correct file had record has a fixed size of 512 bytes. Since the
record space is not completely used, there is some field that is set to
0 (zero).
The corruption of this file is evident but we cannot figure out who or what on HP11i can cause it (I dont' consider the fact that intentionally caused it) We simulate this opening the binary file with the vi and then save it with wq!. On this machine there is Openview and also Data protector HP. 11.11i.
Do you have any idea on that ?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:00 AM
09-06-2005 02:00 AM
Re: Corruption of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:03 AM
09-06-2005 02:03 AM
Re: Corruption of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:05 AM
09-06-2005 02:05 AM
Re: Corruption of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:11 AM
09-06-2005 02:11 AM
Re: Corruption of a file
xd -vxc file1 > file1.txt
xd -vxc file2 > file2.txt
You can safely edit file1.txt/file2.txt with vi as they will be text files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:13 AM
09-06-2005 02:13 AM
Re: Corruption of a file
how did you get the 0-less file?
Did you compile it on your server?
Or did you transfer it from another server ( via rcp, ftp or someother ) ?
Regards,
Alessandro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:18 AM
09-06-2005 02:18 AM
Re: Corruption of a file
where the file came from? Did the size changed before or after you used vi? vi can't work with a binary file and *will* corrupt it! You can't simulate open a binary file with vi - try "strings" instead to show some "readable" content.
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:24 AM
09-06-2005 02:24 AM
Re: Corruption of a file
Running 'vi' on a file with nulls (binary zeros) will remove the NUL characters.
# dd=if /dev/zero of=/tmp/myfile count=2
# echo "theend" >> /tmp/myfile
# ls -l #...shows size of 1031 characters
# vi /tmp/myfile #...and simply do wq!
# ls -l # ...size is now 7 characters including newline at end.
Doing other operations on binary files with standard TEXT-oriented filters is also dangerous. 'sed' could also have corrupted your file too if the output of a substitution, for instance, was renamed to your original file. The NUL characters are stripped, too.
Regards!
...JRF...
# sed
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:41 AM
09-06-2005 02:41 AM
Re: Corruption of a file
We don't use vi against this file.
We perfectly knows what vi can do on a binary file.
BUT our customer reports us a problem in which our Application was down.
When I saw the application file that our Application used to work this *file* is corrupted in the way I explain before.
So we need to understand what could cause this.
We *simulate* this corruption using the vi but our customer told us that they don't do vi on this file.
We are trying to figure out what else on HP 11i can cause the same corruption because we know that our Application cannot do that.
Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 03:01 AM
09-06-2005 03:01 AM
Re: Corruption of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 03:19 AM
09-06-2005 03:19 AM
Re: Corruption of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 04:31 AM
09-06-2005 04:31 AM
Re: Corruption of a file
However, it seems that the application is indeed accessing the undefined space, and standard Unix behavior is to supply a string of nulls for the undefined space. You can verify this with a simple cp of the file. When you cp the file, it is accessed serquentially and the filesystem code supplies a stream of nulls for records 2 through 499.
Now your application *may* set the unused fields to nulls and the occupied space is exactly the same whether records have non-null characters or not. In that case, a cp of the file will produce the same result, but certain backup programs will attempt to minimize occupied space by turning sequential null records into sparse pointers. fbackup has this as an option (not default). Check with Data Protector documents about sparse file optimization.
A core file from a crashed program is often a sparse file which you can see by copying the core file and comparing the two sizes with ll. Or you can create a sparse file like this:
$ dd if=/etc/issue bs=1 oseek=999999 count=1 of=/tmp/sparse.test
1+0 records in
1+0 records out
$l /tmp/sparse.test
-rw------- 1 root sys 1000000 Sep 6 11:11 /tmp/sparse.test
$du /tmp/sparese.test
16 /tmp/sparse.test
If you run the dd command without any options (dd if=/etc/issue of=/tmp/sparse.test) then du won't change (occupied space) but ll will drop to just a few dozen bytes (actual records).
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 07:18 AM
09-06-2005 07:18 AM
Re: Corruption of a file
Thx!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 07:53 AM
09-06-2005 07:53 AM
Re: Corruption of a file
od and/or hd are much better tools for examining binary data but NO tools other than those which can look at the filesystem itself can know about sparse data.
If it makes you feel better, you can blame sparse files but I will stick with my bad code hypothesis.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:33 AM
09-06-2005 08:33 AM
Re: Corruption of a file
Now in your description, you say that the record is not complete, that is, it is 512 bytes long but a portion of the record is undefined or not used. Now we are right in the middel of the application code. If 512bytes of data were read, then there must be something in every byte location. I suspect that the method to define or show the content of the record is incorrect. The filesystem knows nothing about data inside records--all of that is defined by the application.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 08:49 AM
09-06-2005 08:49 AM
Re: Corruption of a file
The corruption is evident also because the orginal (good file) was of like 2mb.
When the corruption occurred it was 500k.
The zeros are not more there.
We had different records of 512 bytes each and part of this 512 were written with significant data.
Our Application write/read on this file each time 512 bytes (not less!) but our file always grows (in this case it decrease of size) because we wrote on them;
Some other part of 512 are not used and they are filled with zeros.
In the whole file, in each 512 records, the zeros are not more there!
The file was significant smaller that the original one and the zeros are not more there. We also verify this situation using HexComp a plug-in of Beyondcompare.
We don't do any action that can cause that the file will be more smaller of the original one.
What I saw using HexCoomp
is that on each of 512 records of this file the zeros are not more there.
We don't do that from code point of view.
Thx!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2005 02:13 PM
09-06-2005 02:13 PM