Those of us who use a NAS like those awesome QNAP devices possibly recognize this situation:
You have a lot of shared folders, but as an Admin you’d like to access them all from one single share, so instead of mounting an X number of “drives”, you mount just one.
When looking at the directory structure on your QNAP, this could be the “root” of all your shares, but opening this as a shared folder comes with it’s own set of little issues. Using the QTS 4.x function called “Shared Folder Aggregation” doesn’t work all that well either, and even worse: it’s limited so Samba shares.
Instead I’ll show you a way to do QNAP Shared folder aggregation with symbolic links …
Note : This makes moving files between shares also significantly faster … no matter how big the file!
Combine QNAP Shared Folders into one Share
The goal of this article is to combine QNAP Shared folders into one share, so we end up with an additional shared folder on your QNAP, which provides access to all or some of your existing shares. Your existing shares will not be changed, we just add one single entry point.
The main purpose (for me anyway) is that I, as Admin, only have to mount one share on my Mac, or in Windows terms that I only have to map one drive, providing access to all shares on my QNAP. Yet at the same time keep the existing shares in-tact, so that other users still can be limited in what shares they can access if needed.
To accomplish this we will use symbolic links …
QTS build-in QNAP Shared Folder Aggregation
If you payed attention to the details of your QNAP setup, then your first response will be: “But what about the build-in Shared Folder Aggregation?”.
I’ve played with this function and even though it adds some great futures, including adding shares on different servers, it does come with it’s limitations as well. For example: it only works for SMB (Samba) shares.
A great option of this function however, is the ability to combine with shares on different servers.
For our purposes the use of symbolic links just works easier …
Creating the Combined Shared Folder
Step 1 – Create a new Share
First we need to create a share that will hold the other shares.
On your QNAP, go to the web-interface and open “Control Panel“.
Go to “Privilege Settings” “Shared Folders” “Create” “Shared Folder“.
Complete the field “Folder Name” (I used “AllShares”) and optionally the field “Description” (I entered “Share with Symbolic Links to the other shares”, up to you what you want to write here, or leave it blank).
I called my new share “AllShares”, but you can of course use another name if you’d like. I’d avoid spaces and special characters though. Keep in mind that in the rest of the article I’ll be using the name “AllShares”, replace this name in the examples with your share name.
QNAP – Create a new Share
User Privileges of your shares …
Please keep in mind that the user(s) that have access to this new share (AllShares) should also have access rights to the shares we will soft link to this new share.
Optionally change the “Configure access privileges for users“, for example if you want to add another user to have access besides the admin. By default only the admin has read/write access, and access for all other users is denied.
Als optional is changing the settings under “Advanced Settings” where the default settings are:
- Deny Guest access
- Folder not hidden for Windows networks
- Oplocks enabled
- Automatic selection of the path of this shared folder
Once you’ve entered all settings, click the “Create” button.
Step 2 – Creating Symbolic Links
This step is where we link the other shares into our new share.
I called my share “AllShares”, replace this name with the name you used if needed.
To create symbolic links to our other shares, we will need to use SSH to get access to the shell of your QNAP. Read our SSH article on how to do this, just make sure SSH is enabled on your QNAP (“Control Panel” “Network Services” “Telnet / SSH“, check “Allow SSH Connection” and optionally check “Enable SFTP” – don’t forget to click the “Apply” button).
What is a Symbolic Link?
A symbolic link, also called “Soft Link”, is much like a Shortcut in Windows or an Alias under MacOS X.
Unlike a “Hard link”, a symbolic link does not contain the actual data, but instead just points to the location where the actual data is. When you delete te file or directory a symbolic link points to, then the symbolic link will no longer work.
When you have a symbolic link to a directory, changes to the contents of the original directory will immediately be reflected when you open the symbolic link, since it points to the original.
See also: Symbolic Link Wiki
A symbolic link for a file, under Linux, is created with the following statement:
ln -s source_file new_link_file
This works the same for a symbolic link to a directory, where “source_file” is the original file or directory and “new_link_file” is the symbolic link you just created (which can be anywhere on your filesystem).
I wanted to have a link to all shares, but you can of course limit your selection to the shares you care for.
First thing is to get into an SSH connection to your QNAP, which is typically done (Linux/MacOS X) from a shell using
ssh firstname.lastname@example.org where 192.168.1.100 should be the IP address of your QNAP. Windows users can use an application like “PuTTY“.
On most QNAP’s the shares will be found in
The shares (you’ll recognize the names) here however are already symbolic links, and we’d rather link to the original files. To find the original files, use:
You will see a pretty wide out put, so you might need to make your window wider to see all the details. An example output (shortened: i removed a few lines to keep things readable) can be found below.
lrwxrwxrwx 1 admin administ 18 May 26 07:48 AllShares -> MD0_DATA/AllShares/
lrwxrwxrwx 1 admin administ 21 May 26 07:48 Applications -> MD0_DATA/Applications/
lrwxrwxrwx 1 admin administ 20 May 26 07:48 Development -> MD0_DATA/Development/
lrwxrwxrwx 1 admin administ 18 May 26 07:48 Documents -> MD0_DATA/Documents/
lrwxrwxrwx 1 admin administ 17 May 26 07:48 Download -> MD0_DATA/Download/
drwxrwxrwx 2 admin administ 1024 Sep 18 2005 HDA_DATA/
drwxrwxrwx 2 admin administ 1024 Dec 7 2005 HDB_DATA/
drwxrwxrwx 2 admin administ 1024 Dec 7 2005 HDY_DATA/
drwxrwxrwx 2 admin administ 1024 Dec 7 2005 HDZ_DATA/
drwxrwxrwx 41 admin administ 4096 May 26 07:48 MD0_DATA/
lrwxrwxrwx 1 admin administ 19 May 26 07:48 Multimedia -> MD0_DATA/Multimedia/
lrwxrwxrwx 1 admin administ 28 May 26 07:48 Network Recycle Bin 1 -> MD0_DATA/Network Recycle Bin/
lrwxrwxrwx 1 admin administ 15 May 26 07:48 Public -> MD0_DATA/Public/
drwxr-xr-x 2 admin administ 1024 May 24 09:59 Qsync/
lrwxrwxrwx 1 admin administ 19 May 26 07:48 Recordings -> MD0_DATA/Recordings/
lrwxrwxrwx 1 admin administ 18 May 26 07:48 USBDisk1 -> external/DEV3406_1/
lrwxrwxrwx 1 admin administ 12 May 26 07:48 Usb -> MD0_DATA/Usb/
drwxrwxr-x 30 admin administ 1024 May 24 03:56 external/
In this example you will see the actual locations. For example the share “Download” is displayed as located in
MD0_DATA/Download/ . This is however relative to the
/share/ directory, so the path to the Download share is actually:
When looking at all the output, we now see that all shares on this QNAP reside in
/share/MDO-DATA/ . This is good to know, as we will need it to create the symbolic links.
In this list we can also see what shares exist, but you can also see them in the QNAP web-interface (“Control Panel” “Privilege Settings” “Shared Folders“):
QNAP – Shares in the web-interface
Now that we know all this, time to create the symbolic links for the shares we’d like to aggregate into one folder.
First, go to the new share we just create, it’s actually the first one in the previous “ls -l” output:
Use the following statement to go there (change the path if yours was different):
Next we need to execute the symbolic link statement for each share we’d like to create a symbolic link. For example:
ln -s /share/MD0_DATA/Applications Applications
ln -s /share/MD0_DATA/Development Development
ln -s /share/MD0_DATA/Documents Documents
ln -s /share/MD0_DATA/Download Download
ln -s /share/MD0_DATA/GoogleDrive GoogleDrive
ln -s /share/MD0_DATA/Multimedia Multimedia
ln -s /share/MD0_DATA/Projects Projects
After executing this, you’d see something like this after doing an “ls -l”:
lrwxrwxrwx 1 admin administ 28 May 26 08:40 Applications -> /share/MD0_DATA/Applications/
lrwxrwxrwx 1 admin administ 27 May 26 09:15 Development -> /share/MD0_DATA/Development/
lrwxrwxrwx 1 admin administ 25 May 26 09:17 Documents -> /share/MD0_DATA/Documents/
lrwxrwxrwx 1 admin administ 24 May 26 09:17 Download -> /share/MD0_DATA/Download/
lrwxrwxrwx 1 admin administ 27 May 26 09:18 GoogleDrive -> /share/MD0_DATA/GoogleDrive/
lrwxrwxrwx 1 admin administ 26 May 26 09:18 Multimedia -> /share/MD0_DATA/Multimedia/
lrwxrwxrwx 1 admin administ 24 May 26 09:18 Projects -> /share/MD0_DATA/Projects/
Rinse and repeat for all the share you’d like to see in you aggregated directory.
After completing these steps, open the share on your Windows, MacOS X or Linux machine and you’ll see that the directories in this share go straight to the content of the shares you created a symbolic link for.
Special thanks to Don at the QNAP Forums.