5

I looked at the other question addressing this issue but I think I might have a different setup.

I too am trying to backup my Ubuntu machine, but here is the difference. I used Wubi to install Ubuntu 11.10 alongside Vista on my laptop. I have spent considerable time getting to this point in the setup that I decided that it was probably a good bet to back it all up to my external hard-drive.

So from various sources I gathered this: First I navigated to my external hard-drive then I created a backup folder on this drive and then I entered the following from the terminal:

sudo tar cvpzf mybackup.tgz2 --exclude="/host/*"  --exclude="/media/*" --exclude="/mnt/*" --exclude="/proc/*" --exclude="/tmp/*" /

And the process ran for about 20 minutes when it finally kicked out with the exiting message. I did notice the there were some read errors early on but it carried on processing then it had three 'files changes as we were reading' and 3 to 4 minutes later it exited.

Anyone have suggestions as what I can do to get this backup?

After running the backup now only with sudo tar cpf and all the previous exclusions plus adding --exclude="/dev/" I got these error:

tar: removing '/' from front of names
tar: /sys/module/bnep/sections/__mount_loc: file sharnk by 4085 bytes; padding with zeroes …. a whole bunch of these the paths are different
tar: /home/tom/.gvfs: cannot stat: permission denied
tar: /run/synaptic.socket: socket ignored …. 8 of these different folders
tar: /var/lib/citadel/data: file changes as we read it …. 5 of these different folders

Hopefully someone understands what is happening because I am a little alarmed that I have these errors. Thanks for any help or suggestions.

4
  • You may run the tar command without the z (so it doesn't compress and works faster - only if you can afford the extra disk space) and without the v (it won't output anything except errors). This may make the cause of the problem clearer. If you do and manage to get some additional error messages, please add them to your question. To be clear, do "tar cpf" and everything else remains without change.
    – roadmr
    Nov 10, 2011 at 21:09
  • You should probably add an --exclude"/dev/*" as well, otherwise you're trying to back up the raw disk files, etc.
    – deej
    Nov 10, 2011 at 21:22
  • Thanks roadmr and deej ... I am off to see what happens - railguage48 Nov 10, 2011 at 21:31
  • I have added the errors after running sudo tar cpf ... thanks Nov 10, 2011 at 22:05

2 Answers 2

7

What the messages mean

First, let's look at the messages individually:

tar: removing '/' from front of names

You told tar to archive absolute paths. By default (unless you pass the -P option), tar stores relative paths, e.g. it stores etc/fstab when you tell it to store /etc/fstab. This helps if you want to untar your backup in some subdirectory (the tar program on Ubuntu does this when you extract as well, so storing the absolute path only makes a difference if you extract the archive on a non-Linux system). You can ignore that message.

tar: /sys/module/bnep/sections/__mount_loc: file sharnk by 4085 bytes; padding with zeroes

This error is within /sys. Like /proc, the files under /sys are not stored on your disk, they are generated on the fly by the kernel and it doesn't make sense to back them up.

tar: /home/tom/.gvfs: cannot stat: permission denied

~/.gvfs is a mount point used by GVFS, the component of the Gnome desktop environment that allows access to network filesystems, archives and more. There is nothing to back up here.

tar: /run/synaptic.socket: socket ignored

A socket is a “meeting place” between clients and a server. There is no data stored there, and the server will create the socket when it starts. Backing up sockets is not necessary, so this message is harmless.

tar: /var/lib/citadel/data file changes as we read it

That message is what it says on the tin. If a file changes while you're making the backup, you can't necessarily expect to have the latest version of the file.

The state of your backup

Most of these warnings are harmless; you can selectively turn them off.

Rather than exclude the directories you know about, exclude all mount points, so that you'll end up backing up only what's on your disk. If you have several partitions (e.g. if you have a separate /home), make sure to list them all.

tar -czf mybackup.tgz --one-file-system /

I would say that you have a complete backup at this point. Of course, you should test it before you erase your data.

Further advice

Unless you're short on disk space, I recommend cloning your installation so that you can run it directly off the USB disk. (See Moving linux install to a new computer; also How to migrate user settings and data to new machine?)

Unrelated note: there are several typos in your post — “file sharnk” (the actual message is “file shrank”), “file changes as we read it” (the actual message is “file changed as we read it”). You should be copy-pasting those! Not doing copy-paste tremendously reduces the confidence we can have that the situation is as you describe. If your system doesn't normally display messages in English, run export LC_MESSAGES=C first to have error messages in English.

3
  • Thanks Gilles for your answer to my question. Your point on typo's is taken. I ran mybackup again, this time with --one-file-system and I still got the tar: Exiting with failure status due to previous error. So, do I actually have a complete backup despite the indication that it has a failure status? Also, I was wandering if you could comment on whether this is the correct procedure to re-install from mybackup.tgz2 .... sudo tar xvpfz mybackup.tgz2 / .... thanks again for your help. Nov 11, 2011 at 15:56
  • @railguage48 What were the previous error messages? The command to restore is correct, you don't need the final /; make sure you run it in the directory where you want to restore (which should be empty). Nov 11, 2011 at 16:08
  • Hi Gilles .... the previous error messages were the ones listed in my first posting ... umm ... the ones you dealt with in your posting. Thanks for clarification on the command to restore. Nov 11, 2011 at 17:15
1

About the errors you were encountering:

tar: removing '/' from front of names

This is not an error, it is just informing you of what it is doing. It is telling you that it is storing the path as a relative path. When you extract you will need to be in the root directory (i.e. / ) so that it extracts to /home...etc. and not /directory/you/are/in/home.

tar: /sys/module/bnep/sections/__mount_loc: file sharnk by 4085 bytes; padding with zeroes

There are several directories that are 'special' and should not be stored anywhere (since they are created on boot-up and contain nothing special that needs to be saved). These directories are

/dev
/proc
/sys

Indeed, trying to save them gives some strange results, as you are experiencing. Therefore, you should exclude them, just as you have done for /dev.

tar: /home/tom/.gvfs: cannot stat: permission denied

Without getting into the details why, you should not worry about this directory failing, as you probably don't want to include the contents. If you are really worried, you can exclude all gvfs errors with the

--exclude="/home/*/gvfs/*"

For more info see the wikipedia page

tar: /run/synaptic.socket: socket ignored …. 8 of these different folders

This is just informing you that it is ignoring sockets. These are created on bootup and as you use your computer, so you can trust it's judgement on this to ignore them.

3
  • Thanks Portablejim for your helpful response to my question. Am I correct in assuming then that I have a good backup despite the tar: Exiting with failure status due to previous error. ? Also, since this would close off the thread nicely, is this the correct procedure to re-install from mybackup.tgz2 .... sudo tar xvpfz mybackup.tgz2 / ?.... thanks again for your help. Nov 11, 2011 at 15:49
  • You would have an ok backup, as the error just says there were errors before (such as not being able to include .gvfs). Nov 11, 2011 at 22:52
  • It is not the correct command to extract. The correct command would be 'tar xvpzf mybackup.tgz2 -C /' Nov 11, 2011 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .