LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-07-2013, 05:32 PM   #1
TKH
Member
 
Registered: Jul 2011
Location: Milky Way
Distribution: Ubuntu, LFS, Slackware, Fedora
Posts: 223

Rep: Reputation: 20
Question on hardlinks


So I have a question that the answer doesn't seem to show up anywhere on internet.

Is it possible to transfer a directory with files and their hardlinks in it?
It can be moving, copying or tar-ing.

Case: Let's say that I want to move/copy a whole system.

Any words would be appreciated.
 
Old 10-07-2013, 07:48 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,360

Rep: Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001
Both tar and cp will by default preserve hard links among the files that are being transferred. For rsync, you need to use the "-H" (--hard-links) option to do that ("rsync -aH source_dir destination_dir"). None of these will preserve hard links to files not included in the current operation even if the destination is in the same filesystem as the source.

If you move (mv command) a directory to a new location within the same filesystem, that action is just renaming the base directory, so all the hard links can and will be preserved. If the destination is on a different filesystem, mv behaves just like cp with the addition of removing the source at the end of the operation.
 
  


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
[SOLVED] How to change hardlinks to softlinks? phi Linux - General 11 03-28-2012 12:28 AM
Hardlinks hexapla Linux - Newbie 1 10-10-2011 11:45 AM
Rsync not copying hardlinks as hardlinks OralDeckard Linux - General 14 09-15-2011 02:48 PM
softlinks vs hardlinks irfanhab Linux - Newbie 4 02-06-2007 03:05 AM
Cd image with hardlinks kvtournh Linux - Software 2 08-27-2006 06:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:17 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