Copying files through a soft link

  • Follow


As the root file system (containing /usr) was getting full recently, I
moved some directories like /usr/openwin to another partition  and set
a corresponding link (/usr/openwin -> /otherplace/openwin) so
everything worked fine.

But later, something was updated and the package being installed wrote
something in the link. As a result, the link was overwritten by the
directory with the same name, some new files (from the update)
appeared beneath this directory. Of course, ONLY new files were there,
so the system was broken (at least the X server). I had to move all
new files to /otherplace/openwin and recreate the link.

How can I avoid that a soft link file is overwritten this way?

Bye
Rick Denoire

0
Reply Rick 12/4/2003 10:29:42 PM

"Rick Denoire" <100.17706@germanynet.de> wrote in message
news:bhcvsvs8s7qqadbi5is5o2fcerfbqr3m1f@4ax.com...
> As the root file system (containing /usr) was getting full recently, I
> moved some directories like /usr/openwin to another partition  and set
> a corresponding link (/usr/openwin -> /otherplace/openwin) so
> everything worked fine.

the symbolic link is probably a source of potential problems - an
alternative might be -

take the machine down to single user mode, then use the following to
relocate /usr to a new filesystem;

# cd /usr
# find . -depth -print | cpio -pdm /otherplace
# /otherplace/bin/mv usr usr.old
# /usr.old/bin/vi vfstab

Now you need to add a specific entry for the new /usr filesystem (currently
mounted on /otherplace), here is an example;

/dev/dsk/c0t0d0s4       /dev/rdsk/c0t0d0s4      /usr    ufs     1
  no     -

Then do the following;

# /usr.old/bin/mkdir -p /usr
# /usr.old/sbin/mountall

Now /usr should be mounted on the new file-system - assuming everything is
ok you can remove the old backup dir.

# rm -rf  /usr.old

Andrew


0
Reply Andrew 12/4/2003 11:08:26 PM


Rick Denoire wrote:

> As the root file system (containing /usr) was getting full recently, I
> moved some directories like /usr/openwin to another partition  and set
> a corresponding link (/usr/openwin -> /otherplace/openwin) so
> everything worked fine.
> 
> But later, something was updated and the package being installed wrote
> something in the link. As a result, the link was overwritten by the
> directory with the same name

You can avoid this by putting it on its own filesystem.  Luckily,
one of the filesystem types in Solaris is "lofs" which in effect
behaves like a symbolic link -- it just redirects one directory
to another.  But there is the further benefit that doing "/bin/pwd"
doesn't show the "wrong" thing.  And it's a real directory, so
installations don't get confused.  (Unless they try to rmdir it,
but that should not be a problem for /usr/openwin.)

Here's what you do:
1.  Add the line "/otherplace/openwin  -  /usr/openwin  lofs  -  yes  -"
     to /etc/vfstab.
2.  rm the /usr/openwin link.
3.  "mount /usr/openwin".
4.  "ls /usr/openwin" and notice that it contains everything in
     /otherplace/openwin.  "file /usr/openwin" and notice that it's
     a directory.
5.  (For completeness...)  "df -kl" and see if this is going to mess
     up and scripts you have that compute disk space usage or try
     to autodetect filesystems that should be backed up.  :-)

Hope that helps.

   - Logan

0
Reply Logan 12/5/2003 4:09:53 AM

Logan Shaw <lshaw-usenet@austin.rr.com> wrote:


>You can avoid this by putting it on its own filesystem.  Luckily,
>one of the filesystem types in Solaris is "lofs" which in effect
>behaves like a symbolic link -- it just redirects one directory
>to another.  But there is the further benefit that doing "/bin/pwd"
>doesn't show the "wrong" thing.  And it's a real directory, so
>installations don't get confused.  (Unless they try to rmdir it,
>but that should not be a problem for /usr/openwin.)

I must admit that this lofs thing is completely new to me. I will
give it a try.

0
Reply Rick 12/5/2003 11:52:11 PM

3 Replies
510 Views

(page loaded in 0.066 seconds)

Similiar Articles:













7/23/2012 10:00:16 AM


Reply: