Find the answer to your Linux question:
Results 1 to 7 of 7
Hi all.. I have a backup of my /usr/ /var/ directories. They are in .tar.gz format. I was wondering how I replace my /usr/ directory with what I have on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15

    Tarball


    Hi all..

    I have a backup of my /usr/ /var/ directories.
    They are in .tar.gz format.

    I was wondering how I replace my /usr/ directory with what I have on my system without losing any files, just adding/replacing.

  2. #2
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246

    Re: Tarball

    Quote Originally Posted by manipura
    I was wondering how I replace my /usr/ directory with what I have on my system without losing any files, just adding/replacing.
    What exactly do you mean when you say "what I have on my system"? Do you want to replace the files that are in your tarball with the ones in your /usr directory, or vice versa? I don't think I understand what you mean by "without losing any files". Losing files from where?
    Situations arise because of the weather,
    And no kinds of love are better than others.

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15
    Sorry, bad way of saying it.

    I just want to unload the /usr directory of my tarball into the /usr directory on my computer. I extracted it into a folder and tried cp and mv /usr / but it either said can't overwrite or omitting /usr

  4. #4
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    Did you do this as root? The /usr directory is usually owned by root and has its permisions set to 755 so that only the user root can write to it (not even members of the group root). In order to unpack your tarball to /usr, you'll need to be root.

  5. #5
    Just Joined!
    Join Date
    May 2004
    Location
    Pennsylvania
    Posts
    98
    Quote Originally Posted by manipura
    omitting /usr
    This is because the copy command needs to have the -r flag (recursive)

    It will copy all files recursivesly then.

    you need (as root like dan@george said)
    Code:
    cp -r usr /usr
    this will prompt you before replacing files.

    to automaticlaly replace files use this:
    Code:
    cp -rf usr /usr

  6. #6
    afm
    afm is offline
    Just Joined!
    Join Date
    Jul 2004
    Posts
    7

    Re: Tarball

    Quote Originally Posted by manipura
    (...)I was wondering how I replace my /usr/ directory with what I have on my system without losing any files, just adding/replacing.
    1. Unpack /usr/ from the tarball somewhere else (let's use /var/tmp)

    2. mv /usr /usr.old

    3. mv /var/tmp/usr /

    4. Test if everything is working correctly

    5. rm -f /tmp/usr.old

    Notes:
    - Things get more complicated if /usr is on a separate partition.
    - If your HD space cannot afford two /usr trees, you can do 5 inbetween 2 and 3, but you'll be in bad trouble if something wrong happens in the middle of the process
    - Watch out for /usr/local stuff

  7. #7
    Just Joined!
    Join Date
    Jul 2004
    Location
    Calgary Alberta Canada
    Posts
    15
    Awesome, Thanks guys!

Posting Permissions

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