ln:creating hard link問題

7291 ワード

実は簡単です
chattr-R-i xxxx           #xxxxはあなたのために修正が必要なファイルです。これでいいです。
 
以下は全部重点ではないです。
ln:creating hard link`xxx'=>/opt/xx':Operation not permitted
自ら抜け出すhttp://www.windowslinuxosx.com/q/answers-how-do-i-remove-a-possible-hard-link-directory-to-root-625072.html
Solution
The files and ディレクトリー in the  .linktorootdir directory are copied from the root directory.You can simply delete them using for example  rm -rf /volume1/usbcopy/USBCopy_1303012145/.linktohomedir.
The explanion is below.
Hardlinks of directores
Hardlinks ト ディレクトリー are theortically possible but because of multile reasons they are disabled in many system including Linux.This also means that You will not be able to remove a handink to directory as the  unlink() sysscall will not allow it.
デモンストレーション
root@x:~/testdir# ln -F dir1 dir1link
ln: failed to create hard link `dir1link' => `dir1': Operation not permitted
root@x:~/testdir# unlink dir1
unlink: cannot unlink `dir1': Is a directory
The shown denial is hadwired in the Linux kernel(fs/namei.c).Here are the reults of sysscalls:
linkat(AT_FDCWD, "dir1", AT_FDCWD, "dir1link", 0) = -1 EPERM (Operation not permitted)
unlink("dir1")                          = -1 EISDIR (Is a directory)
Recognizing the two types of links
  • ソフトリンク -  ls -l ニュース  l as the first character of the type/permission field.  stat Output shows  symbolic link.
  • handlek - Hardlinks aremutally indistinguishable.Both the original file and newly created handayink look exactly the same except the path/filename.Hardlinks cannot point from one filesystem to another.  ls -i shows the same inode number for all files handlinked to the same data.The second column of  ls -l shows the number of handlinks to the inode.
  •  
     
    user1@x:~/testdir$ ls -li
    total 12
    6865008 drwxrwxr-x 2 user1 user1 4096 Jul 30 00:50 dir1
    6822146 lrwxrwxrwx 1 user1 user1    4 Jul 30 01:44 dir1symlink -> dir1
    6822155 -rw-rw-r-- 2 user1 user1   64 Jul 30 01:44 file1
    6822155 -rw-rw-r-- 2 user1 user1   64 Jul 30 01:44 file1hardlink
    
    user1@x:~/testdir$ stat * | grep -E '((File)|(Size)|(Device)):'
      File: `dir1'
      Size: 4096        Blocks: 8          IO Block: 4096   directory
    Device: 807h/2055d  Inode: 6865008     Links: 2
      File: `dir1symlink' -> `dir1'
      Size: 4           Blocks: 0          IO Block: 4096   symbolic link
    Device: 807h/2055d  Inode: 6822146     Links: 1
      File: `file1'
      Size: 64          Blocks: 8          IO Block: 4096   regular file
    Device: 807h/2055d  Inode: 6822155     Links: 2
      File: `file1hardlink'
      Size: 64          Blocks: 8          IO Block: 4096   regular file
    Device: 807h/2055d  Inode: 6822155     Links: 2
    
    Origin of  .linktorootdirIn the  .dfmdesk ディレクトリー DFM creates some links during the first start.The se links will be shown as icons on the desktop.Between the links there will be two links to directores:.linktorootdir as a symlink to the root directory of the system DFM is running on and also .linktohomedir.See the DFM documentation and the DFM source.
    In your case the ディレクトリー  / and  /volume1/usbcopy/USBCopy_1303012145/.linktohomedir are on different filesystems(/dev/root) and  /dev/vg1000/lv)so they cannot be handleinks to the same inode.(Hardlinks can point just in the scope of a single filesystem.)
    We can gess how the problem.Most probably the backup to NTFS was able to keep the smlink as NTFS has capability.Later when you copied the backup from the USBドライブ the copying tool did not handle symlinks as expected.Instead of copying just the smbonic link itself,the tool followed the smboric links on the source drive and copied the content of the m  .linktorootdir).The simiar proble is describe also in the Synology forum: USBCopy cougt in finity loop while copying HDD.
    The solution is described at the beginning.
     
     
     
     
    A hard link is a directory entry that references the same inode as anothe directory entry(onlyworkinininininthe same file sysstem).One shououshoud therefore avavebod sparararinininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininininand are also not all programs be supported and you may want/would imgine it.Absoutely comon for the uninit copy(not!)way,is something like:
    コード:
    chown root.root / home/user1/.profile
    ln / home/user1/.profile / home/user2/.profile
    ln / home/user1/.profile / home/user3/.profile
    ... (For all users)
    This is all well all user profiles a par“(what the user personally、but not good and perhaps not event the meaning of.profile equivalent)、but an outsiders'Admin occurs as rapidmin a fax pachene changeglobally to all user s impact.And it is particularly bad if the setting happens to a terminal and then you see nothing more)
     
     
     
    ハロー、
    I do not understand the follwing lineas 
    コード:
    linux: / usr / lib / openoffice / share / fonts # ln-v-d / usr/X11R6/lib/X11/fonts/TT /
    create hard link `. / dd 'to` / usr/X11R6/lib/X11/fonts/TT'
    Ln: creating hard link `. / Dd 'to `/ usr/X11R6/lib/X11/fonts/TT ': Operation not permitted
    linux: / usr / lib / openoffice / share / fonts #
    How can i make a hard link to that directory?Also what exact is the work of a hard link in linux.Thank you for your help.
      #
    2  
     20-08-2010
    Amy Adams 
    メンバー
     
    Join Date:Mar 2010
    Posts:162
     
    Re:How to create Hard Link in Linux
    A hard link is a directory entry that references the same inode as another directory entry(only working in the same file system)Onee shoul d therefore avoobod very sparininglyand use only with reason.If possiblble YouShououououououououououououououououououououououououououououououououououououououououououououououououououououououououououbld SyyyyyyyyLiLiLiLimmmffffffffffrerererereaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaat!)way、is something like:
    コード:
    chown root.root / home/user1/.profile
    ln / home/user1/.profile / home/user2/.profile
    ln / home/user1/.profile / home/user3/.profile
    ... (For all users)
    This is all well all user profiles a par“(what the user personally、but not good and perhaps not event the meaning of.profile equivalent)、but an outsiders'Admin occurs as rapidmin a fax pachene changeglobally to all user s impact.And it is particularly bad if the setting happens to a terminal and then you see nothing more)
     
     
    Re:How to create Hard Link in Linux
    See this 
    コード:
    > Ln-v-d / usr/X11R6/lib/X11/fonts/TT /
    And
    コード:
    ln one
    ln[OPTTION]…OBJECTIVE[command name]
    コード:
    -D,-F, - directory
    Directores to link hard.(Only super-user)