Home » Recreate a default shared folder in QNAP

Recreate a default shared folder in QNAP

by Vlad Drumea
0 comments

This post has nothing to do with SQL Server, I just wanted to document a way to recreate a default shared folder on a QNAP NAS without having to recreate all of them and potentially losing some data.

Intro

I’ve previously moved the Web shared folder, that QNAP uses for its web server service, to a volume that was using 2 WD Red SSDs in RAID 1.

Recently, one of those two SSDs died after only 2 years of minimal usage, this ended up setting the volume as read-only and spammed me with the following warning.

Full warning message:

Shared Folders General [Shared Folders] The default shared folders (Web) do not exist. To restore these shared folders, go to “Control Panel > Shared Folders > Restore Default Shared Folders”

Another side effect of this, that makes no sense to me, is that it auto-disabled QNAP’s Multimedia Console even though that volume had nothing to do with the Multimedia Console service.

I’ve only needed the web server a little while and I don’t really care about the files stored on that volume.
And now I want that warning to stop and the Multimedia Console service to run again, so my first step was to delete said volume from the UI.

QNAP has a way of restoring default shared folders, but it’s unclear to me if it does that for all the other default shares (some of which I actually use) and if it deletes any of the data. So, even though I do take periodic backups of my NAS, I am not too keen on finding out the hard way if that deletes existing data or not.

Short detour into QNAP’s internal layout

All shared directories and their data live under the /share directory.

QNAP maps each volume to a CACHEDEV#_DATA directory under the /share directory.
So the first volume is mapped to CACHEDEV1_DATA, the second volume would be CACHEDEV2_DATA and so on.

Then all the shares inside each volume have symbolic links pointing to them from the /share directory.

So, in my case, the /share/Web symlink would point to /share/CACHEDEV2_DATA/Web.

All the shared folder related configuration is stored in the /etc/config/smb.conf file.

The fix

Quick note: this needs SSH and the Admin account to be enabled, so, if you’re like me and keep them disabled, you’ll have to enable them before proceeding (this is temporary and you can disable them when done).

I connect to the NAS via SSH and I’m greeted by the main menu.

Console Management - Main menu 1: Show network settings 2: System event logs 3: Reset to factory default (password required) 4: Activate/ deactivate a license 5: App management 6: Reboot in Rescue mode (w/o configured disk) 7: Reboot in Maintenance Mode Q: Quit (return to normal shell environment) recreate default shared folder QNAP Vlad Drumea VladDBA

I press Q and Enter then confirm by pressing Y and Enter so that I can use the shell environment.

Then I navigate to the /share directory.

Directory structure

I remove the old symlink.

From there I navigate to my remaining volume.

Note that the directory already existed as a leftover from before it was migrated to the other volume.
Si I first remove it and then re-create it.

Then I also create the @Recicle directory, this is used by QNAP as a recycle bin for each shared folder.

I then go back to the /share directory.

And recreate the Web symbolic link so that it points to the directory I’ve just created.

Share configuration

Once that’s done, I use more (side note: Windows also has more that does pretty much the same thing) to read the /etc/config/smb.conf configuration file.

The block pertaining to the Web shared folder is obviously missing since it was erased when I’ve deleted the volume.

So I copy an existing block that has a similar configuration to the Web folder, In my case I picked the Download shared folder.

Here’s how that block looks:

Note that I’ve redacted the values for the write list and valid users entries only here, in the config file they’re untouched.

I then open the file using vi.

Navigate to the end of the file, go into insert mode by pressing i add a new empty line and paste the previously copied block leaving an empty line between it and the previous block.

And then I update it so that it looks like this:

I press the Esc key to exit insert mode and then : followed by w and q to save the file and quit vi

At this point the default shared folder is recreated and visible in QNAP’s UI, in Control Panel > Shared Folders, but I opt to restart the NAS just in case.

Conclusion

Didn’t expect WD Red SSDs to be so disappointing, but at least I’ve learned something new out of this.

You may also like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.