Operating System - Linux
1830250 Members
2783 Online
110000 Solutions
New Discussion

Re: NFS and backup to NAS

 
SOLVED
Go to solution
Jano_1
Advisor

NFS and backup to NAS

Hi,

I have a Linux server with NFS enabled which copies/back-ups all files to a NAS (network attached storage) server everyday (running a script in crontab). The NAS is nothing else than a Linux server running kernel 2.4.20.

The problem is that when a file is copied to the NAS, it looses the userID.
eg.
(on the main server)
drwx------ 34 jano jano 4.0k Sep 6 09:48 jano

(on the NAS)
drwx------ 3 nfsnobody nfsnobody 17 Sep 6 08:54 jano

What should I do to maintain the userID information?

I also tried cp with -p to preserve file attributes but received:
cp: preserving ownership for `/mnt/nas/home/jano/.kde/share/fonts': Operation not permitted

Any comments welcome...
Jan
8 REPLIES 8
Slawomir Gora
Honored Contributor

Re: NFS and backup to NAS

Hi,

try doing archive by tar with -p option. You will have no problem to restore perm.

cd /home
tar cpvf /mnt/nas/home.tar home

or you can use cpio.
Slawomir Gora
Honored Contributor

Re: NFS and backup to NAS

Hi,

cd / not /home :)
Jano_1
Advisor

Re: NFS and backup to NAS

Hi Slavomir,

Thanks for your answer, but your solution by backing-up to an archive with tar is not the ideal solution for me, so I prefer not to use it.

Jano
Slawomir Gora
Honored Contributor

Re: NFS and backup to NAS

Hi,

If you NAS is just linux - I think you have to reconfigure you NAS server
by adding to /etc/exports parameter no_all_squash

look at man page for exports



Ross Minkov
Esteemed Contributor
Solution

Re: NFS and backup to NAS

If you are running the backup as root, then add the following in /etc/exports on the NAS Linux server:
no_root_squash -- Turn off root squashing.
Then run exportfs -r

If using cp to copy the files then use the following switch/option: -a (or --archive); this is same as -dpR

HTH,
Ross
Jano_1
Advisor

Re: NFS and backup to NAS

Hi Ross,

I tried cp -a
Look at the output below and please tell me what you think.

cp: preserving ownership for `/mnt/nas/file.file': Operation not permitted

Regards,
Jano
Jano_1
Advisor

Re: NFS and backup to NAS

Please disregard my previous post.

Ross,

I made the change to the exports file, ran exportsfs -r, and tested with cp -a and it worked 100% !!!

I will run some more tests to see if everything works.

Regards,
Jano
Ross Minkov
Esteemed Contributor

Re: NFS and backup to NAS

Good job! Glad I could help... Ross