Create softlinks in Ubuntu

Got a tutorial? Put it here. Need a tutorial? Look in here. NO REQUESTS.

Moderator: Omen

User avatar

Topic Author
thedatabug
Heart on for IceFlims
Posts: 557
Contact:

Create softlinks in Ubuntu

Post#1 » Sat Nov 13, 2010 8:07 am

Seeing as there are a few on this forum that are using either Ubuntu or some other Ubuntu derived distro I though the following tutorial might be useful. This will work in any Ubuntu derived distro and possibly many other Linux distros too

Purpose:

If you are dual booting Windows and Linux then you might wish to share your Windows My Pictures, My Music, My Documents etc with your Linux OS. The following tutorial will replace your Linux Pictures, Documents, Music, Videos and Downloads folder with links to Their counterpart folders on the Windows side.

Method:

In order to create the softlinks you first of all have to mount any Windows drives at boot up. By default Your Windows ntfs partitions are automatically mounted when you try to access them but not at boot time.

To mount the drives you first of all have to create mount points in either /media or /mnt folders. The difference is. Drives mounted in /media will be visible on the desktop whereas drives mounted in /mnt will be invisible unless you create links to them.

For me I prefer them in /mnt but you can just substitute /mnt for /media if you prefer.

Open Terminal and type

cd /mnt

sudo mkdir Windows


repeat the previous command for each partition you wish to mount replacing Windows with the name you want that partition to be known by.

Next we need to find out the UUIDs for the drives so we can mount them in the fstab file.

Open Terminal and type

blkid


make a note of the UUIDs for the drives you wish to mount.

You should have a list of numbers like this “DE906C6C906C4CD9”

Next we need to make a backup of fstab so type the following into Terminal.

cd /etc
sudo cp fstab fstab.BAK


Now we need to open fstab with a text editor so we can add the UUID information.
In Terminal type

Sudo gedit fstab



Here is what I added to my fstab file in order to mount my drives



#Windows

UUID=DE906C6C906C4CD9 /mnt/Windows ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0 0

#Documents

UUID=01CB7F21B3E049A0 /mnt/Documents ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0 0

#Entertainment

UUID=01CB753790E3F260 /mnt/Entertainment ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0 0

#Movies

UUID=7C908C4B908C0E38 /mnt/Movies ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0 0



Simply copy and paste the above information but replace the UUID with the UUIDs from your system and also replace the mount points with the mount points you created in your /mnt or /media folders.

So that all the new mounted drives become availabe type into Terminal

umount -a

mount -a


Now that the drives are all mounted we can create the softlinks.

Lets for this example replace the Pictures folder in Linux so delete this folder (making sure you have rescued any data from it of course).

In Terminal type the following

cd /mnt[and the rest of the path to the folder that 'My Pictures' is in]

ln -s 'My Pictures' /home/[your user name]/Pictures


Tip: to make this step simpler you can just type ln -s and drag and drop the folder onto the Terminal window. Then just add the new softlink location in /home/[user name]

That's it. You should now have a folder in /home/[username] called Pictures that links to your my pictures folder on Windows. Repeat this step for as many folder as you would like to softlink.

I hope this will be useful to someone :).
I want to be a Goth so I can hang out with girls in corsets

User avatar

Nevermore669
Obsessively Addicted
Posts: 4509

Re: Create softlinks in Ubuntu

Post#2 » Sun Nov 14, 2010 9:02 am

Great how-to DB! :)
Ignorance and callousness are not virtues

A bleeding heart is a symbol of holiness, a symbol of compassion, not an epithet

When our discourse sinks to the level of meaningless, pejorative labels and personal name-calling rather than honest reflection and reasoned dialogue, we are no longer a people, but a mob

User avatar

Topic Author
thedatabug
Heart on for IceFlims
Posts: 557
Contact:

Re: Create softlinks in Ubuntu

Post#3 » Sun Nov 14, 2010 7:09 pm

thank you. Wasnt sure If I missed out important details or if It was clear enough. I occasionally have a habit of rambling :).
I want to be a Goth so I can hang out with girls in corsets

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest