Making a full backup of the pod using tar command

0 views
Skip to first unread message

mattmcc999

unread,
May 8, 2008, 12:10:58 PM5/8/08
to Rochester iPhone/iPod touch Users
Copying the entire structure of the file system on the pod requires
command-line Unix. I could suggest using an FTP UI-intense client but
what they do is sometimes too opaque for my tastes. There are too
many symlinks and so on that throw the system, and on top of that,
there seem to be a total of 3 mounts in the system. What I want to do
it get the entire thing over in one backup file. Enter the "tar"
command.

Here's what I did and it seems to have worked for me. Caveat: I have
NOT tried to restore this backup file to any pod. I have no idea of
doing so will restore it exactly to the state it was in when the tar
was executed. I doubt it would be possibly frankly since as the OS is
running, files are getting modified, even if you execute tar and leave
the pod alone til it's done.

Anyway, here is what I did:

1. Opened Putty and connected to the pod
2. cd /
3. pwd (to make sure I am at /)
4. cd var
5. mkdir TARBACK
6. chmod 777 TARBACK
7. cd /
8. tar cfz /var/TARBACK/backup.tar.gz /
[ -- take a look: http://www.math.utah.edu/docs/info/tar_3.html#SEC36
]
[ -- can also add an ampersand at the end of that line if you want
to background the tar
process; see http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/Processes.html#tth_sEc3
]
[Note I am gzipping this whole thing too, with the 'z' parameter.
I wouldn't try to just tar all
these files without gzipping them as well. Another thing to look
out for: if you do this remem-
ber you are creating the backup file on the pod itself. So it
needs to have the diskspace
necessary to hold the backup file. Caveat I would say is to make
sure you have as much
on /var as you have taken up with all your files on both / and /
var. Go to BossPrefs and
touch "More" and then "Show Free Disk Space" to make sure you have
the room. You can
get this info too in a Unix term by using df -k (see
http://en.wikipedia.org/wiki/Df_(Unix) )]
9. Took about 15-20 mins for it to run. When I was done, I had a ~660
MB tar-gzipped file at /var/TARBACK.
10. I ftp'd the file back to my PC for safe-keeping. I opened it in
some zip-reader (can't remember which one it was-- I have like 3 on my
home PC) and checked for completeness. It looks like it got the /var
directory no problem but also tried to add itself to the file! And it
did, some part of itself anyway. So I learned here to add an exclude
of that file to the command for next time. See:
http://www.math.utah.edu/docs/info/tar_6.html#SEC64
11. Now I am running tar to check/compare to the current system. The
command is:
tar -d /var/TARBACK/backup.tar.gz /
[ What I actually ran was this:
tar -d /var/TARBACK/backup.tar.gz / > tardiffs.txt
This way the diff report goes to tardiffs.txt ]
[ See http://www.math.utah.edu/docs/info/tar_4.html#SEC54 ]

That's where I am at. So I'll see what the diff output looks like
when it's done. But the fact that the tar command completed with no
errors and that the symlinks were tarred w/out incident is well is a
very good sign.

I tested this approach first, btw, by running these commands not on
the entire files ystem (/) but on /bin. It seemed to work OK for /bin
so I decided to just go for it. So far it seems to have worked.

Now may I never have to try to restore a pod with such a file. I
suppose I could experiment by taking another pod and starting from
jailbreak, up the backup file to / and then un-tar everything to /. I
wonder how that would go, as I try to overwrite currently-open system
files, etc.

This is why this method of backing up the entire pod file system does
not fill me with 100% confidence. But I do know all my pref and media
content files are now backed up and I pretty much have a full listing
of all the apps I have on the pod (this btw would be a real neat tool
to have-- an installed app that lists all the apps you have and their
prefs. Maybe this is my next project, dunno). But at least now I can
go in and extract stuff if I need to and upload it or replace things
on a file-by-file basis if I think I need to later.

Anyone else try this approach to a full pod backup?




Reply all
Reply to author
Forward
0 new messages