Re: ISO Image Size Increasing

2007-04-04 Thread Alexander Anderson
The image copied from the CD is approximately 234 MB in size, and the
image created by mkisofs is 664 MB.
 It sounds like you may be running into a hardlink issue with iso9660.

Yes, ISO-9660 file system does not assign the same inode to hard links.

I had to write a Perl script that finds identical files and links them
(see below).
Hope it helps.

===begin hardlink.pl===
#!/usr/bin/perl
#
# $Id: hardlink.pl,v 1.2 2007/03/29 01:20:53 alex Exp $

use File::Find;
use strict;

die Usage: $0 file ...\n unless @ARGV;

my %count;
my %files;

find({ wanted = \wanted, no_chdir = 1 }, @ARGV);

sub wanted {
next unless -f;
next if -l;

print $_\n;

my $md5 = `md5 -q $_`;  # shorter than Digest::MD5 (am I lazy)
chomp $md5;
$md5 =~ /^[0-9a-f]{32}$/ or die 'md5 failed';

$count{$md5}++;

push(@{ $files{$md5} }, $_);
}

for my $md5 (grep { $count{$_}  1 } keys %count) {
my @files = @{ $files{$md5} };

my $source = shift @files;
for my $target (@files) {
system(ln -fv $source $target) == 0 or die;
}
}

__END__

=head1 NAME

hardlink.pl - find copies of files and create hard links instead

=head1 SYNOPSIS

hardlink.pl file ...

=head1 DESCRIPTION

Newsgroups: fa.netbsd.tech.kern
From: Wolfgang Solfrank [EMAIL PROTECTED]
Subject: Re: hard links in mounted cd9660 file system
Date: Thu, 3 Mar 2005 13:31:42 GMT
Message-ID: [EMAIL PROTECTED]

Hmm, the problem is that there is no good way to know that two files
are hardlinks on a 9660 filesystem.  9660 doesn't have a concept of
inodes as is common in standard unix filesystems.  Instead, the
information about the file is stored in the directory entry.  This
means that the two directory entries pointing to the same data blocks
may in fact describe two different files (e.g. the may have different
owner or permission, or they may even differ in size!).

Currently, the inode number shown by 9660 is just the offset of the
directory entry of the file relative to the disk/partition, with the
special case for directories, where we use the start of the directory
itself, i.e. the offset of the '.' entry.  This way, it's quite easy
to determine the file attributes given the inode number.

=head1 AUTHOR

Alexander Anderson [EMAIL PROTECTED]

=cut
===end hardlink.pl===
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: ISO Image Size Increasing

2007-04-03 Thread Kevin Downey

On 4/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

I have run into a rather weird problem, that I am not sure how to correct.

I have created a bootable CD for my FreeBSD systems which is approximately
234 MB in size.  While deploying the image, I found an error I would like
to correct.  All I am doing is adding a symlink to a folder in the /home
directory.

Please let me know if you see anything flawed in my procedure which may be
causing this problem.

1.  Create a directory to work in /home/CDImage.

2.   Copy the existing image to the /home/CDImage directory.
tar -cpf - /cdrom | tar -xpf -

3.  Add the necessary symlink.

4.  Create the ISO image.
/usr/local/bin/mkisofs -allow-leading-dots -l -R -T -iso-level 4 -b
boot/cdboot -no-emul-boot -o fwcd.iso CDImage


The image copied from the CD is approximately 234 MB in size, and the
image created by mkisofs is 664 MB.

Any suggestions would be greatly appreciated.

Thanks,


Jay

It sounds like you may be running into a hardlink issue with iso9660.
I saw a few mails about this on one of the mailing lists last month.
Basicly hardlinks were not being copied off the cd as hardlinks, but
as files. So instead of /bin/foo being a hardlink to /bin/bar you get
/bin/foo and /bin/bar as seperate identical files. I would check the
size of the /home/CDImage directory after copying the cd files to it.
I am not sure if there is a fix.

--
The biggest problem with communication is the illusion that it has occurred.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]