Broken Symlink (target directory does not exist)

I am playing with fedora partitioning and filesystem management to find the best way to organize my disks.
I have 3 hard disks on my machine :
SSD (120 GB) where I installed \ , \boot and \home. (btrfs)
HDD1 (~ 1TB) where I made a single partition with all disk space (ext4)
HDD2 (~ 2TB) where I made a single partition with all disk space (ext4)

As I am intending to use the HDD2 for keeping large files (movie, music, picture etc.) I decided to create corresponding folders in it and make a symbolic link for these folders in the corresponding folder in /home directory. That is to say I have a folder in HDD2 which is called movie@HDD2 . and I create a symlink to point to it in /home/user/Videos.
The folder is being created but it is a broken symlink. Why this happened and how can I correct it?

How are you creating the symlink? It sounds like the @ is being removed from the target path, so the resulting symlink points to a non-existent file.

You need to find the uuid of your disks,

sudo blkid /dev/sdb1

edit your fstab

sudo nano /etc/fstab

and add your disk to the end of the fstab file, e.g.

UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890 /media/disk ext4 defaults 0 2

By using the UUID, the mount point should remain stable.
To look up more info search ‘add new disk to linux’

2 Likes

No, it is just because I become suspicious about that @ in the folder name. So I tried creating folder without that. The result of symlink creation is the same. I created symlink as bellow:

sudo ln -s /run/media/sina/movieHDD2/ /home/sina/Videos/

Ah, you are right. I completely forgot about fstab file!

1 Like