Hello all. I am in the middle of installing RH 7.3 on my new computer. Besides the usual unexplained enjoyment of doing that, I encountered a small problem (I'm not asking about the solution, I'm just going to tell you).
The thing is, that I want a small root partition, and anything else on a bigger partition. My choice was to put /usr, /tmp and /home on another partition, which is mounted on, say, /bigdisk. Now, if I wanted /usr or /home alone on a partition, it would have been so easy, because you can choose so during the installation. So I installed Linux normally on a single, small root partition, with minimum packages (perl is included in the minimum, if you ask me...). Then boot up Linux (Yuppeee), copy the relevant directory trees into the big disk: tar -c usr tmp home | { cd /bigdisk && tar -x; } and all that is left, is to replace the previous /usr, /tmp and /home with symbolic links to those in /bigdisk. Well, almost... Because tar preserves symbolic links exactly as they appear. Unfortunately, that doesn't work so well with relative symbolic links. For example, /usr/X11R6/lib/X11/XF86Config is symlinked to ../../../../etc/X11/XF86Config, which is a nasty way to say /etc/X11/XF86Config. Nasty, because after we move the directory tree, it will actually point to /bigdisk/etc/X11/XF86Config, which doesn't exist, because /etc wasn't moved off the root partition (for good reasons...). And there are a lot of broken links like this. I searched the web for a solution, and couldn't find one. So I wrote a script. The idea is like this. First we find all the relevant symbolic links: ls -l `find /bigdisk -type l` > syms We get a file named syms. Then we run a script on this list of links, which goes through each of them, and checks if they reach the 'bigdisk' directory. If it does, the link is removed, and replaced with an absolute link. This script should be run *before* replacing the original /usr's and friends with links, of course. Here is the script. It is run as root, of course, and it worked nice for me, but I really take zero responsibility if it messes up your system. I warmly recommend to run it first with print's instead of unlink and `ln ...` once to see that it will do the right thing. Any ideas where to post this script so more people can use it? I presume it's quite a common problem. Regards, Eli --------- $mydir = 'bigdisk'; @lines = <>; chomp @lines; foreach $line (@lines) { $flag=0; die("Bad link line: $line\n") unless $line =~ /\s([^ ]+)\s->\s([^ ]+)/; $l = $1 ; @path = split('/', $1); @link = split('/', $2); pop @path; # Remove the file name die("Strange path in $l\n") unless (length($path[0])==0); while ($link[0] eq '..') { shift @link; pop @path; die("Faulty link (digged too deep): $l\n") if ($#path < 0); if ($path[$#path] eq $mydir) { pop @path; $flag=1; } } next unless ($flag); $new = join('/', @path, @link); die("Unexistent file $new referred by $line\n") unless (-e $new); unlink $l; `ln -s $new $l\n`; } -------------------------------------------------------------------------- Haifa Linux Club Mailing List (http://www.haifux.org) To unsub send an empty message to [EMAIL PROTECTED]