Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239448 > unrolled thread

Soft link confusion

Started by"Gary L. Roach" <garyroach719@gmail.com>
First post2021-08-30 02:00 +0200
Last post2021-08-31 12:20 +0200
Articles 7 — 6 participants

Back to article view | Back to linux.debian.user


Contents

  Soft link confusion "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-30 02:00 +0200
    Re: Soft link confusion Greg Wooledge <greg@wooledge.org> - 2021-08-30 02:20 +0200
      Re: Soft link confusion Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2021-08-30 15:20 +0200
        Re: Soft link confusion Tixy <tixy@yxit.co.uk> - 2021-08-30 15:40 +0200
    Re: Soft link confusion David Christensen <dpchrist@holgerdanske.com> - 2021-08-30 02:40 +0200
      Re: Soft link confusion "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-30 16:50 +0200
        Re: Soft link confusion Andrei POPESCU <andreimpopescu@gmail.com> - 2021-08-31 12:20 +0200

#239448 — Soft link confusion

From"Gary L. Roach" <garyroach719@gmail.com>
Date2021-08-30 02:00 +0200
SubjectSoft link confusion
Message-ID<CRCSt-6FV-1@gated-at.bofh.it>
Hi all,

I don't have occasion to use links very often and tend to get confused 
as to which direction the link is pointing. Specifically, I am trying to 
redirect backuppc files from the normal /var/lib/backuppc directory to 
another disk mounted at /media/Backup, a 1TB disk that is not being 
used. I wrote "ln -s /var/lib/backuppc  /media/Backup". This produced 
"backuppc -> /var/lib/backuppc" on the 1TB disk. The problem is that I 
now have duplicate files in both places. Specifically the cpool, log, 
pc, and pool directories appear on both drives. This is obviously not 
what I want. I need the pool files on the Backup disk and not on my 
system disk. What have I done wrong.

Sincerely appreciated any help.

Gary R

[toc] | [next] | [standalone]


#239449

FromGreg Wooledge <greg@wooledge.org>
Date2021-08-30 02:20 +0200
Message-ID<CRDbQ-71r-1@gated-at.bofh.it>
In reply to#239448
On Sun, Aug 29, 2021 at 04:59:35PM -0700, Gary L. Roach wrote:
> I don't have occasion to use links very often and tend to get confused as to
> which direction the link is pointing. Specifically, I am trying to redirect
> backuppc files from the normal /var/lib/backuppc directory to another disk
> mounted at /media/Backup, a 1TB disk that is not being used. I wrote "ln -s
> /var/lib/backuppc  /media/Backup". This produced "backuppc ->
> /var/lib/backuppc" on the 1TB disk.

The syntax is:  ln -s TARGET LINKNAME

I.e. you specify the existing thing first, and the name of the link that
you want to create last.

> The problem is that I now have duplicate
> files in both places. Specifically the cpool, log, pc, and pool directories
> appear on both drives.

Well, there are two things here.  First, if you screwed up the ln -s
command the first time, you might also have accidentally created the link
in a different place than you thought.  In particular, if the final
argument is an existing directory, a link will be created *inside* that
directory.

Second, what you see depends on how you're viewing the two directories.

To begin with, note that the ls command has a -d option which suppresses
the normal ls behavior of showing the contents of a directory, and instead
shows you the directory itself.

unicorn:~$ ls -ld /bin
drwxr-xr-x 2 root root 4096 Aug  5 07:09 /bin/

If you've been doing commands like "ls -l /media/Back<TAB>" then you
might be seeing the contents of a directory, rather than the actual
symlink or the directory that it points to.

unicorn:~$ ln -s /bin link
unicorn:~$ ls -ld link
lrwxrwxrwx 1 greg greg 4 Aug 29 20:07 link -> /bin/

Right?  There's my symlink which points to a directory.  Now, if I forget
to use the -d option:

unicorn:~$ ls -l link
lrwxrwxrwx 1 greg greg 4 Aug 29 20:07 link -> /bin/

Still OK, right?  But if I use tab completion, then I get a trailing
slash on the argument, and then...

unicorn:~$ ls -l link/
total 13980
-rwxr-xr-x 1 root root 1234376 Aug  4 16:25 bash*
-rwxr-xr-x 3 root root   38984 Jul 20  2020 bunzip2*
-rwxr-xr-x 1 root root  715480 Jul 25 14:44 busybox*
[...]

So I have a guess that you might have done that.  Including the trailing
slash changes the behavior of ls (and many other commands).

[toc] | [prev] | [next] | [standalone]


#239460

FromEduardo M KALINOWSKI <eduardo@kalinowski.com.br>
Date2021-08-30 15:20 +0200
Message-ID<CRPmF-6mv-3@gated-at.bofh.it>
In reply to#239449
On 29/08/2021 21:10, Greg Wooledge wrote:
> The syntax is:  ln -s TARGET LINKNAME
> 
> I.e. you specify the existing thing first, and the name of the link that
> you want to create last.

If you need a mnemonic, this is just like cp.

