In this case, file_b would be a symlink pointing to file_a. This is the main difference to symlinks, where the inode of file_b (inode 1001) could have content "file_a" and a flag meaning "this is a symlink". file_c again described by inode 1000 (so it is a hard link with file_a, not hardlink to file_a - because it is impossible to tell which filename came first - they are identical).Afterward, you can safely remove the old files, and remount everthing with mount -a. Create a new addition to /etc/fstab for the drive. Then, run blkid on the partition to find its UUID. Treat the partition as it it was the folder itself. The above means, in this directory, are 3 files: Then, copy everything from the original directory to the new partition. So if the directory-file contains: file_a: 1000 Hard-links are simply file names that map to the same inode. To understand the difference between hard links and symlinks, you should understand directories first.ĭirectories are files (with differentiated by a flag in the inode) that tell the kernel, "handle this file as a map of file-name to inode_number". You could write your own filesystem that would allow different permissions for symlinks, but you would get into trouble because common programs like chmod don't change permissions on symlinks themselves, so making such a filesystem would be pointless anyway) Usually, the kernel doesn't allow changes to the symlink permissions - and symlinks always have default permissions. This is about how symlink files are handled. If yes, can the link inode can have permissions different from that of target's Usually, the symlink is a file with its own inode, (with file-type, own data blocks, etc.) If yes, then will the inode number be same for target and links? There are filesystems that don't have inodes (in a physical implementation) but have only "virtual inodes" for maintaining compatibility with the kernel. (ext2/ext3/ufs.etc)ĭepends on filesystem implementation, but yes, generally the inode contains a "file-type" (and owners, access rights, timestamps, size, pointers to data blocks). Virtual filesystems can have symbolic links too, so, check FUSE or some other filesystem implementation sources. file-content: path to the target - in other words: a symbolic link is simply a file which contains a filename with a flag in the inode.the flag file-type in the "inode" that tells to the system this file is a "symbolic link".In the general, symbolic links are simply files (btw, directories are also files), that have: It is not about UNIX/Linux but about filesystem implementation - but yes, Unix/Linux uses inodes at kernel level and filesystem implementations have inodes (at least virtual ones).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |