Results 1 to 7 of 7

Thread: difficulty creating tar.gz file for "home" folder

  1. #1
    Join Date
    Mar 2014
    Beans
    18

    difficulty creating tar.gz file for "home" folder

    I was unable to copy my home folder (I wanted to back it up) to a flash drive. and someone here in the forum suggested putting the contents of the home folder into a tar.gz file. So I learned how to make tar.gz files via this formula:

    tar czf new-tar-file-name.tar.gz file-or-folder-to-archive

    However when I tried to make a tar.gz file for the home folder and entered this (in the terminal):

    tar czf BackupSpecial.tar.gz home

    (I'm naming my file BackupSpecial) it didn't work.

    Here's the screenshot.

    Can somebody please help me get this to work? Thanks.
    Attached Images Attached Images

  2. #2
    Join Date
    Nov 2008
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: difficulty creating tar.gz file for "home" folder

    Quote Originally Posted by gregg3 View Post
    I was unable to copy my home folder (I wanted to back it up) to a flash drive. and someone here in the forum suggested putting the contents of the home folder into a tar.gz file. So I learned how to make tar.gz files via this formula:

    tar czf new-tar-file-name.tar.gz file-or-folder-to-archive

    However when I tried to make a tar.gz file for the home folder and entered this (in the terminal):

    tar czf BackupSpecial.tar.gz home

    (I'm naming my file BackupSpecial) it didn't work.

    Here's the screenshot.

    Can somebody please help me get this to work? Thanks.
    Your in your root directory, which you do not have permission to write to.

    Perhaps,
    Code:
    sudo mkdir /opt/backup
    sudo chown -R gregory:gregory /opt/backup
    tar czf /opt/backup/HomeBackup.tar.gz /home
    Which will create a HomeBackup.tar.gz file in /opt/backup that you can access.

    There are also other ways of backing up automatically, such as using duplicity, crashplan, rsync, and clonezilla to name a few.
    Ubuntu Forums Moderation Staff
    So don't be ashamed to wear your crown, you're a king you're a queen inside and out

  3. #3
    Join Date
    Mar 2014
    Beans
    18

    Re: difficulty creating tar.gz file for "home" folder

    Quote Originally Posted by sandyd View Post
    Your in your root directory, which you do not have permission to write to.

    Perhaps,
    Code:
    sudo mkdir /opt/backup
    sudo chown -R gregory:gregory /opt/backup
    tar czf /opt/backup/HomeBackup.tar.gz /home
    Which will create a HomeBackup.tar.gz file in /opt/backup that you can access.

    There are also other ways of backing up automatically, such as using duplicity, crashplan, rsync, and clonezilla to name a few.
    Thanks sandyd. I tried your suggestion. Unless I did something wrong, it didn't seem to work. (see screenshot) And I've read using

    sudo thunar

    can work to copy the home folder and paste it to a usb drive. True?
    Attached Images Attached Images
    Last edited by gregg3; March 18th, 2014 at 08:32 AM. Reason: adding something

  4. #4
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,520
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: difficulty creating tar.gz file for "home" folder

    I think you will find that worked apart from a couple of folders that you don't really want backed up anyway.

    Don't use sudo thunar to copy the files to the pen drive. The pen drive will have a filesystem that cannot store unix file permissions, so although the file contents might look OK, copying the files back from the pen drive will mess up all the file permissions and cause some odd breakages. It's OK to store just documents that way, but not all the settings files etc. that you get in a backup of your whole home folder.

    tar will store the file attributes correctly and will restore them as you extract the files again.

  5. #5
    Join Date
    Nov 2008
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: difficulty creating tar.gz file for "home" folder

    try
    Code:
    tar -zcvf /tmp/mybackup.tar.gz --exclude='/home/gregory/.cache/dconf' --exclude='/home/gregory/.dbus' /home
    try
    Code:
    tar -zcvf /tmp/mybackup.tar.gz --exclude='home/gregory/.cache/dconf' --exclude='home/gregory/.dbus' /home
    if it still complains
    Ubuntu Forums Moderation Staff
    So don't be ashamed to wear your crown, you're a king you're a queen inside and out

  6. #6
    Join Date
    Mar 2014
    Beans
    18

    Re: difficulty creating tar.gz file for "home" folder

    Quote Originally Posted by The Cog View Post
    I think you will find that worked apart from a couple of folders that you don't really want backed up anyway.

    Don't use sudo thunar to copy the files to the pen drive. The pen drive will have a filesystem that cannot store unix file permissions, so although the file contents might look OK, copying the files back from the pen drive will mess up all the file permissions and cause some odd breakages. It's OK to store just documents that way, but not all the settings files etc. that you get in a backup of your whole home folder.

    tar will store the file attributes correctly and will restore them as you extract the files again.
    Thanks Cog. That's very good to know. Appreciate it.

  7. #7
    Join Date
    Mar 2014
    Beans
    18

    Re: difficulty creating tar.gz file for "home" folder

    Quote Originally Posted by sandyd View Post
    try
    Code:
    tar -zcvf /tmp/mybackup.tar.gz --exclude='/home/gregory/.cache/dconf' --exclude='/home/gregory/.dbus' /home
    try
    Code:
    tar -zcvf /tmp/mybackup.tar.gz --exclude='home/gregory/.cache/dconf' --exclude='home/gregory/.dbus' /home
    if it still complains
    Thanks, Sandy. I ran the first command and the computer ran through a million files, but I don't know what it ended up creating or doing. I took a screenhot of it when it was done so maybe you can tell me? Thanks.
    Attached Images Attached Images

Tags for this Thread

Bookmarks

Posting Permissions

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