inode = which block


 
Thread Tools Search this Thread
Operating Systems Solaris inode = which block
# 1  
Old 04-21-2004
inode = which block

hiho,

i would like to show my apprentices the auto-defrag/perform mechanism from UFS. new FS, creating new directories, each directory get its own cylinder on the disk. hmm....
they want proofs.....
*embarrassing*
i couldn't remember how to look on which block the inode is linked....
so, please help me to keep my credibility ;-) (or perhabs my hono *hehe*)

thx pressy
# 2  
Old 04-21-2004
I doubt that anyone walks around with those formulas in their head. But all of the macros are in /usr/include/sys/fs/ufs_*.h and you can get the raw data by using "fstyp -v".
# 3  
Old 04-21-2004
what do you mean auto-defrag? as far as i know there is no defraging. if you mean how ufs allocates full block for largefiles first then allocates fragments for small files (i believe anything less then 2gb) first. but ufs does not have a defrag that i know about. you can specifiy what fragment size you want when createing the new fs bu the default is 1kb. each block can be devided into 1,2,4, or 8 fragments.

you might be able to use fstyp -v to figure out which cylinder your inode is on. do find out the inode you can use ls -i.

it wouldnt make much sense if each dir got a whole cylinder because each dir eats up an inode what if you have less inodes then you have cylinders?
# 4  
Old 04-21-2004
Fragmentation in the context of this thread means a file that is scattered over the whole disk so that reading sequentially would be slow. This tends to not happen with the Berkeley filesystem because the file will be kept in one ccylinder group if possible.

There are only a few cylinder groups and each cg would have many inodes.

The allocation policy of the Berkeley filesystem reduces fragmentation enough that no de-fragging is needed.

Part of this policy days that a new directory goes to the least full cg. If you build a filesystem with, say 10 cg's, the root directory will be in cg 0. Now create exactly 9 more directories and each directory should be in a cylinder groups of it's own. This leads to stupid filesystem tricks like positioning a file exactly in the center cg for performance.

Getting the block of an inode is tricky but getting the cg is trivial. You divide the inode number by the inodes-per-cg and ignore the remainder.
# 5  
Old 04-22-2004
use the fsdb (filesystem debugger) .. Use with care Smilie

create a file..

ls -i filename
get inode
say its 3211
fsdb /dev/rdsk/slice_file_is_on
in fsdb use :

0t3211:ino
/(where 3211 is the inode nr of the file)
.?ino
(this will print inode info and the block its pointing to....)
db#0 BLOCKNR
db#1 BLOCKNR

To verify use (will only work on textfiles Smilie )
BLOCKNR:bl
.,50/c
(this will print first 50 chars from block)

to quit the fsdb type
:quit

have fun Smilie

/Peter

Last edited by s93366; 04-22-2004 at 07:21 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Deciding whether to get a buffer cache block or inode block

I was reading a book on UNIX internals "The design of the UNIX Operating system." There are two memory structures that are confusing me: 1) Buffer cache 2) Inode cache My questions are 1) Does a process get both buffer cache and Indoe cache allocated when it opens/creates a file? 2) if no,... (1 Reply)
Discussion started by: sreeharshasn
1 Replies

2. Solaris

inode in solaris

Dear, How can i check inode information in my Solaris box? With Regards, Mjoshi (4 Replies)
Discussion started by: mjoshi87
4 Replies

3. Solaris

how inode works

HI, Just another dummies questions: How i can determine what number of inode to use when creating filesystem? Thanks (4 Replies)
Discussion started by: lamoul
4 Replies

4. AIX

FS inode 58%

Hi Guys, I have this filesystem got big with inode: /dev/hd4 3670016 183664 95% 63705 58% /var I don't know why the system doesn't give alerts on this FS although it's 95% and why the inode is 58%. Any comments will be highly appreciated. Thanks, itik (1 Reply)
Discussion started by: itik
1 Replies

5. Solaris

about inode

how can i see inode table information of a perticler inode.anybody knows pls tell me. Than.Q (3 Replies)
Discussion started by: nag.mi2000
3 Replies

6. UNIX for Dummies Questions & Answers

incore inode

Dear Friend , what is incore inode ? and what is difference between incore inode and inode ????? sanjay (1 Reply)
Discussion started by: sanjaygoyan
1 Replies

7. Filesystems, Disks and Memory

Inode number

as kernel keeps track of user activities on a file by its INODE number and I node table . what is the structure of Inode table. and where does this Inode table mapped into?user space or kernel space? is the Inode Number is fixed for a file till its deletion? thanks (1 Reply)
Discussion started by: compbug
1 Replies

8. Shell Programming and Scripting

INode

hi i am nitin... jus a new kid on the block... my query is... does the concept of region invovle sharin of inodes wen the sticky it is set... eg... if two process share two text regions... wat actually happens thank u (1 Reply)
Discussion started by: nitinsharma_ssn
1 Replies

9. AIX

%Inode used full

Hello I have used 100% of inode in a file system can you increase thie number of inode without backup-make the file system again-restore ? thank you (0 Replies)
Discussion started by: pascalbout
0 Replies

10. Solaris

How to map a disk block to filename/ Inode

Hi, I want to find out a particular disk block belong to which file. in solaris 2.8 Can anyone help. Thanks and Regards Bala (1 Reply)
Discussion started by: Balamurugan
1 Replies
Login or Register to Ask a Question