Sponsored Content
Full Discussion: structure of regular file
Top Forums UNIX for Dummies Questions & Answers structure of regular file Post 11871 by Perderabo on Thursday 13th of December 2001 09:38:15 AM
Old 12-13-2001
I dug out my copy of Bach last night and reviewed chapter 4, "Internal Representations of Files". My copy of Bach is from 1986, you may have a newer version. My copy is describing Ken Thompson's original unix filesystem. This filesystem was a commercial failure and I doubt if it is still used anywhere. Section 4.1.2 "Accessing Inodes" describes how all the inodes are together. This caused massive arm movement because the heads had to repeatedly access the inode list at the start of the disk.

Marshall McKusick wrote a much better filesystem which he called the Berkeley Fast File System. It really conquered the commercial world. HP-UX calls it hfs and SunOS calls it vfs. It has large blocks, cylinder groups, distributed inodes, bitmaps of free blocks rather than a single free list, blocks/fragments, long filenames and symbolic links. If your copy of Bach is not describing this filesystem, you may be confusing yourself. In this case, I would suggest switching to a more modern book.

But the block pointers in an inode have not changed very much. My book's figure 4.6 is similiar to the diagram on this page. Let's say that your file had the following 15 data blocks assigned to it: 4096, 228, 45423, 11111, 101, 367, 428, 9156, 824, 747, 4351, 171, 987, 654, and 594. For the first ten block numbers it's easy, they go in slots 0 though 9. But what do we do with the other 5 block numbers? We get another data block, let's assume that we get block 908. We take block 908 and write the numbers 4351, 171, 987, 654, and 594 in it. Then we put 908 in the single indirect slot. When we read the file, we just read the first 10 blocks from the numbers in the inode. The we see that 908 is our single indirect block so we read it. It has the the list of the final five blocks.

I hope this has helped.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

2. UNIX for Dummies Questions & Answers

TAR only the file structure

Hi, I need to tar only the file structures in Unix. I dont want to create the tar with the files in it. I tried to use a find with type -d and xargs the tar. It still tar's the file. Can anybody can help in this? Regards Anand (1 Reply)
Discussion started by: Andysundar
1 Replies

3. Shell Programming and Scripting

using regular expressions in c shell control structure

i cant get around using regular expressions in if/else statements. it simply doesnt give me the right results. i've tried using switch/case but that is just as sh!tty as well. (pardon my french but im getting frustrated with c shell..only reason why im writing in it is because it's a hwk... (3 Replies)
Discussion started by: ballazrus
3 Replies

4. Shell Programming and Scripting

file structure

Hi, Is there a command that can help me to determain a unix file structure ? Thanks (7 Replies)
Discussion started by: yoavbe
7 Replies

5. Programming

Search attributes in one structure using the values from another structure

Hello Groups I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

6. Programming

compare XML/flat file with UNIX file system structure

Before i start doing something, I wanted to know whether the approach to compare XML file with UNIX file system structure. I have a pre-configured file(contains a list of paths to executables) and i need to check against the UNIX directory structure. what are the various approches should i use ? I... (6 Replies)
Discussion started by: shafi2all
6 Replies

7. Shell Programming and Scripting

drop down structure in file

I have file like this 120, rahim, d40 115, rahul, d40 113, begum, d40 I want to group this file like this 120, rahim, d40 115, rahul, 113, begum, can any one help me on this thanks in advance (1 Reply)
Discussion started by: trichyselva
1 Replies

8. Programming

FILE structure - stdio.h

Hi All, I am new to linux and Programming. Inside the file stdio.h, there is a description about FILE structure. Which has many internal data members like _p, _r, _flags etc. I have written a sample code to find out the contents of the FILE structure. It opens a sample file ( FILE *fp ),... (5 Replies)
Discussion started by: nikunjbadjatya
5 Replies

9. Red Hat

Copy certain file types recursively while maintaining file structure on destination?

Hi guys, I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash. I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
Discussion started by: rockf1bull
1 Replies

10. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies
icheck(8)						      System Manager's Manual							 icheck(8)

Name
       icheck - check inode consistency

Syntax
       /etc/icheck [ -s ]  [ -b numbers ] [ filesystem ]

Description
       The command is obsoleted for normal consistency checking by

       The command examines a file system, builds a bit map of used blocks, and compares this bit map against the free list maintained on the file
       system.	If the file system is not specified, a set of default file systems is checked.	The normal output of includes a report of:

       o   The total number of files and the numbers of regular, directory, block special and character special files.

       o   The total number of blocks in use and the numbers of single-, double-, and triple-indirect blocks and directory blocks.

       o   The number of free blocks.

       o   The number of blocks missing, that is, not in any file nor in the free list.

       The option causes to ignore the actual free list and reconstruct a new one by rewriting the super-block of the file system.  The file  sys-
       tem  should  be dismounted while this is done; if this is not possible (for example if the root file system has to be salvaged) care should
       be taken that the system is quiescent and that it is rebooted immediately afterwards so that the old, bad in-core copy of  the  super-block
       will not continue to be used.  Notice also that the words in the super-block which indicate the size of the free list and of the i-list are
       believed.  If the super-block has been curdled these words will have to be patched.  The option causes the normal output reports to be sup-
       pressed.

       Following the option is a list of block numbers; whenever any of the named blocks turns up in a file, a diagnostic is produced.

       The command is faster if the raw version of the special file is used, since it reads the i-list many blocks at a time.

Diagnostics
       For  duplicate  blocks  and  bad  blocks  (which lie outside the file system) announces the difficulty, the i-number, and the kind of block
       involved.  If a read error is encountered, the block number of the bad block is printed and considers it to  contain  0.   `Bad	freeblock'
       means that a block number outside the available space was encountered in the free list.	`n dups in free' means that n blocks were found in
       the free list which duplicate blocks either in some file or in the earlier part of the free list.

Restrictions
       Since is inherently two-pass in nature, extraneous diagnostics may be produced if applied to active file systems.

       It believes even preposterous super-blocks and consequently can get core images.

Files
       Default file systems vary with installation.

See Also
       fs(5), clri(8), dcheck(8), fsck(8), ncheck(8)

																	 icheck(8)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy