0

I'm trying to copy the root file system of a Debian unstable system. I get the following warnings when i do this:

gw:/# cp -xar / /mnt/1.tmp/
cp: will not create hard link `/mnt/1.tmp/var/run' to directory `/mnt/1.tmp/run'
cp: will not create hard link `/mnt/1.tmp/var/lock' to directory `/mnt/1.tmp/run/lock'

Now from my memory of how things work in unix, hardlinking directories is disallowed, and indeed it won't let me do it:

ln: `run': hard link not allowed for directory

So, my questions:

  1. Are those hardlinks supposed to be there at all?
  2. How were they created in the first place?
  3. How do i recreate them on the new filesystem?

Edited:

Looks like those hardlinks reported by cp don't actually exist, those 2 directories are mounted with --bind and cp sees the same inode number and thinks it's a hardlink.

I still don't fully understand how all this /run thing is supposed to work, for example there is no tmpfs mounted there on this system.

Anyway I'll go ahead with the move and unless something interesting happens or someone gives a better explanation will accept MealstroM's answer as it was somewhat helpful to understanding what is going on.

bdew
  • 103
  • 3

1 Answers1

2

You shoudn do. this shoud be like that. check why this was done http://lists.fedoraproject.org/pipermail/devel/2011-March/150031.html

/run is now a tmpfs, and /var/run is bind mounted to it. /var/lock is bind mounted to /run/lock. Applications can use /run the same way as /var/run. Since the latter is FHS/LSB most apps should just use the latter, only early boot stuff should use /run, for now. The folks who have packages where this applies already have been informed

you could try to use mount --bind /dir1 /dir2 for yours purposes if yours problem is not described in article by link

MealstroM
  • 1,517
  • 1
  • 17
  • 32
  • This still doesn't explain why there are **hardlinks** there or how are they supposed to be re-created (ln refuses to hardlink directories). – bdew May 19 '11 at 14:13
  • 2
    Err, wait... there aren't hardlinks, it's just _cp_ being stupid and seeing _mount --bind_ as hardlinks (same inode number i guess) and complaining about it. – bdew May 19 '11 at 14:15
  • You can use rsync with --hard-links to copy what you need. that would be better i suppose. – MealstroM May 19 '11 at 14:31