Sponsored Content
Full Discussion: block size and du output
Top Forums Shell Programming and Scripting block size and du output Post 60135 by zazzybob on Tuesday 11th of January 2005 07:27:46 AM
Old 01-11-2005
Hmm... this confusion is contagious - i'm not too sure I follow you at all! Smilie

I assume from your previous posts you're still using Linux (and therefore GNU ls). I also will assume that you're trying to display file sizes in 512 byte blocks? If so, you don't need to do any calculation - if you run

ls -Rls --block-size=512

you'll get a total block count at the top of each directories' listing - with each files size in 512-byte blocks in the first column of output, e.g.

Code:
$ ls -Rls --block-size=512
.:
total 16
  12 -rw-r--r--    1 zb foogroup     5265 Jan  2 22:34 index.html
   4 -rw-r--r--    1 zb foogroup     2043 Jan 10 14:52 submit_contact.php

So, armed with this, it's fairly easy to grep out the "total"s, and if desired, gain a total block count for the entire tree....

Code:
ls -Rls --block-size=512 | grep "^total" | awk 'BEGIN{c=0} {c+=$2} END{print c}'

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

block size

Hi, Somehow i have forgotten a comand that displays me the block size of the unix filesystem. Can someone letme know this command regards penguin (5 Replies)
Discussion started by: linuxpenguin
5 Replies

2. Filesystems, Disks and Memory

os block size

AIX 4.3.3 How can I find the os block size? How can I change the OS Block Size? When and where does the os block size get set? I am running oracle 8.1.7 and am under the impression I need to set my os block size = oracle block size which is 8k. Any insight on this would be... (1 Reply)
Discussion started by: kburrows
1 Replies

3. Solaris

block size

how do you determine block size for a file system? In solaris 5.8 (3 Replies)
Discussion started by: csaunders
3 Replies

4. UNIX for Dummies Questions & Answers

How to know the OS Block size

Hello Unix guru's I want to check my OS Block size for the Solaris 8 Following is one of the line from df -g command. Can anybody help to interpret the same. /u03 (/dev/vx/dsk/oradg/vol03): 8192 block size 8192 frag size 205463552 total blocks 50433792... (1 Reply)
Discussion started by: Dilippatel
1 Replies

5. UNIX for Dummies Questions & Answers

block size

Hi All, drwxr-xr-x 2 root root 4096 May 31 14:47 test Please let me know here 4096 indicating what? Thanks & Regards, Bache (1 Reply)
Discussion started by: bache_gowda
1 Replies

6. Shell Programming and Scripting

how to make a line BLINKING in output and also how to increase font size in output

how to make a line BLINKING in output and also how to increase font size in output suppose in run a.sh script inside echo "hello world " i want that this should blink in the output and also the font size of hello world should be big .. could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies

7. AIX

Block Size

Hi, I try to change the block size from 512 to 0, but it send this message: 0514-068 Cause not know Can someone help me whith this? (3 Replies)
Discussion started by: Ruben78
3 Replies

8. UNIX for Advanced & Expert Users

Physical disk IO size smaller than fragment block filesystem size ?

