Date: Sat, 6 Sep 2014 00:41:03 +1000 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: Roland Smith <rsmith@xs4all.nl> Cc: "Martin G. McCormick" <martin@server1.shellworld.net>, freebsd-questions@freebsd.org, Poul-Henning Kamp <phk@freebsd.org> Subject: Re: Recreating the FreeBSD Installation Disks Message-ID: <20140905190747.L58647@sola.nimnet.asn.au> In-Reply-To: <mailman.2244.1409250543.853.freebsd-questions@freebsd.org> References: <mailman.2244.1409250543.853.freebsd-questions@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In freebsd-questions Digest, Vol 534, Issue 9, Message: 21 On Thu, 28 Aug 2014 19:38:40 +0200 Roland Smith <rsmith@xs4all.nl> wrote: > On Thu, Aug 28, 2014 at 09:46:00AM -0500, Martin G. McCormick wrote: > > Roland Smith writes: > > > Looking at the mkisofs manpage, it *should* detect hard links by default. > > > Does > > > using the `-cache-inodes` option make any difference? > > > > I tried explicitly -no-cache-inodes and then -cache-inodes and > > the two files vary by about 15 bytes. It looks like the hard > > links are lost in the mounting process which means that one can > > not use that as a test after all. > > There is nothing in the md or mdconfig manual pages about hard links. So it > looks like you're right. It seems that's correct regarding md, but there are also strangenesses with tar (same version as Martin's: bsdtar 2.8.5 - libarchive 2.8.5) I ran some more tests on reading this, on a 9.2-S system from about six weeks ago (9.3-PRERELEASE #0: Wed Jun 25), using the 9.3-R dvd1.iso As reported, I'd run dvd1_to_memstick.sh <http://pastebin.com/fzgVaCgW> to convert the dvd1.iso to a memstick.img - though I've yet to install it, nor check if bsdconfig needs patching to point pkg to its packages, which had been an issue with the 10.0-R memstick made from dvd1. This worked fine with 9.2-R, and I just checked to find the same hard links investigated below ARE CORRECT even though I used the same script to create the memstick from which this system was installed, so I'm a bit confused as to what's happening here .. it almost seems that the process of installing these files re-hard-links them? via mtree maybe? > To test it, you could use `ls -i` on two files in the mounted CD-ROM image > that you suspect should be hard-linked. E.g. ${CD}/bin/[ and ${CD}/bin/test. > If they don't return the same inode number md(4) does not provide hard links. That seems to be the case, at least from an .iso image. Details below. > > There is that version of tar as in tar-3.1.2 which I can't seem > > to locate anywhere although the version may be at a higher > > number by now. > > How did you get it? I've not found anything for tar on > > FreeBSD except for gnutar and that does not process iso9660 > > images. > > tar 3.1.2 is the version included in FreeBSD 10. Since libarchive and cpio have > the same version, I assume they belong together. > > What you could try is copy /usr/src/contrib/libarchive/ from 10.0 in to your > 9.1 source tree and see if you can build it on 9.1. It'd be cool if someone using 10 could check the behaviours shown below to see if the later version of tar really is a solution, and to see if md showing hardlinked files with the right number of links, but each with a different inode is really a problem, apart from the extra space? Here goes: root@x200:~ # rm -rf ~smithi/mstk_tmp/* root@x200:~ # tar -pxf ~smithi/FreeBSD-9.3-RELEASE-amd64-dvd1.iso -C ~smithi/mstk_tmp tar: Ignoring out-of-order file (etc/aliases) 88256512 < 88256726 tar: Ignoring out-of-order file (etc/resolv.conf) 88700928 < 88702606 [.. hundreds of these, but no apparent problem afterwards ..] tar: Ignoring out-of-order file (usr/share/vi/catalog/nl_NL.ISO8859-1) 1799053312 < 1799064190 tar: Error exit delayed from previous errors. root@x200:~ # du -hd1 ~smithi/mstk_tmp 1.2M /home/smithi/mstk_tmp/bin 83M /home/smithi/mstk_tmp/boot 4.0k /home/smithi/mstk_tmp/dev 2.5M /home/smithi/mstk_tmp/etc 8.6M /home/smithi/mstk_tmp/lib 244k /home/smithi/mstk_tmp/libexec 4.0k /home/smithi/mstk_tmp/media 4.0k /home/smithi/mstk_tmp/mnt 1G /home/smithi/mstk_tmp/packages 4.0k /home/smithi/mstk_tmp/proc 4.0k /home/smithi/mstk_tmp/rescue 12k /home/smithi/mstk_tmp/root 5.1M /home/smithi/mstk_tmp/sbin 4.0k /home/smithi/mstk_tmp/tmp 642M /home/smithi/mstk_tmp/usr 296k /home/smithi/mstk_tmp/var 1.6M /home/smithi/mstk_tmp/.rr_moved 1.7G /home/smithi/mstk_tmp Just looking at files in bin with 2 hard links .. sbin, usr/bin and usr/sbin seem to contain most of the other hardlinked files. smithi@x200:~ % ls -li ~/mstk_tmp/bin | grep ' 2 ' | sort 2889706 -r-xr-xr-x 2 root wheel 382400 Jul 11 10:14 csh 2889706 -r-xr-xr-x 2 root wheel 382400 Jul 11 10:14 tcsh 2889714 -r-xr-xr-x 2 root wheel 54816 Jul 11 10:14 ed 2889714 -r-xr-xr-x 2 root wheel 54816 Jul 11 10:14 red 2889722 -r-xr-xr-x 2 root wheel 11424 Jul 11 10:14 link 2889722 -r-xr-xr-x 2 root wheel 11424 Jul 11 10:14 ln 2889727 -r-xr-xr-x 2 root wheel 18048 Jul 11 10:14 pgrep 2889727 -r-xr-xr-x 2 root wheel 18048 Jul 11 10:14 pkill 2889733 -r-xr-xr-x 2 root wheel 15664 Jul 11 10:14 rm 2889733 -r-xr-xr-x 2 root wheel 15664 Jul 11 10:14 unlink 2889741 -r-xr-xr-x 2 root wheel 11688 Jul 11 10:14 [ 2889741 -r-xr-xr-x 2 root wheel 11688 Jul 11 10:14 test So these directory entries show 2 links, and each of the pair have the same inode number, as one would expect. However with the .iso as /dev/md0 mounted on /mnt, the link counts do _show_ eg '2' - but the files are shown as having unique inodes, which might? be the way they appear on an actual DVD; I have no machine with a DVD drive to test that theory. root@x200:~ # rm -rf ~smithi/mstk_tmp/* root@x200:~ # mdconfig -f ~smithi/FreeBSD-9.3-RELEASE-amd64-dvd1.iso md0 root@x200:~ # mdconfig -lv md0 vnode 1718M /home/smithi/FreeBSD-9.3-RELEASE-amd64-dvd1.iso root@x200:~ # mount_cd9660 /dev/md0 /mnt smithi@x200:~ % ls -li /mnt/bin | grep ' 2 ' | sort 92918 -r-xr-xr-x 2 root wheel 382400 Jul 11 10:14 csh 93640 -r-xr-xr-x 2 root wheel 54816 Jul 11 10:14 ed 94448 -r-xr-xr-x 2 root wheel 11424 Jul 11 10:14 link 94568 -r-xr-xr-x 2 root wheel 11424 Jul 11 10:14 ln 95156 -r-xr-xr-x 2 root wheel 18048 Jul 11 10:14 pgrep 95278 -r-xr-xr-x 2 root wheel 18048 Jul 11 10:14 pkill 96002 -r-xr-xr-x 2 root wheel 54816 Jul 11 10:14 red 96120 -r-xr-xr-x 2 root wheel 15664 Jul 11 10:14 rm 97104 -r-xr-xr-x 2 root wheel 382400 Jul 11 10:14 tcsh 97224 -r-xr-xr-x 2 root wheel 11688 Jul 11 10:14 test 97344 -r-xr-xr-x 2 root wheel 15664 Jul 11 10:14 unlink 97594 -r-xr-xr-x 2 root wheel 11688 Jul 11 10:14 [ ie, link counts are right, but separate inodes per file. root@x200:~ # tar -cf - -C /mnt . | tar -xpf - -C /home/smithi/mstk_tmp/ As per bsdtar(1), and the recipe used by Darren in dvd1_to_memstick.sh Nothing reported on stdout, but all hard links are now lost .. smithi@x200:~ % ls -li ~/mstk_tmp/bin | grep ' 2 ' | sort smithi@x200:~ % smithi@x200:~ % ls -li ~/mstk_tmp/bin | sort 3384240 -r-xr-xr-x 1 root wheel 12080 Jul 11 10:14 cat 3384241 -r-xr-xr-x 1 root wheel 8152 Jul 11 10:14 chflags 3384242 -r-xr-xr-x 1 root wheel 18504 Jul 11 10:14 chio 3384243 -r-xr-xr-x 1 root wheel 8624 Jul 11 10:14 chmod 3384244 -r-xr-xr-x 1 root wheel 21072 Jul 11 10:14 cp 3384245 -r-xr-xr-x 1 root wheel 382400 Jul 11 10:14 csh [..] 3384279 -r-xr-xr-x 1 root wheel 382400 Jul 11 10:14 tcsh 3384280 -r-xr-xr-x 1 root wheel 11688 Jul 11 10:14 test 3384281 -r-xr-xr-x 1 root wheel 15664 Jul 11 10:14 unlink 3384282 -r-xr-xr-x 1 root wheel 7240 Jul 11 10:14 uuidgen 3384283 -r-xr-xr-x 1 root wheel 11688 Jul 11 10:14 [ root@x200:~ # du -hd1 ~smithi/mstk_tmp | vs tar -pxf .iso 1.7M /home/smithi/mstk_tmp/bin | vs 1.2M 83M /home/smithi/mstk_tmp/boot 4.0k /home/smithi/mstk_tmp/dev 2.5M /home/smithi/mstk_tmp/etc 8.6M /home/smithi/mstk_tmp/lib 244k /home/smithi/mstk_tmp/libexec 4.0k /home/smithi/mstk_tmp/media 4.0k /home/smithi/mstk_tmp/mnt 1G /home/smithi/mstk_tmp/packages 4.0k /home/smithi/mstk_tmp/proc 4.0k /home/smithi/mstk_tmp/rescue 1.6M /home/smithi/mstk_tmp/.rr_moved 20k /home/smithi/mstk_tmp/root | vs 12K (.cshrc) 6.2M /home/smithi/mstk_tmp/sbin | vs 5.1M 4.0k /home/smithi/mstk_tmp/tmp 774M /home/smithi/mstk_tmp/usr | vs 642M 296k /home/smithi/mstk_tmp/var 1.9G /home/smithi/mstk_tmp | vs 1.7G Copying md(4)'s daddy phk@ for potential instant enlightenment :) Also in search of explanation is why 'tar -cf . | tar -xpf -' lost links but reports no errors, while tar -xpf isofile doesn't lose hardlinks but (here) complains or in Martin's case, couldn't make a dir so lost files? cheers, Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140905190747.L58647>