参考:https://www.jianshu.com/p/dde6a01c4094
软链接存的是相对路径名或者准确说是ln -s命令时指定的路径(文章不对)-结果是在ubuntu上验证的。 由于指向另一个inode number,所以额外存储在另一个磁盘块上。
cp命令时,会将文本复制 而不是复制符号链接文件-大小会发生改变
mv命令时,直接移动软链接文件 - 但是移到别的文件夹时,由于存储的是相对路径,位置错误就会报错。
当然,对应相对路径创建文件时,软连接又会变绿可访问
说白了,就是存的pathname
以下是man inode的一段话
File size
stat.st_size; statx.stx_size
This field gives the size of the file (if it is a regular file
or a symbolic link) in bytes. The size of a symbolic link is
the length of the pathname it contains, without a terminating
null byte.
硬链接,如文所说
硬链接: 与普通文件没什么不同,inode number相同, inode都指向同一个文件在硬盘中的区块
inode中有这样一个叙述:
Link count
stat.st_nlink; statx.stx_nlink
This field contains the number of hard links to the file. Addi‐
tional links to an existing file are created using link(2).
说明引用计数