I've read in so many websites that, in Linux, symbolic links (soft links, symlinks) are just like pointers that reference another file, which may be located anywhere (like Windows shortcuts). However, when I check the disk usage of a folder in which there are symbolic links, there's a mismatch between what my file manager says and what
du reports. However, if I type
du -L (
-L, --dereference; dereference all symbolic links from the man page), the output of
du -L and the size that my file manager reports are the same.
My question is: if I have a softlink to a big file in, for example, my separate
home partition, will I have any problems?
/var/tmp folder is now plain empty. Let's create a file:
$ cat /some/file.txt > file.txt $ du -ac 164 ./file.txt 168 . 168 total
And my file manager (Thunar, in this case) reports
Size: 1 item, totalling 163.0 kB
All right. Now, lets create a really big file in
/tmp and a symlink to it:
$ cat /dir/really_big.txt > /tmp/heavy.txt $ du -a | grep heavy.txt 408 ./heavy.txt $ ln -s /tmp/heavy.txt heavy.txt $ du -ac 164 ./file.txt 0 ./heavy.txt 168 . 168 total
Everything is fine for now. But if I open my file manager:
Size: 2 items, totalling 570.3 kB
$ du -acL 164 ./file.txt 408 ./heavy.txt 576 . 576 total
If the partition in which
/var/tmp is located is 1 GiB big, and I create a link in it to a 1 GiB file, ¿will my hard disk die? I know that
du will output 168 and Thunar 1 GiB, but I don't know which is right.