LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-25-2009, 07:28 AM   #1
SBFree
Member
 
Registered: Nov 2004
Distribution: Ubuntu
Posts: 62

Rep: Reputation: 15
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
 
Old 05-25-2009, 08:01 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
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").
 
Old 05-25-2009, 08:34 AM   #3
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,591

Rep: Reputation: 162Reputation: 162
rsync -avH
 
Old 05-25-2009, 11:06 AM   #4
SBFree
Member
 
Registered: Nov 2004
Distribution: Ubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
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
 
Old 05-26-2009, 12:10 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
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.
 
Old 05-26-2009, 03:42 PM   #6
manville
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
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)
 
Old 05-26-2009, 06:08 PM   #7
SBFree
Member
 
Registered: Nov 2004
Distribution: Ubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
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
 
Old 07-13-2009, 04:28 PM   #8
manville
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
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.
 
Old 07-13-2009, 04:48 PM   #9
manville
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
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.
 
  


Reply

Tags
copy, mount, nautilus, network, smb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cut out a date/time stamp by using SED and scripting studdard Programming 4 03-01-2009 11:58 AM
How can I append the date/time stamp to commands in history? abefroman Linux - Security 2 05-29-2008 11:21 AM
Copy Date/Time without actual files? - a real head scratcher tbeehler Linux - Software 17 07-25-2007 04:20 AM
Rename file based on its own date/time stamp airman99 Linux - General 19 09-05-2006 07:52 AM
Time stamp in Samba is 11 hours behind time stamp in Linux Linh Linux - General 3 09-04-2003 12:44 PM


All times are GMT -5. The time now is 09:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration