Sponsored Content
Full Discussion: Directory csum / cksum
Operating Systems AIX Directory csum / cksum Post 302769140 by MichaelFelt on Monday 11th of February 2013 10:08:24 AM
Old 02-11-2013
The reason it does not work on directories is because a very vital part of a directory entry is the first two bytes which is the inode number of an entry.

The first two entries of a directory are named . and ..
So, if either inode numbers are different csum and/or cksum will report generally report different values.
Code:
od -dc /some/directory

read: octalDump -decimalCharacter /some/directory
This will output two lines for each entry in the directory /some/directory
The first line: first number is the inode number; second line (ignore first two values (are inode number in character notation) - remaining bytes are the file/directory name)
Example:
Code:
michael@x054:[/]ls -lid /x /y
17424 drwxr-xr-x 2 pconsole pconsole 256 May 15  2012 /x
20576 drwxr-x--- 2 root     system   256 Feb 11 16:00 /y
michael@x054:[/]od -dc /x    
0000000   17424   11776       0       0       0       0       0       0
          D 020   .  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020       2   11822       0       0       0       0       0       0
         \0 002   .   .  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000040
michael@x054:[/]od -dc /y    
0000000   20576   11776       0       0       0       0       0       0
          P   `   .  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020       2   11822       0       0       0       0       0       0
         \0 002   .   .  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000040

Hope this helps/explains WHY cksum/csum does not work on directories.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Anyone know how cksum works?

hello all. I'm not asking about the algorithm - or how it goes about computing the checksum - I'm asking how it views/looks at the files it does the cksum on. For instance: Say you had a directory named "dir_A" And within this directory you had some files. So: dir_A - file1 -... (5 Replies)
Discussion started by: kapolani
5 Replies

2. Shell Programming and Scripting

cksum question

Hi there, I have a query about cksum. I'm running a script on the Unix box and in a script the cksum result differs from when I run it manually. As far as I can see the file is not being changed, is there any other times that the cksum would be different. (4 Replies)
Discussion started by: rjsha1
4 Replies

3. Shell Programming and Scripting

The cksum Problem

Hi, I have a working script, well it works on my machine but when I try it on others the cksum section does not work properly (I know the scripting is not of a high quality but I'm just trying to get it working) Heres the script: #!/bin/sh case $# in 0) echo "usage: enshar filename... (7 Replies)
Discussion started by: Dim-Wit
7 Replies

4. Shell Programming and Scripting

using cksum

hi, I am trying to use the cksum feature in unix. when i make a call to it i get returned something along the lines of: 4603435 14 file3 how do i get the first part of this response only; i.e: 4603435 I'm trying to use at a way without the use of sed and creating temp... (4 Replies)
Discussion started by: leeRoberts2007
4 Replies

5. UNIX for Advanced & Expert Users

Cksum dependencies

Hi, On what factors does the cksum depend. If i build 2 machines exactly the same, then can i get the checksum of 2 compiled files same. Thanks (3 Replies)
Discussion started by: vibhor_agarwali
3 Replies

6. Shell Programming and Scripting

EEPROM CKSUM? what is this?

Hi all, So I have a binary file and I need to generate an expected EEPROM checksum for it. Ideally, I would like to input the file (with the path) and output a computed checksum. Ive been using (cksum file1) with no avail and I was just curious as to whether there is such thing as EEPROM cksum,... (1 Reply)
Discussion started by: TeamUSA
1 Replies

7. UNIX for Advanced & Expert Users

cksum for all files in home directory

I know i can run cksum <filename> . However, how i can run cksum on all the files and directories in the $HOME ?? (SUNOS) (4 Replies)
Discussion started by: moe458
4 Replies

8. UNIX for Dummies Questions & Answers

command to find cksum of all files inside a directory?

I did this: ls -lrRt | grep ^* | cksum * but it is showing cksum of sub-directories. Thanks You Please use code tags when posting data and code samples, thank you. (3 Replies)
Discussion started by: ezee
3 Replies

9. Solaris

Cksum read error for directory - Solaris 10

Hi, I am getting read error when i run cksum </dir> but this command runs successfully for the files and in different server it runs for both files and directories. I am using in both the servers solaris 10 with patch 148888-03. Please suggest... # cksum ravi(directory) 3454912345 0... (3 Replies)
Discussion started by: Navkreddy
3 Replies
clri(1M)																  clri(1M)

NAME
clri - clear inode SYNOPSIS
special i-number ... DESCRIPTION
The command clears the inode i-number by filling it with zeros. special must be a special file name referring to a device containing a file system. For proper results, special should not be mounted (see WARNINGS below). After is executed, all blocks in the affected file show up as "missing" in an of special (see fsck(1M)). This command should only be used in emergencies. Read and write permission is required on the specified special device. The inode becomes allocatable. WARNINGS
The primary purpose of this command is to remove a file that for some reason does not appear in any directory. If it is used to clear an inode that does appear in a directory, care should be taken to locate the entry and remove it. Otherwise, when the inode is reallocated to some new file, the old entry in the directory will still point to that file. At that point, removing the old entry destroys the new file, causing the new entry to point to an unallocated inode, so the whole cycle is likely to be repeated again. If the file system is mounted, is likely to be ineffective. DEPENDENCIES
operates only on file systems of type SEE ALSO
fsck(1M), fsdb(1M), ncheck(1M). STANDARDS CONFORMANCE
clri: SVID2, SVID3 clri(1M)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy