Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

 
random_task
Gerbil First Class
Topic Author
Posts: 148
Joined: Sun Jun 18, 2006 3:20 am
Location: Tucson

Backing up windows from linux?

Sat Apr 14, 2007 12:37 am

How I would go about completely backing up my windows drive from linux (Ubuntu specifically)?

I back up my Ubuntu drive using tar, and it works perfectly, so I was hoping there might be a way to do that to my windows drive from linux. I know I could make the backup file, but I dont know if I'll be able to recover it. Mostly, I'm worried about whether or not I'll be able to write to an NTFS safely.

I think a bit by bit image will work, but I'm not sure. Does anyone know how to do something like this?

Thanks in advance by the way!
 
Usacomp2k3
Gerbil God
Posts: 23043
Joined: Thu Apr 01, 2004 4:53 pm
Location: Orlando, FL
Contact:

Sat Apr 14, 2007 1:26 am

If you have a local ftp server handy, I've had great success with G4U in the past. It's a bit-by-bit partition copier.
http://www.feyrer.de/g4u/
 
bitvector
Grand Gerbil Poohbah
Posts: 3293
Joined: Wed Jun 22, 2005 4:39 pm
Location: San Francisco, CA

Re: Backing up windows from linux?

Sat Apr 14, 2007 1:29 am

random_task wrote:
I know I could make the backup file, but I dont know if I'll be able to recover it. Mostly, I'm worried about whether or not I'll be able to write to an NTFS safely.

I think a bit by bit image will work, but I'm not sure. Does anyone know how to do something like this?

There are basically three ways to do this: using tar, using dd, and using partimage. tar will archive the files like you want, but it's not a "perfect" filesystem image, just a copy of the contents -- doing it this way will probably cause you to lose things like file ownership and permissions. Not recommended for whole drive backups. dd will make a raw copy of a disk or partition, and partimage will also make a copy of a disk or partition, but more like Norton Ghost does where it understands the filesystem so it doesn't just do a bit-for-bit copy of the entire partition including empty/unused blocks. That means the partimage images are smaller, but dd is more bulletproof. Partimage may not be able to generate an image for certain NTFS partitions with a lot of fragmentation or using the NTFS encryption/compression options.

1) You can write to NTFS safely with ntfs-3g, but I wouldn't necessarily recommend doing the backup that way using tar. It is handy if you want to easily access to a few directories or files, though.

2) As far as a doing a perfect image, you can simply use dd and capture the entire partition into a file (e.g. dd if=/dev/hda3 | gzip -c partition_img.gz). You can also pull files/directories out of a dd style image because you can mount it via loopback as if it was a real disk and use it that way. I use dd when I want to deploy a bunch of identical installations to machines across a cluster. I'll install on one machine and use dd and netcat to multicast the image to a bunch of other nodes and write it to their disks.

3) partimage also can make images of NTFS partitions. I've done it before and it usually works fine. Sometimes I've needed to run the Windows defragmenter to make it faster/work.
 
bitvector
Grand Gerbil Poohbah
Posts: 3293
Joined: Wed Jun 22, 2005 4:39 pm
Location: San Francisco, CA

Sat Apr 14, 2007 1:30 am

Usacomp2k3 wrote:
If you have a local ftp server handy, I've had great success with G4U in the past. It's a bit-by-bit partition copier.
http://www.feyrer.de/g4u/

That's a good program, but that doesn't really let OP do it from Linux as he asked since g4u is a NetBSD-based bootable image.
 
Usacomp2k3
Gerbil God
Posts: 23043
Joined: Thu Apr 01, 2004 4:53 pm
Location: Orlando, FL
Contact:

Sat Apr 14, 2007 1:33 am

bitvector wrote:
Usacomp2k3 wrote:
If you have a local ftp server handy, I've had great success with G4U in the past. It's a bit-by-bit partition copier.
http://www.feyrer.de/g4u/

That's a good program, but that doesn't really let OP do it from Linux as he asked since g4u is a NetBSD-based bootable image.

I guess it seemed to me that he was asking for something that would do it outside of his Windows boot.
Regardless, g4u uses dd, so there's not really any point in the suggestion since you provided a much more detailed and better one :-)
 
