Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
can you put here cat /etc/mtab output? –  MealstroM May 20 '11 at 6:28
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.