sudo tar cvpzf exiting with failure due to previous error
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.
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.
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.