LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   copy to network drive preserving date/time stamp (https://www.linuxquestions.org/questions/linux-newbie-8/copy-to-network-drive-preserving-date-time-stamp-728351/)

SBFree 05-25-2009 07:28 AM

copy to network drive preserving date/time stamp
 
Hi:
I would like to back up some data files on an Ubuntu install to a WinXP machine and preserve the date/time stamp of the files. I can use the copy command to make a copy between drives in the same machine after mounting the second drive but don't know how to either mount the networked drive or name in for the copy command. If I use the graphic interface ( Nautilus ) the time/date stamps for the files are not preserved.

To go copy from one drive to another in the same machine I use:
sudo mount -t ext3 /dev/sdb1 /backup
then:
sudo cp -r -p /var/www/twiki /backup/twiki

If I view the directory on the networked machine, with Nautilus, where I want to copy files to it displays:
smb://htpc-wmce/backup%20(d)/Twiki
In the Nautilus file browser location area. Can I Mount this networked drive and copy to it or can I make Nautilus copy and preserve the time/date stamp?

Thanks,
Scott

linuxlover.chaitanya 05-25-2009 08:01 AM

Man scp.

If you are using cp then you can use --preserve option. If scp then -P option is used for same use. ( It is capital "p").

AwesomeMachine 05-25-2009 08:34 AM

rsync -avH

SBFree 05-25-2009 11:06 AM

I can use cp with the -p toggle ok within the same machine but do not know how to specify the drive/directory on the networked machine. I am not familiar with rsync but it looks like I will still need to learn how to name the server where I want to send my files.
Thanks for the initial replies.
Scott

linuxlover.chaitanya 05-26-2009 12:10 AM

scp stands for secure copy. It is used to copy files over the network. The syntax is same as the cp.

scp -P <source> <destination>

If you want to use it for backup then rsync is the best option.

manville 05-26-2009 03:42 PM

I think SBFree is in the same boat as me. Nautilus/Gnome will open server shares graphically but does not seem to mount them within the file system so that they can be found and used within the terminal. Any advice would be gratefully recieved. So far i have learnt that I need to use smbmount but I am struggling to resolve my share name.

currently the command should be:
sudo smbmount //server/share /mountpoint/directory (then some options and password stuff that I'm still figuring out)

Once that works then cp/scp from the terminal will work nicely (as will my problem of using Picasa to search my network drive for photos)

My current problem is that although clicking through Nautilus will nicely mount an external drive attached via a BT Homehub, when I use smbmount to get it within the filesystem so I can find it I get the error which is paraphrased along the lines of "no ICP address". If I give the IP address of my Homehub the thing just times out without connecting.

Any clues? Or does Nautilus secretly mount the drive deep within the filesystem in a non-obvious place making the whole thing very straightforward if I could only get the right directory to reference?

(Using a wireless network setup on a laptop, with Ubuntu 9.04)

SBFree 05-26-2009 06:08 PM

I was able to mount the drive by using a local IP rather than a name with the following command:

scott@TWiki:~$ sudo smbmount //192.168.0.107/BackUp\ \(D\) /home/scott/htshare -o rw

cp did not preserve the date/time stamp across the network though. Using rsync worked for date/time stamp but changed the owner to root.

good luck
Scott

manville 07-13-2009 04:28 PM

I managed to solve what I wanted by adding winbind to my system and amending another file (which I think was nssconf but I may be wrong) to add WINS to the lookup mechanisms. I have lost the website link but will post when I find it again.

This enabled me to find my share without having to resort to IP addresses - which aren't clear when you're trying to connect to the BT HomeHub. I was then able to add it to fstab so that it is now automaticallly mounted at startup.
(My Fstab line reads:
//Thomson/BT_7G /media/lacie smbfs guest,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0)

I still can't get any of the linux tools to preserve date and time (despite using the relevant options) which seems to be down to the way CIFS/SAMBA work - which have been built from the ground up to approximate the Windows networking system as best as the developers can guess at. I can get the windows copy function to preserve date and time in that environment but my reason for using linux is that the tools are better (especially rsync for updating files).

Anybody know any workaround to get rsync to be able to update modified dates and times? Or is there a similar tool that is good for updating files/directories (I have a massive 55GB directory of photos I want to copy onto a rather slow share (My share is a FAT32 USB drive attached to my wireless network via a BTHomeHub) which I want to do in several sessions rather than leave my laptop powered up for a week or more.

manville 07-13-2009 04:48 PM

Link for setting up winbind:

See post from Featherking:

http://ubuntuforums.org/showthread.php?t=288022

File to edit is /etc/nsswitch.conf once winbind installed.


All times are GMT -5. The time now is 11:21 PM.