random_task
Gerbil First Class
Topic Author
Posts: 148
Joined: Sun Jun 18, 2006 3:20 am
Location: Tucson

Sat Apr 14, 2007 1:48 am

Thanks for the info!

One thing I should mention is that the source drive is larger (320GB) than the target drive (250GB). There's only 100 GB of data on the source drive though, but if I do a sector by sector copy I'll probably run out of space.

Maybe if I copy a chunk of the drive at a time, and compress each chunk individually, I could work around the space limitation. I'm not quite sure how to do that though.

bitvector, you mentioned using ntfs-3g to access the files. If I did have full NTFS access, would the tar method work? If it did, then maybe I could use something like ntfs-3g or Captive NTFS with tar?
 
bitvector
Grand Gerbil Poohbah
Posts: 3293
Joined: Wed Jun 22, 2005 4:39 pm
Location: San Francisco, CA

Sat Apr 14, 2007 2:08 am

random_task wrote:
One thing I should mention is that the source drive is larger (320GB) than the target drive (250GB). There's only 100 GB of data on the source drive though, but if I do a sector by sector copy I'll probably run out of space.

Well, as I said, you could use partimage, which only copies live data on the partition. If there's about 100GB of data, the image will be about that size. That's probably your best option given these constraints.

Alternately, the command for dd that I provided is piping the output to gzip as it is writing the file. In theory, that should be able to make the file less than the partition size because a lot of the unused space should be compressable, but it is also possible that the "empty" space contains a bunch of random junk that isn't compressable. You could do a test to find out, though.

random_task wrote:
bitvector, you mentioned using ntfs-3g to access the files. If I did have full NTFS access, would the tar method work? If it did, then maybe I could use something like ntfs-3g or Captive NTFS with tar?

Well, as I said, the thing with tar is you'll lose NTFS metadata like permissions and ownership since when NTFS is mounted the ownership of files gets mapped to Unix users. I'd say that makes it not a good idea for whole-drive backups.
 
Flying Fox
Gerbil God
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Sat Apr 14, 2007 6:12 am

If only files needed to be backed up, I thought people have been using rsync?
The Model M is not for the faint of heart. You either like them or hate them.

Gerbils unite! Fold for UnitedGerbilNation, team 2630.
 
morphine
TR Staff
Posts: 11600
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Sat Apr 14, 2007 7:26 am

Flying Fox wrote:
If only files needed to be backed up, I thought people have been using rsync?

Ditto. It can even be so easy as setting up a shared folder on the Windows machine, mounting it and rsync'ing it.
 
bitvector
Grand Gerbil Poohbah
Posts: 3293
Joined: Wed Jun 22, 2005 4:39 pm
Location: San Francisco, CA

Sat Apr 14, 2007 12:53 pm

Flying Fox wrote:
If only files needed to be backed up, I thought people have been using rsync?

That's good for Unix filesystems, but for when reading NTFS from Linux this has the same problem as tar: you'll lose all of your NTFS ownership, permissions, etc.

And BTW, if you like rsync, take a look at Unison. Unison is a great tool that is more advanced than rsync in some ways, like it can handle reconciling differences to both sides of a replicated tree. So, for example, if you have a directory on your laptop and desktop that you want to keep in sync, it's no problem to make updates on both machines and reconcile them later.
 
bitvector
Grand Gerbil Poohbah
Posts: 3293
Joined: Wed Jun 22, 2005 4:39 pm
Location: San Francisco, CA

Sat Apr 14, 2007 1:24 pm

And random_task, while looking through the tools in ntfsprogs (the project that made ntfsmount which led to ntfs-3g), I noticed there is also a tool called ntfsclone, which can make a sparse image of an entire NTFS partition. So this mechanism is similar to partimage, but tailored specifically to NTFS, and it might also be worth a look.

http://wiki.linux-ntfs.org/doku.php?id=ntfsclone
 
random_task
Gerbil First Class
Topic Author
Posts: 148
Joined: Sun Jun 18, 2006 3:20 am
Location: Tucson

Sun Apr 15, 2007 8:15 pm

Wow! ntfsclone looks like it will do what I want pretty well! Thanks for your help guys!

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On