LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-09-2005, 06:44 PM   #1
chadman
LQ Newbie
 
Registered: Dec 2004
Posts: 26

Rep: Reputation: 15
Creating a hdd image


I want to create an image of my harddrive for backup purposes.

I want to put everything into an iso file. What would be the advantages and disadvantages of using dd and using mkisofs?

what, besides a graphical interface and making it easier, would be the advantage of using Linux Ghost (http://freshmeat.net/projects/g4l/)?
 
Old 02-09-2005, 07:08 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Just use dd, very efficient, use mkisofs if you want to change your file systems structure
but take care or it will break permissions.

I never used Linux Ghost for my part
 
Old 02-09-2005, 08:36 PM   #3
chadman
LQ Newbie
 
Registered: Dec 2004
Posts: 26

Original Poster
Rep: Reputation: 15
what do you mean by "change my file system's structure?" What would hapen if I used some program to add files to the iso file dd generated and then tried to reimage the drive?

Also, can dd restore files from an ISO to an NTFS partition?

Last edited by chadman; 02-09-2005 at 09:41 PM.
 
Old 02-09-2005, 11:40 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,399

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Quote:
Also, can dd restore files from an ISO to an NTFS partition?
Haven't tried it on for an NT partition but, in theory, it should work, even though writing to NT partitions isn't considered safe. The reason is that you're not writing to an NT filesystem, per se, but rather just copying raw bytes to and from disk. If you made a copy of the entire NT parttion using "dd if=/dev/nt-patition of=snapshot-file", you can use that to restore the NT partition using "dd if=nt-partition-snapshot-file of=/dev/nt-partition". Be sure and umount the partition before making the snapshot; any changes made to the filesystem while the "dd" operation is running would render the snapshot worthless.

I'm still trying to figure out why putting the snapshot into an ISO format file would be useful. So I can't comment on that. It's not as though you actually have to mount the snapshot to use it for restores. It's just a sequence of bytes.

BTW, I would also record the partition information as well as to do the restore, especially if you should need to replace the physical drive. You'll want the partition you restore to to be the exact size as the original. Restoring to a larger partition would probably be invalid since there would be blocks in the partition that you wouldn't be restoring and who knows what sort of garbage would be sitting out there when the restore is done. And you may not even be able to access the additional space. (And even if you could, one wonders what Windows would do when it suddenly sees space it never knew about before. It'd probably freak and scribble something where you least wanted something scribbled.)

I said "in theory" above because the process I described is what I used to do to make snapshots of Win95 systems onto ext2/3 filesystems where they'd be copied to tape (or, sometimes, dd'd directly to tape). That gave me something that I could restore back onto the system if some Windows application install went haywire. Pulling that snapshot from tape or disk was tons faster than having to reload Windows from CDs long with all the applications back up to the point of the failed install. Worked like a charm. The only downside -- if you can call it that -- was that you needed a Linux setup on each system where you wanted to make the snapshot as well as enough disk space. Knoppix came along a few years too late. Well, that, and DVD burners were unknown at the time (though my old NCR SCSI card and DDS drive came in quite handy for this).
 
Old 02-10-2005, 12:41 AM   #5
chadman
LQ Newbie
 
Registered: Dec 2004
Posts: 26

Original Poster
Rep: Reputation: 15
dd will do a raw-write at the byte-level when I re-image the drive, but how does it update the file-system? How will the newly written file-system (same type of fs of course) know where the files are after partitioning and reformatting?

What else would I use beside an ISO?

Basically my goal is this. When I made the partitions, I made an ext3 root partition for Linux and an NTFS partition for Windows. I made them different sizes, and now I want to make the exactly the same size. I'm just picky like that :-) So do you know (for sure or pretty sure) if I will have any problems re-imaging the partitions when they are resized? The Linux partition is going to be several GB smaller and the Windows partition will be several GB larger.

(edit) Oh wait come to think of it, the file-system must be stored in the first blocks of the partition, so I assume dd will copy the file-system along with the files?

Last edited by chadman; 02-10-2005 at 12:42 AM.
 
Old 02-10-2005, 01:43 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,589

Rep: Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507Reputation: 3507
Think about it - do you *really* want a "byte image" ???.
I may be wrong, but I believe any restore will need (at least) the same size partition.

Try tar, or maybe look at dar
Allows you to write to CD/DVD, and spill across more than 1 - also has differential backups.

Haven't tried it yet, but it looks just the thing.
 
Old 02-10-2005, 01:51 AM   #7
chadman
LQ Newbie
 
Registered: Dec 2004
Posts: 26

Original Poster
Rep: Reputation: 15
All I really want is to even out the partitions without reinstalling

My partitions are as follows:

/boot 100 GB
/ 50GB
[swap] 512MB
windows - ntfs 30GB

I was planning on imaging the root partition (hda3) and the Windows partition (hda4) into two separate files. I was not planning on imaging the entire drive (hda).

Last edited by chadman; 02-10-2005 at 01:59 AM.
 
Old 02-10-2005, 02:08 AM   #8
Lazarus
Member
 
Registered: Dec 2001
Location: Kent in UK
Distribution: Fedora 2
Posts: 170

Rep: Reputation: 30
I have always used tar to back up linux partitions. Then no problem when restoring. To restore to a new hd I boot from a rescue cd, make a new filesystem in my case
mkreiserfs /dev/hda2 and restore from tar. Tar archive can be on my 2nd hd, a dvd or another pc on the network.
Always worked for me!
 
Old 02-10-2005, 03:34 AM   #9
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
There seems to be no documentation at all for g4l so I can't help you there. I can tell you that partimage will do exactly what you want. It does work on ntfs partitions however the author insists ntfs support is in "experimental" stage.

As far as the advantage over dd, you can select gzip or bzip2 compression to make the images much easier to store.

<edit> Also dd will store the entire partition even unused blocks whereas partimage only stores used blocks.

Last edited by /bin/bash; 02-10-2005 at 03:41 AM.
 
Old 02-10-2005, 09:57 PM   #10
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,399

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Quote:
Originally posted by chadman
dd will do a raw-write at the byte-level when I re-image the drive, but how does it update the file-system? How will the newly written file-system (same type of fs of course) know where the files are after partitioning and reformatting?
Maybe it's just semantics, but I consider all the blocks in the partition (once you've used mkfs on it) as "the filesystem". I think Windows does as well. I'm no NTFS expert (by anyone's estimation) but I think that more than just the first few blocks are involved in in keeping track of files. (And I think this has been true since DOS 2.0.)
Quote:
What else would I use beside an ISO?
You can store a snapshot of a Windows partition in a regular, garden variety Linux file on one of your ext2/ext3/Reiser/jfs/xfs filesystems. As ISO file -- to me, at least -- means something that is found on a CD or a disk file that you access by mounting it through the loopback device and specifying "-t iso9660". That's not really necessary fo making this sort of copy of the NTFS filesystem.
Quote:
Basically my goal is this. When I made the partitions, I made an ext3 root partition for Linux and an NTFS partition for Windows. I made them different sizes, and now I want to make the exactly the same size. I'm just picky like that :-) So do you know (for sure or pretty sure) if I will have any problems re-imaging the partitions when they are resized? The Linux partition is going to be several GB smaller and the Windows partition will be several GB larger.
My understanding of this is that you will experience problems. This sort of sounds like a job for Partition Magic or whatever it's called. I doubt that something like "tar" is going to be much help since the NTFS filesystem is still not written to (reliably) by Linux. If you have something that you can copy (using tar, cpio, what-have-you) the contents of the Linux root filesystem onto, you could restore that onto a resized Linux partition.
Quote:
(edit) Oh wait come to think of it, the file-system must be stored in the first blocks of the partition, so I assume dd will copy the file-system along with the files?
Um, I still think your thinking of the old FAT "filesystem". "dd" doesn't read the filesystem, really, but the blocks that belong to the partition. It's sort like "dd if=photo.jpg of=saved.file" doesn't mean that "dd" has any idea at all that it's dealing with imagery. It's just a sequence of data as far as "dd" knows. For example, I have made copies of CDs that cannot be mounted by Linux (VMS FILES-11 CDs, for example) using "dd" to copy them to a big Linux disk file and then "dd"ing that file onto the CD-RW drive. "dd" doesn't know diddly about what's on the CD but it can copy it quite nicely.

