Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OS block size 1

Status
Not open for further replies.

lweng

Technical User
May 18, 2001
113
US
Which command is used to check OS block size and how to set OS block size on unix? Thanks.
 
You can check a filesystem logical block size with:
"df -g", e.g for a "/data" filesystem with aprox 1GB:
# df -g /data
/data (/dev/dsk/c0t1d0s0 ):8192 block size 1024 frag size
2036764 total blocks 2036746 free blocks
2016380 available 251008 total files
251004 free files
8388616 filesys id ufs fstype 0x00000004 flag
255 filename length

logical block size of /data is 8192 bytes or 8k, note that total blocks in df are in physical blocks, (512 bytes size):

2036704/2 = 1018352*1024 = 1042823168 bytes

also note that blocks in fsck are logical, except frags and used blocks i.e:
# umount /data
# fsck /data
** /dev/dsk/c0t1d0s0
** Last Mounted on /data
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 9 used, 1018373 free (21 frags, 127294 blocks, 0.0% fragmentation)

127294*8192=1042792448+(21+9)*1024=1042823168 bytes
21+9 is frag + used (used and frag size is 1024 bytes) as "df -g" shows for frag size.

You can change logical block size for a ufs filesystem in Solaris with "-b" flag in newfs command (when you create a new filesystem), however note that Solaris sun4u architecture does not support the 4096 block size.

Hope this helps.

Regards,

Carlos Almeida,
 
Thanks your reply Carlos, what is the relationship between logical blocks and physical blocks? Why (2036704/2)*1024 and not 2036704*512? What is difference between '2036746 free blocks' and '127294 blocks'? To me they are both free blocks, and why one times 1024 and the other times 8129? Thanks again.
 
Because df shows blocks as 512 bytes, in "df -g" option to put in kbytes is /2, e.g 2 512 bytes blocks = 1 kbyte then to but in bytes * 1024, so in your example we have a "/data" with aprox. 1GB, df -g shows that logical block size is 8192 bytes, but to misleading us :) shows total blocks in 512 bytes blocks, so to convert in bytes and to get your 1GB we first put in Kbytes:
2036704/2 = 1018352 Kbytes (because 2 blocks is 1 Kbyte)
then if we want in bytes:
1018352*1024 = 1042823168 bytes (aprox. your 1GB) or the total size of "/data" in your example.

then the other example uses "fsck" on same filesystem "/data" aprox 1GB, but fsck is also confuse ...
because shows free blocks as logical blocks ! we already kwon from "df -g" that logical block size for "/data" is 8192 bytes (8K), so in fsck example reports 127294 free blocks:
127294*8192=1042792448 bytes

but in my first replay I want to show you the missing space ! because from "df -g" we get for "/data" 1042823168 bytes and from "fsck" we get 1042792448 so where is the missing 30720 bytes ! if you note from "df -g" output is show frag size as 1024 bytes and fsck reports 21 frags so 21*1024=21504 bytes, but 30720-21504=9216 bytes, but fsck also reports 9 blocks used because used blocks in fsck are in 1024 bytes (frag size) ! 9*1024 = 9216 !

Hope it helps

Regards,

Carlos Almeida




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top