$ cp ORIGINAL NEW

creates NEW as a copy from ORIGINAL. Similarly,

$ ln -s ORIGINAL NEW

creates a link NEW pointing to ORIGINAL.

-- 
"Be there.  Aloha."
		-- Steve McGarret, _Hawaii Five-Oh_

Eduardo M KALINOWSKI
eduardo@kalinowski.com.br

[toc] | [prev] | [next] | [standalone]


#239461

FromTixy <tixy@yxit.co.uk>
Date2021-08-30 15:40 +0200
Message-ID<CRPG1-6sr-3@gated-at.bofh.it>
In reply to#239460
On Mon, 2021-08-30 at 10:18 -0300, Eduardo M KALINOWSKI wrote:
> On 29/08/2021 21:10, Greg Wooledge wrote:
> > The syntax is:  ln -s TARGET LINKNAME
> > 
> > I.e. you specify the existing thing first, and the name of the link that
> > you want to create last.
> 
> If you need a mnemonic, this is just like cp.
> 
> $ cp ORIGINAL NEW
> 
> creates NEW as a copy from ORIGINAL. Similarly,
> 
> $ ln -s ORIGINAL NEW
> 
> creates a link NEW pointing to ORIGINAL.
> 

Same order as for 'mount' command too.
I remember the argument order as WHAT WHERE

mount WHAT WHERE
cp WHAT WHERE
ln WHAT WHERE

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#239450

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2021-08-30 02:40 +0200
Message-ID<CRDvb-77C-3@gated-at.bofh.it>
In reply to#239448
On 8/29/21 4:59 PM, Gary L. Roach wrote:
> Hi all,
> 
> I don't have occasion to use links very often and tend to get confused 
> as to which direction the link is pointing. Specifically, I am trying to 
> redirect backuppc files from the normal /var/lib/backuppc directory to 
> another disk mounted at /media/Backup, a 1TB disk that is not being 
> used. I wrote "ln -s /var/lib/backuppc  /media/Backup". This produced 
> "backuppc -> /var/lib/backuppc" on the 1TB disk. The problem is that I 
> now have duplicate files in both places. Specifically the cpool, log, 
> pc, and pool directories appear on both drives. This is obviously not 
> what I want. I need the pool files on the Backup disk and not on my 
> system disk. What have I done wrong.
> 
> Sincerely appreciated any help.
> 
> Gary R


Rather than trying to symlink the backup repository directory out from 
underneath backuppc (which could lead to confusion and disaster in the 
future when you have forgotten about the symlink), can you change a 
backuppc configuration setting so that the backups are put where you 
want them?


David

[toc] | [prev] | [next] | [standalone]


#239463

From"Gary L. Roach" <garyroach719@gmail.com>
Date2021-08-30 16:50 +0200
Message-ID<CRQLL-74s-3@gated-at.bofh.it>
In reply to#239450
Thank you all for the help. Edwardo's mnemonic is a great help. So is 
the rest of the information. As to the BackupPC configuration change. 
While it is possible to redirect the backup in the config file, it is 
specifically not recommended. Not sure why.

Thanks again.

Gary R.

On 8/29/21 5:34 PM, David Christensen wrote:
> On 8/29/21 4:59 PM, Gary L. Roach wrote:
>> Hi all,
>>
>> I don't have occasion to use links very often and tend to get 
>> confused as to which direction the link is pointing. Specifically, I 
>> am trying to redirect backuppc files from the normal 
>> /var/lib/backuppc directory to another disk mounted at /media/Backup, 
>> a 1TB disk that is not being used. I wrote "ln -s /var/lib/backuppc  
>> /media/Backup". This produced "backuppc -> /var/lib/backuppc" on the 
>> 1TB disk. The problem is that I now have duplicate files in both 
>> places. Specifically the cpool, log, pc, and pool directories appear 
>> on both drives. This is obviously not what I want. I need the pool 
>> files on the Backup disk and not on my system disk. What have I done 
>> wrong.
>>
>> Sincerely appreciated any help.
>>
>> Gary R
>
>
> Rather than trying to symlink the backup repository directory out from 
> underneath backuppc (which could lead to confusion and disaster in the 
> future when you have forgotten about the symlink), can you change a 
> backuppc configuration setting so that the backups are put where you 
> want them?
>
>
> David
>

[toc] | [prev] | [next] | [standalone]


#239508

FromAndrei POPESCU <andreimpopescu@gmail.com>
Date2021-08-31 12:20 +0200
Message-ID<CS8Sl-2rl-1@gated-at.bofh.it>
In reply to#239463

[Multipart message — attachments visible in raw view] — view raw

On Lu, 30 aug 21, 07:47:13, Gary L. Roach wrote:
> Thank you all for the help. Edwardo's mnemonic is a great help. So is the
> rest of the information. As to the BackupPC configuration change. While it
> is possible to redirect the backup in the config file, it is specifically
> not recommended. Not sure why.

It might be good to find out in any case, as the same reason (or worse) 
might apply to redirecting with a symlink.

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web