D-Link Forums

The Graveyard - Products No Longer Supported => D-Link Storage => DNS-320 => Topic started by: RicRoller on July 04, 2012, 01:43:55 PM

Title: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: RicRoller on July 04, 2012, 01:43:55 PM
DNS-320 running firmware 2.02, has two Seatate ST2000DL003 2TB drives in RAID1.

Problem recipe/symptoms:
1. Created a "Remote backup" job (NAS to Linux), with the source as the Linux machine and the destination as a folder on the NAS. Job set to run manually. (Size of folder tree being backed up to the NAS was about 50GB, with several tens of thousands of folders and several million files (10 years' worth of accumulated junk on a company Linux server!)

2. Launched job manually; it appeared to complete successfully in that:
i. Job status moved to "Finished" (though this happened well before the file transfer had actually finished!!)
ii. Disk space statistics showed the expected space on the NAS had been used for the transferred files/folders
iii. Files/folders were visible using the "Web File Server" application in the NAS itself
iv. No errors reported in rsyncd.log file on the Linux server

3. However, if the parent folder of where those folders/files had been transferred to was shared (CIFS), upon mapping the network drive none of the transferred folders/files were visible.

I have tried deleting and creating the network share, also rebooting the NAS; the folders/files continue to be visible in the "Web File Server" application only - never seen in the shared folder when viewed from the Windows (or Linux) PC that has mapped it.


Regards,
Richard
Title: Solved: no bug - Files copied by remote backup not accessible in shared folder
Post by: RicRoller on July 05, 2012, 01:34:20 AM
Got to the bottom of the issue - not a bug but seemingly a fact of life of the "rsync" process

1. When copying "remote to local" - the file/folder UID/GID and permission bits are copied from the remote Linux machine. The file/folder ownerships and permissions are therefore not synchronised between the remote Linux machine and the NAS.

2. For any file/folder where the copied UID/GID do not happen to correspond with any known user or group defined in the NAS, the result is "no access". So, the files/folders become inaccessible!! (The "Web File Manager" application in the NAS appears to have root access so can still get at the files/folders)

3. It can be "put right" by mounting the NAS filesystem by NFS from the Linux box and in a root terminal window navigate to the parent directory of the backed up folder and then using "chown" and "chmod" to set up the wanted access.

The simplest option would be to set all the copied files/folders as owned by the first-created user (on my NAS it had UID:GID as 501:501)
chown -R 501:501 my_backed_up_folder

And, if the permissions are silly, reset those too; the simplest thing would be to enable full access for everyone
chmod -R 777 my_backed_up_folder


Regards,
Richard
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 15, 2012, 06:57:08 AM
seems like this is the solution of my problem (http://forums.dlink.com/index.php?topic=51160.0)

can you please document how you fixed this? i'm not really confident in changing unix rights on folders and files but i could try if i had some guidance.

thanks!

-or even accessing the nas file system using the "root" account web file manager uses through windows will be great!
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: telemaxx on November 15, 2012, 11:02:19 AM
You can check this:
Open "Web File Server"
Select "Volume_1" on the left side.
on the right side right click on you're Backuped folder and select properties.
Now you see owner and group, normaly root.
you cant change it here, but you see also the "Privileges"
check all boxes and confirm with apply.
I am not 100 percent sure, if this is recursive, but you can try it.
Now check, if you see this in the SMB share.

i have a installed "funplug", so i can do such things in an terminal:
http://nas-tweaks.net/371/hdd-installation-of-the-fun_plug-0-7-on-nas-devices/



Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 15, 2012, 12:11:33 PM
on the contrary..in the web file server the shared folder (which i can see and access from windows) shows it is owned by "nobody" and group "allaccount" and all the boxes checked.

the properties of the folder i can't see/access from windows are completely empty - no owner, no group and nothing checked (all checkboxes grey) have the same as the parent folder above. The folder shows up/get accessed fully on the web file viewer though.

i have installed fun_plug to check if i can modify anything and get the desired result, but i couldnt figure out smth.

more testing: if i make a folder from windows inside the share, and check it from the web file viewer i can see the owner as the user i used to make the folder.
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 17, 2012, 09:30:44 AM
i think i get to the bottom of this but i need to test a few tricks.

is there a way in DNS-320 to enforce folder inheritance?

or enable "create mask" and "directory mask" anywhere in the GUI? or if not, i can fun_plug it and do it through ssh if someone is kind to give some pointers...
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: telemaxx on November 18, 2012, 10:26:56 AM
If youre user is "ftpuser" the group is "ftpgroup" and youre backupfolder is "mybackup"

open ssh and login as root.

change working dir to youre diskroot:
Code: [Select]
cd /mnt/HD/HD_a2/see whats in there:
Code: [Select]
ls -lyou should see youre dir.
Changer the ownerchip (takes some time):
Code: [Select]
chown -R ftpuser:ftpgroup mybackupchange permission recursive to allow everything(takes a while):
Code: [Select]
chmod -R 777 mybackupand check again:
Code: [Select]
ls -l
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 18, 2012, 01:47:05 PM
wow, thanks a lot!

i'll try these as soon as possible and report back!
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 19, 2012, 03:17:44 AM
ok i've got a folder tree:

myBackup
 |
 -> backup.0
 -> backup.1

if i do "chown -R ftpuser:ftpgroup mybackup" i can access files through Windows using user "ftpuser", but if the automated backup makes a "backup.2" folder, i cant access it till i repeat the "chown" command again...:-(


edit: the new folders default to user "squeezecenter"
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: telemaxx on November 19, 2012, 10:56:53 AM
i asume "squeezecenter" is a user on the nas.
is he in the same group as youre smb user ?
If no, try to put him in the same group.

Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 19, 2012, 11:03:04 AM
actually i'm not sure who is user "squeezecenter"

that user doesn't appear on the user lists (where i add users/group), and i'm not aware on which groups he is a member.

i think he came up after adding fonz's fun_plug tbh.

Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 22, 2012, 06:38:05 AM
drwxrwx--- 4 squeezecenter        65533 4096 Nov 22 16:24 backup.0

is what i get when RSYNC finishes...
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 22, 2012, 09:04:06 AM
oh well i think i might not get around this...

isn't there a way to access the files from windows as "root"? when i try to access DNS-320 from windows i need to enter a username and a password. cant these be the "root" user so i can access everything like i do when i ssh? That way i suppose i can access the file system without needing specific users/groups and shares.

p.s tried "{IP}\root" as username and "{UNC}\root" but both doesnt work from windows
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: telemaxx on November 22, 2012, 11:18:36 AM
root is not a smb user:
Code: [Select]
more /etc/samba/smbpasswdon my dns320 there is also the user squezecenter:
Code: [Select]
more /etc/passwdyou can try to create a user "squezecenter" inside the webui(Account Management->user) and give him access to youre share(Account Management->Network Shares).
after that connect to youre win share as squezecenter.
just an idea...
Title: Re: Possible bug? Files copied by remote backup not accessible in shared folder
Post by: StathisA on November 22, 2012, 11:24:09 AM
i can't. it says "this account does not accepted" (lol on proper english).

i get the same message if i try to create a user named "root" too...