Hello, in one default UFS filesystem we have 8K block size (bsize) and 1K fragmentsize (fsize). At this scenary I thought all "FileSytem IO" will be 8K (or greater) but never smaller than the fragment size (1K). If a UFS fragment/blocksize is allwasy several ADJACENTS sectors on disk (in a ... (4 Replies)
Discussion started by: rarino2
4 Replies

9. Red Hat

O/s block size

Hi Guys, I am running Linux 2.6.18-164.el x86_64 how do i check the block size? Thanks in advance... (1 Reply)
Discussion started by: Phuti
1 Replies

10. HP-UX

About Block Size and Fragment Size

Accordingly a lot of manuals - if you have block size 8KB and trying to write a 1KB file to the block, as result you waste 7KB of the block space. But recently I noticed about Fragments of File Block. In same case if you have File Block 8KB and Fragment size 1KB - you can save your block space,... (6 Replies)
Discussion started by: jess_t03
6 Replies
NEWFS_HFS(8)						    BSD System Manager's Manual 					      NEWFS_HFS(8)

NAME
newfs_hfs -- construct a new HFS Plus file system SYNOPSIS
newfs_hfs [-N] [-U uid] [-G gid] [-M mask] [-P] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-D journal-device] [-n node-size-list] [-v volume-name] special newfs_hfs -N partition-size [-U uid] [-G gid] [-M mask] [-P] [-h | -w] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-D journal-device] [-n node-size-list] [-v volume-name] DESCRIPTION
Newfs_hfs builds an HFS Plus file system on the specified special device. Before running newfs_hfs the disk should be partitioned using the Disk Utility application or pdisk(8). The file system default parameters are calculated based on the size of the disk partition. Typically the defaults are reasonable, however newfs_hfs has several options to allow the defaults to be selectively overridden. The options are as follows: -N [partition-size] Causes the file system parameters to be printed out without really creating the file system. If the argument following the -N starts with a decimal digit, it is assumed to be a partition size. The paritition size may be given in decimal, octal (with leading `0'), or hexadecimal (with leading `0x'). The partition size argument can be specified in 512-byte blocks (with a `b' suffix), petabytes (`p' suffix), terabytes (`t' suffix), gigabytes (`g' suffix), megabytes (`m' suffix), or kilobytes (`k' suf- fix). All suffixes indicate binary, not decimal, multipliers (e.g., `1k' is 1024 bytes). If no suffix is specified, the value is assumed to be in bytes; if an illegal suffix is specified, it results in a size of 0 bytes. If the partition size is given, then no special device argument shall be provided. If no partition size is given, then the size of the given special device is used instead, and the special device will not be written to. -U uid Set the owner of the file system's root directory to uid. -G gid Set the group of the file system's root directory to gid. -M mask Specify the octal access permissions mask for the file system's root directory. -P Set kHFSContentProtectionBit in the volume's attributes, which will cause the volume to be mounted with the "protect" option if the kernel supports it. -s Creates a case-sensitive HFS Plus filesystem. By default a case-insensitive filesystem is created. Case-sensitive HFS Plus file systems require a Mac OS X version of 10.3 (Darwin 7.0) or later. -b block-size The allocation block size of the file system. The default value is 4096. -c clump-size-list This specifies the clump and/or initial sizes, in allocation blocks, for the various metadata files. Clump sizes are specified with the -c option followed by a comma separated list of the form arg=blocks. Example: -c c=5000,e=500 a=blocks Set the attribute file clump size. b=blocks Set the allocation bitmap file clump size. c=blocks Set the catalog file clump size. d=blocks Set the data fork clump size. e=blocks Set the extent overflow file clump size. r=blocks Set the resource fork clump size. -i first-cnid This specifies the initial catalog node ID for user files and directories. The default value is 16. -I initial-size-list This specifies the initial size, in allocation blocks, for the various metadata files. Initial sizes are specified with the -I option followed by a comma separated list of the form arg=blocks. Example: -I c=5000,e=500 a=blocks Set the initial attribute file size. c=blocks Set the initial catalog file size. e=blocks Set the initial extent overflow file size. -J [journal-size] Creates a journaled HFS+ volume. The default journal size varies, based on the size of the volume. Appending an 'M' to the journal size implies megabytes (i.e. 64M is 64 megabytes). The maximum journal size is 1024 megabytes. -D journal-device Creates the journal on special device journal-device. -n node-size-list This specifies the b-tree node sizes, in bytes, for the various b-tree files. Node sizes are specified with the -n option fol- lowed by a comma separated list of the form arg=bytes. The node size must be a power of two and no larger than 32768 bytes. Example: -n c=8192,e=4096 a=bytes Set the attribute b-tree node size. c=bytes Set the catalog b-tree node size. e=bytes Set the extent overflow b-tree node size. -v volume-name Volume name (file system name) in ascii or UTF-8 format. SEE ALSO
mount(8), pdisk(8) HISTORY
The newfs_hfs command appeared in Mac OS X Server 1.0 . As of Mac OS X 10.6, this utility no longer generates HFS standard file systems. Mac OS X June 19, 2008 Mac OS X
All times are GMT -4. The time now is 06:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy