LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2009, 01:14 PM   #1
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Rep: Reputation: 15
Invalid cross-device link


Using OpenSuse.

I'm running Apache2 and its document root is /srv/www/htdocs. I want to make hard links to the web page files in that directory from a directory in my home folder (/home/eric/htdocs-link) so when I back up the home directory those files are also backed up. (Also I then won't have to remember to track down those files when I move to a different distro--can just save my home directory.)

I tried
Code:
eric@linux-pczd:~/htdocs-link> ln /srv/www/htdocs/*
and got this result
Code:
eric@linux-pczd:~/htdocs-link> ln /srv/www/htdocs/*
I have no idea why the system would think or expect test.php~ to be a directory.

At any rate, I then tried
Code:
ln /srv/www/htdocs/* /home/eric/htdocs-link
and this resulted in a whole bunch of these error messages:
Code:
ln: creating hard link `/home/eric/htdocs-link/apache_pb22_ani.gif' => `/srv/www/htdocs/apache_pb22_ani.gif': Invalid cross-device link
I don't know why I'm getting this error message. When I google it, the comments seem to relate to trying to make a link between different file systems, but I'm not doing that. Unless I'm missing something, /srv/www/htdocs is in the same FS as my home directory, isn't it?

Thanks.
 
Old 06-07-2009, 02:19 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Google: There are about 37 thousand results
 
Old 06-07-2009, 05:33 PM   #3
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
??
I don't follow what you're trying to tell me to do. I did Google--the point is that I don't see anything that explains what's happening. I should be able to make the hard link if the two directories are on the same file system. Is there any reason they wouldn't be on the same file system? They're both on the same hard drive.

I don't understand what the stuff about file::copy is about. Is this supposed to tell me how to create the hard link?

Thanks.
 
Old 06-07-2009, 05:48 PM   #4
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Quote:
Originally Posted by linuxqueric View Post
Code:
ln: creating hard link `/home/eric/htdocs-link/apache_pb22_ani.gif' => `/srv/www/htdocs/apache_pb22_ani.gif': Invalid cross-device link
I don't know why I'm getting this error message. When I google it, the comments seem to relate to trying to make a link between different file systems, but I'm not doing that. Unless I'm missing something, /srv/www/htdocs is in the same FS as my home directory, isn't it?

Thanks.
Not unless they are on the same partition. If there's another device mounted on /srv or /srv/www, or if your /home is on a different partition, then there's no way to create a hardlink. Check your /etc/fstab
 
Old 06-07-2009, 10:34 PM   #5
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
Hmm--looks like /home is a different partition. I don't remember doing that. Would that be the default location of /home for openSuse?

Thanks.
 
Old 06-07-2009, 10:36 PM   #6
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
To create a hard link, the original file and the link file should exist in the same partition. check with df -h command or /etc/fstab entries to find out.

Last edited by saagar; 06-07-2009 at 10:38 PM.
 
Old 06-08-2009, 08:03 AM   #7
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks to all. I learned:
1) Different partitions, even if on the same HDD and with the same file type (ext3) count as different file systems for the ln command.
2) At some point some leprechaun put my /home directories into a different partition.
 
Old 06-08-2009, 12:33 PM   #8
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Well, you can make soft links and instruct your backup program to follow them. Usually, there's an option like that in backup software. Hardlinking files is not the only option...
 
Old 03-20-2013, 04:10 PM   #9
TheGoogler
LQ Newbie
 
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by jamescondron View Post
Google: There are about 37 thousand results
Hi there.

Just wanted to come tell you to fuck off. This is literally the first result on google now, and your post is about as unhelpful as it gets.

Thanks, and eat shit!

Sincerely,
Everyone googling this.
 
Old 08-19-2013, 03:04 AM   #10
alexbk66
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
Thumbs up Hate when people post useless crap!

Quote:
Originally Posted by TheGoogler View Post
Hi there.

Just wanted to come tell you to fuck off. This is literally the first result on google now, and your post is about as unhelpful as it gets.

Thanks, and eat shit!

Sincerely,
Everyone googling this.
Can't agree more! Hate when people post useless crap!
 
Old 09-17-2014, 05:40 AM   #11
AnotherAnnoyedGoogler
LQ Newbie
 
Registered: Sep 2014
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by jamescondron View Post
Google: There are about 37 thousand results
... and this thread is ironically the first.

The solution to this problem is soft linking / symbollic linking.

Code:
ln -s TARGET LINK_NAME
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
D-Link Wireless Desktop Card SIOCSIFFLAGS: Invalid argument lmcilwain Linux - Wireless Networking 1 10-02-2008 02:37 PM
error: -1 Invalid module format when using insmod with module cross-compiled for arm AndrewShanks Linux - Embedded & Single-board computer 4 10-15-2007 04:50 AM
GNU based c++ cross compiler unable to link c library k_taid Programming 1 06-29-2005 10:38 AM
tethereal and tcpdump: -y invalid data link type 1 murugesan Linux - Wireless Networking 0 05-31-2004 12:28 AM
How to find an invalid symbolic link?? zhaoyoubing Linux - General 3 08-21-2003 10:01 PM


All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration