Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: deep123 on April 29, 2005, 06:54:30 AM

Title: reg hardlink across partitions
Post by: deep123 on April 29, 2005, 06:54:30 AM
Hi,
Is it possible to have a hard link across partitions....
I need to take a data from one partition and write to to another partitions..If any modification of file done in Partition 1 ,it should be immediately reflected in partition2..I came to know hard link might work.... Is there any other way to do that... Kindly suggest me a solution...Thanks in Advance.
Title: reg hardlink across partitions
Post by: Gray on May 09, 2005, 02:08:01 PM
It is possible, but that partition have to be mounted on your file system and local to your machine.

Alternatively you can use a soft link to the file after mounting it.
Title: reg hardlink across partitions
Post by: deep123 on May 10, 2005, 05:13:46 AM
HI ,
         i have mounted the partition and  tried for hardlink a file to that partition say
         ln  /home/deepam/1.c     /mnt/mnt/backup/1.c

the partition is mounted on /mnt/mnt/backup.....

but it throws an error saying "Invalid Cross-device link"...
Title: reg hardlink across partitions
Post by: Gray on May 10, 2005, 06:32:14 AM
Try this

ln -s /home/deepam/1.c /mnt/mnt/backup/1.c

the -s switch makes it a soft link. Hope it works.

Let me know your result.
Title: reg hardlink across partitions
Post by: deep123 on May 10, 2005, 09:16:46 AM
Ya..its works fine for soft link...but  when the source file is deleted then backup copy will also get deleted....I have to try for hard link...
Whenever i try for hard link it throws an error "Invalid device terminal"..how to solve it
Title: reg hardlink across partitions
Post by: Gray on May 11, 2005, 09:13:15 AM
Only that you need immediate reflection in your backup else you  could schedule a copy of the desired file(s), Hard links from my knowledge can't achieve what you require.
Title: reg hardlink across partitions
Post by: deep123 on May 12, 2005, 05:40:45 AM
thanks for ur reply  :D