[SOLVED] What have I done with my Ubuntu Desktop Server - Pleeeeeeeeeease Help!
UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What have I done with my Ubuntu Desktop Server - Pleeeeeeeeeease Help!
Hi Everyone
I recently made a file and media server using Ubuntu Desktop 16.04 LTS. I thought it was all working well with the shares showing all the media files as they should with the only concern being the 777 permissions currently granted to everything. The intent was to change that later once everything worked fine. But I don't believe my system is working as it should and I would like to fix it so that it works as it is supposed to be and I don't have issues later with loads of data on it.
This is what I find :-
When I access this Ubuntu server computer from my windows PC, I see a folder called "mediafiles" with 2 sub-folders viz "share4media" and "share4data". These sub-folders, however, correctly show all the files and folders therein. No problem. I see exactly the same structure when I access this server computer from my WD Live TV.
The problem is that the folder structure that I see from my Windows PC is not the folder structure thought I created in my Ubuntu server computer. If you look at these attachments, it will become clearer.
I, in Ubuntu server computer, created a sub-folder under the "/media" folder called "/mediafiles" (this was supposed to be titled "dataplusmediafiles" but nevertheless - I will change it later if I can but no big deal). The original intent was to create 2 sub-fodlers under this folder ("/media/mediafiles"). These were to be named "share4media" and "share4data" - these 2 sub-folders were supposed to be the mount points for the 2 physical hard drives that I currently have - one dedicated to the data files and the other to the media files. I am very sure that I didn't actually end up creating these 2 sub-folders ("share4media" and "share4data") on the server computer.
I then specified the mount definitions in the fstab file for these hdd's are as follows :-
/dev/sda1 /media/share4media ntfs defaults 0 0
/dev/sdb1 /media/share4data ntfs defaults 0 0
Maybe because of what I have so far done, I am seeing the folder structure differently on the Ubuntu computer from within the Ubuntu PC and from within the Windows PC. I would like to correct this situation though.
With my current setup (incorrect as it is), is it now possible to change things so that the original intent can be met or is it too late. There is about 1.4 tb if data in the ""/share4media" folder at the moment. The "/share4date" is empty at the moment.
I think this is what is required to be done but I am not sure if I can do them (without losing data on the "share4media" folder) :-
1. Unmount both these hdd's (I don't how to do that yet but hopefully someone can show me how to)
2. Create these 2 sub-directories called "share4data" and "share4media" under the /media/mediafiles (it would be great if I could rename this share as "dataplusmediafiles" at this stage - as was the originally intended)
3. Change the mount definition again in the fstab file like so :-
The share name in your smb.conf file i.e. [mediafiles] has nothing to do with the actual directory path you want to share i.e /media (path = /media).
To rename the directory just use the mv command i.e.
cd /media
sudo mv mediafiles dataplusmediafiles
Now you can create the desired media and directories in the dataplusmediafiles directory.
umount sda1 and sdb1 and remount to /media/dataplusmediafiles/share4media and /media/dataplusmediafiles/share4data.
Change the share path directory to path = /media/dataplusmediafiles and when you access the mediafiles share from the windows computer you should see just the two media directories.
You should use ntfs-3g instead of ntfs to mount NTFS filesystems.
Thank you so much for your immediate response. I am so grateful. I will try and implement all of these tonight when I get home and hopefully things should be all good. Despite my extremely limited knowledge of linux, I am quite liking it and hopefully be able to improve upon it in the near future.
Whilst your instructions are quite succinct and clear, but because of limited knowledge of the linux system at this stage and I am dead scared of stuffing things up again and want to ensure that this time around I get it perfectly right, I am just summarizing the steps that I need to take to fix up my system (could you please have a cursory glance at them and advise if I have got it all OK?) :-
1. Rename my current "mediafiles " directory to "dataplusmediafiles" using the commands :-
cd /media
sudo mv mediafiles dataplusmediafiles
This directory as such is currently empty, so that shouldn't be an issue at all.
2. Create 2 sub-directories inside the now renamed "dataplusmediafiles" directory with the names "share4date" and "share4media" using the following commands :-
cd /media/dataplusmediafiles
sudo mkdir /media/dataplusmediafiles/share4data
sudo mkdir /media/dataplusmediafiles/share4media
These should result in two empty subdirectories with the following paths :-
/media/dataplusmediafiles/share4data
/media/dataplusmediafiles/share4media
3. Unmount the two currently mounted hard disk drives using the following commands (I had mounted these drive with "ntfs" file system type but it shows as "fuseblk" type. Do I need to specify the file system type in the unmount command at all? If yes, do I specify as "fuseblk" or "ntfs" as was specified in the mount command in the fstab file?):-
umount -v -t ntfs /media/share4data|/dev/sda1
umount -v -t ntfs /media/share4media|/dev/sdb1
These drive were mounted with the following commands in the fstab file :-
/dev/sda1 on /media/share4media
/dev/sdb1 on /media/share4data
I am assuming here that unmounting a drive doesn't affect the data on them, hence I wouldn't lose any data on them - One of them is empty anyway, the other has 1.4 tb of data.
4. Remount these drive with the following command in the fstab file :-
mount /dev/sda1 /media/dataplusmediafiles/share4media ntfs-3g defaults 0 0
mount /dev/sdb1 /media/dataplusmediafiles/share4data ntfs-3g defaults 0 0
5. Rename the share "dataplusmediafiles" in the smb.conf file to path = "/media/dataplusmediafiles". Whilst, as you said, the share name has nothing to do with the directory path, just for the sake of consistency, I would like to see "dataplusmediafiles" as the parent folder name with "share4date" and "share4media" as the the 2 subdirectories under it.
6. Restart Samba service for all of these changes to take effect
7. Reboot the server for all of these changes to take effect
One more question - hopefully, this should be the last question in this context :-
As you saw the share definition in the smb.conf file, I have specified the 'create mask = 777' for the mediafiles (now dataplusmediafiles) share, but I want myself (agarwaldvk user) to be the only one to be able to edit the 'share4media' sub-folder in the future on a permanent basis. How can this be realized?
Sorry for being a pest but I am so apprehensive about get it wrong again, hence the over caution.
Change [mediafiles] to [dataplusmediafiles] in your smb.conf file and restart samba. What you see under the network will now be dataplusmediafiles and when you click on the icon you will see the other directories.
Since the partition is NTFS you can change how share4media is mounted using uid,gid,umask and dmask options.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.