Best way to backup/image an Ubuntu install without using tar?

Eeezee

Diamond Member
Jul 23, 2005
9,922
0
76
I like how easy it is to backup a system by simply creating a .tar, but this method doesn't remove files, it only overwrites them. If I have additional files that didn't make it into my backup, then those files aren't touched at all. This has some advantages, but I don't like it.

What I really want is an image, something I can use to completely start over with whatever backup I want, so that I'll no longer have ANY of the files that aren't on the image. Any suggestions on the best way to do this?

(I'm mostly just terrified that I'll screw up my installation and have to restore a backup, and I don't want a bunch of system files laying around that I may no longer use or need - besides, all of my important data is on a separate partition, so I can wipe my OS as many times as necessary).

Edit: I thought of a solution; I can make a .tar backup and just reformat the partition before restoring. Der
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You should work with dd. Here's a guide that tackles using dd in an efficient way.

Except that dd isn't safe on a mounted filesystem and the image will be the size of the entire filesystem instead of the size of the data. There are ways to make it better but it's just much simpler to use tar or cpio.
 

Eeezee

Diamond Member
Jul 23, 2005
9,922
0
76
Originally posted by: Nothinman
You should work with dd. Here's a guide that tackles using dd in an efficient way.

Except that dd isn't safe on a mounted filesystem and the image will be the size of the entire filesystem instead of the size of the data. There are ways to make it better but it's just much simpler to use tar or cpio.

Yeah, I looked into dd and decided it's probably not the best way to do this. The images also require that the HDD have the same geometry; I'd like my backup to be potentially transferred to other disks
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
dd doesn't know anything about the geometry of the disk, it requires the target disk be at least as big as the source but that's it.
 

silverpig

Lifer
Jul 29, 2001
27,703
12
81
I was gonna say just .tar and then wipe the partition before untaring, but you figured that out.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
dd, source from a disk, target a file (on a bigger disk) -- pipe it through gzip or bzip2 if you like.
 

Vadatajs

Diamond Member
Aug 28, 2001
3,475
0
0
rsync with the --delete option is probably pretty close to what you're looking for.