I think a useful rule might be to use block-oriented tools (like "dd") if you're looking to duplicate a filesystem into a like-sized partition and file-oriented tools (tar, cp, cpio, and the like) if you need to move the contents of the filesystem to another like-size or resized partition. Since you're wanting to resize an NTFS, a file-oriented one would be my choice. But then, aargh!, it's NTFS so it's not safe to write to with Linux. So something like Partition Magic or a similar program might be an option; maybe your only option. (Assuming that even something like that can safely write to an NTFS filesystem.)

If you're, heh heh, on good terms with Microsoft's Windows activation crew, you could just save all of your data onto a CD-ROM, reinstall Windows onto the resized partition, and then copy the data back from the CD. (Maybe that's where you were coming from with the ISO file. :-)

Sorry if this is long. This isn't a very simple thing to pull off (it would be far simpler if Windows weren't involved) and I'd hate to hear about you losing data. Just be careful to make sure you have your data files on some media that you can read back using a tool native to the OS that the data files came from.

--
 
Old 02-10-2005, 10:12 PM   #11
chadman
LQ Newbie
 
Registered: Dec 2004
Posts: 26

Original Poster
Rep: Reputation: 15
thanks for the reply. If I did make a tar file of my Windows partition, could I stick the drive in another computer running windows and then extract the files onto my drive? Would this mess up the location of system files (they're usually all together near the beginning of the disk)?
 
Old 02-10-2005, 10:16 PM   #12
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 57
Code:
cat /dev/hda1 > some_file
# move hdd
cat some_file > /dev/hdxY
That'll do a raw copy, files, filesystem, everything.
 
Old 02-17-2005, 03:24 PM   #13
yhetti
LQ Newbie
 
Registered: Feb 2005
Distribution: Debian
Posts: 1

Rep: Reputation: 0
The difference is that tar operates on files (like /etc/passwd, /home/user/some.mp3). dd and Ghost operate on the physical device, below the filesystem.

Backing up NTFS via tar is a bad idea, because tar has no concept whatsoever of NTFS permissions. Backing up NTFS via dd is fine, because dd doesn't care at all what data is on the drive. When you store bytes in, you get bytes out. When you store files in, however, you also have to deal with out-of-band data like access times, permissions, FAT tables, etc. Raw drive reads/writes don't have to take all that into account.
 
Old 02-17-2005, 07:06 PM   #14
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
ntfsclone is pretty handy
creates a sparse image which can be mounted via loopback
 
Old 02-17-2005, 07:51 PM   #15
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Also, can dd restore files from an ISO to an NTFS partition?
Yes. I have done it. I even wrote a tutorial describing it, and a friend of mine hooked it (with my permission) and placed it on his website (the original is located on The Motley Fool, which is a pay site).

Look here:

http://www.williamaford.com/CloningaHDD.php

Quote:
Basically my goal is this. When I made the partitions, I made an ext3 root partition for Linux and an NTFS partition for Windows. I made them different sizes, and now I want to make the exactly the same size. I'm just picky like that :-) So do you know (for sure or pretty sure) if I will have any problems re-imaging the partitions when they are resized? The Linux partition is going to be several GB smaller and the Windows partition will be several GB larger.
You will NOT be able to image the old Linux partition back to the new partition. You could just mount the iso you create using dd, then just copy the files back to the new partition.

You will be able to image the old NTFS partition back to the new partition, but you then will have to resize the file system. Look into resizentfs to see how to do this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize HDD image thesystem Linux - General 1 10-02-2005 03:28 PM
how to make mirror image of one hdd to 2 hdd raj_1 General 1 12-02-2004 06:19 PM
How to make mirror image of linux partion to one1 HDD TO 2 HDD raj_1 Linux - General 2 11-04-2004 01:45 AM
HDD image zchoyt Linux - General 3 09-29-2004 10:25 AM
How can I boot from a CD image on the hdd? mmurch01 Linux - Software 1 03-22-2004 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration