Hi All,
I'm about to move data from an old&creaking NT server to a F230. I was aware that moving to the filer would lead to a space usage increase due to the larger block size (4K as against 512bytes for standard NTFS)
Having searched on NOW, ToolTips and on this list, I bit the bullet and wrote my own script to calculate the space increase.
Problem is that a 'du' on a FreeBSD box shows more blocks being used on the filer than I calculated. It's close, but I'd be interested in finding out what the difference is.
Someone else must have wrote a script like mine to calculate the change. Is the script missing something (an earlier version missed the space allocated to the directories themselves) or is the filer allocating space for something else. How many directory entries can a 4K directory hold? (There's a total of 337 directories in what I'm running the script on) I have a very deep hierarchy to move.
Here's what the script produces when run on a NT 4 SP 3 with a mapped share from a NT 4 SP 3 server.
H:\ta\1.60\
NT FS size 216115.695313 KB (3720 files) Netapp FS size 223892.000000 (56311 blocks) KB increase 7776.304688 KB (3%)
FreeBSD opc007.msc.ie 2.2-BETA_A FreeBSD (I know, I know, but it's a production box that was up for 80 days before the power went off and on and off and on again)
NFS mounted F230 running 4.3.3
opc007:1011#pwd /toaster/releases/ta/1.60 opc007:1012#set | grep BLOCK BLOCKSIZE=4096 opc007:1013#du -s 56505 . opc007:1014#
There's a difference of 194, which isn't fixed. It changes for a different hierarchy.
The script is below. I know it's not very efficient, but it does run on both NT and UNIX. Use it (Correct it!) if you wish, but at your own risk.
(As an aside I'd be interested in hearing from other filer users that are running CIFS, especially in a SW dev environment.)
Regards, GB.
#!/usr/bin/perl # # Calculate the space used on a filer with 4K block sizes for # the files in the current directory & it`s sub directories # # Based on the example on pages 56/57 of Programming Perl 1st Ed # by Larry Wall and Randal L. Schwartz pub O'Reilly # # Use at your own risk # # Garrett.Burke@msc.ie 15/5/98
$blk=4096; # no. of bytes per netapp block
&dodir('.');
sub dodir{ local($dir,$nlink)=@_; local($dev,$ino,$mode,$subcount); local(@allfiles);
print "Working in $dir\n"; opendir(DIR,'.') || die "Can't open $dir"; @allfiles=readdir(DIR); closedir(DIR);
for (@allfiles) { if ($_ eq '.') { # Don`t forget the directories themselves $numblks++; next; } next if $_ eq '..';
$name="$dir/$_"; $fnums++; ($dev,$ino,$mode,$nlink,$uid,$gif,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks)=stat($_); if (-d $_) { # print "$name is a directory\n"; chdir $_ || die "Can't cd to $name"; &dodir($name); chdir ('..'); } else { $numfiles++; $nt+=$size/1024; # NT size in KBs (fp) $netappblks=int($size / $blk); # no. of (int)netapp blocks if ($size % $blk) { $netappblks++; # anything over then another block } $numblks+=$netappblks; $netappfs+=$netappblks*4; # FS size (fp) in KB on netapp } } # for @ }
if ($nt) { $increase=$netappfs-$nt; # fp printf("NT FS size %f KB (%d files) Netapp FS size %f (%d blocks) KB increase %f KB (%d%) \n", $nt,$numfiles,$netappfs,$numblks,$increase,($increase/$nt)*100); } -- Garrett Burke, Network Admin,Managed Solutions Corp. 32 Upper Mount St., Dublin, Ireland. burkeg@msc.ie +353-1-661-4840 A jug of wine, a loaf of bread and thou.