Find the answer to your Linux question:
Results 1 to 9 of 9
Hello, I would like a quick, simple, manual way to backup my code at the end of the day. Currently, when I'm done programming on my school's Linux cluster for ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25

    Seeking simple, quick backup


    Hello, I would like a quick, simple, manual way to backup my code at the end of the day.

    Currently, when I'm done programming on my school's Linux cluster for the day I log out, which leaves me at another Linux computer that I have to pass through to get to the cluster. To save my code, I use the scp command as follows (where yyyymmdd is the date):
    Code:
    $ mkdir myproj.bak.yyyymmdd
    $ cd myproj.bak.yyyymmdd
    $ scp cluster.myschool.edu:project_directory/* .
    Password: 
    ... (files copied) ...
    This method works well: it's quick, simple, and notes the date of the backup and I control it (and I could probably even figure a way to write a script to make it a single command, if I made the effort). But it also changes the copied files' dates, which I do not like.

    Is there an quick, easy backup method, which I can use on command, which will date stamp the backup files?

    Note that I am using a Bash shell and that the cluster's disk space is not to be used for backup.

    Thanks

  2. #2
    Linux Newbie
    Join Date
    Jun 2012
    Location
    SF Bay area
    Posts
    148
    This might work and you could just make it script if you don't want to type it every time.

    Code:
    ssh cluster.myschool.edu tar cfz - project_directory >myproj.bak.$(date +%Y%m%d).tar.gz

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,345
    My recommendation would be to not use tar or scp here.

    Instead create a svn or git repository on the server, that is reachable via ssh.
    With that you do not need to worry about timestamps yourself,
    the transfer is much more efficient because only the diffs are needed
    and you get all the goodies of a revision control system (diffs, rollbacks, tool integration, etc), which a simple file backup doesnt have.
    You must always face the curtain with a bow.

  4. #4
    Linux Newbie
    Join Date
    Jun 2012
    Location
    SF Bay area
    Posts
    148
    Quote Originally Posted by Irithori View Post
    My recommendation would be to not use tar or scp here.

    Instead create a svn or git repository on the server, that is reachable via ssh.
    With that you do not need to worry about timestamps yourself,
    the transfer is much more efficient because only the diffs are needed
    and you get all the goodies of a revision control system (diffs, rollbacks, tool integration, etc), which a simple file backup doesnt have.
    I completely agree that a repository is better if you can set one up or use an existing one.

  5. #5
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,345
    Well, the repo needs its own backup (dump) then, but this is a different story
    You must always face the curtain with a bow.

  6. #6
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    880
    Quote Originally Posted by StupidUser View Post
    Hello, I would like a quick, simple, manual way to backup my code at the end of the day.

    Currently, when I'm done programming on my school's Linux cluster for the day I log out, which leaves me at another Linux computer that I have to pass through to get to the cluster. To save my code, I use the scp command as follows (where yyyymmdd is the date):
    Code:
    $ mkdir myproj.bak.yyyymmdd
    $ cd myproj.bak.yyyymmdd
    $ scp cluster.myschool.edu:project_directory/* .
    Password: 
    ... (files copied) ...
    This method works well: it's quick, simple, and notes the date of the backup and I control it (and I could probably even figure a way to write a script to make it a single command, if I made the effort). But it also changes the copied files' dates, which I do not like.

    Is there an quick, easy backup method, which I can use on command, which will date stamp the backup files?

    Note that I am using a Bash shell and that the cluster's disk space is not to be used for backup.

    Thanks
    From man page for scp:

    -p Preserves modification times, access times, and modes from the original file.

  7. #7
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25
    Quote Originally Posted by Irithori View Post
    My recommendation would be to not use tar or scp here.

    Instead create a svn or git repository on the server, that is reachable via ssh.
    With that you do not need to worry about timestamps yourself,
    the transfer is much more efficient because only the diffs are needed
    and you get all the goodies of a revision control system (diffs, rollbacks, tool integration, etc), which a simple file backup doesnt have.
    Quote Originally Posted by cnamejj View Post
    I completely agree that a repository is better if you can set one up or use an existing one.
    Quote Originally Posted by Irithori View Post
    Well, the repo needs its own backup (dump) then, but this is a different story
    Quote Originally Posted by cnamejj View Post
    This might work and you could just make it script if you don't want to type it every time.

    Code:
    ssh cluster.myschool.edu tar cfz - project_directory >myproj.bak.$(date +%Y%m%d).tar.gz
    svn and git are not installed and surely would not be. Admin's policy is not to allow backups (of any significant size, anyway) on the system. Besides, when - by which I mean "if" - I ever get this thing working, the data will take up plenty of disk space.

    I think tar is what I was looking for. I can use a combination of tar and scp to make the backup, then copy it to another system (and then remove it from the cluster).

  8. #8
    Just Joined!
    Join Date
    Dec 2012
    Posts
    1
    Old thread, I know, but you might want to check out ElephantDrive - we just made a linux package available.
    home.elephantdrive.com/linux/

  9. #9
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25
    Quote Originally Posted by mjjones View Post
    Old thread, I know, but you might want to check out ElephantDrive - we just made a linux package available.
    home.elephantdrive.com/linux/
    Thanks for the info. I still refer to this thread to refresh my memory, so it's not that old.
    ElephantDrive looks to be useful, but is overkill for my very simple needs and the admin would not allow this to be installed on our cluster.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •