Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I recently installed ubuntu LTS 6.06 after my mandriva distro was fried up. Now I have got everything in place but through the network installation. So I don't have the packages. My root partition where I install everything (home parition is different) is about 3.8 GB filled up. Can I create an bootable image of the partition (byte-by-byte copy)? So that if anything goes wrong, I can byte-by-byte copy the image back on the bootable root partition and restore the system again?
What do you mean by "bootable root partition" in this context? Linux does not use the active flag as in Windows.
How is this system set up--eg is there a dual-boot with Windows? Where is the bootloader installed? eg in the mbr or in the boot sector or you Linux partition?
To clone a partition, the dd command can be used. It does not compress, so you will need disk space big enough.
Search here at LQ for a really good tutorial on dd by AwesomeMachine
(1) Get hold of a spare hard disk in an external enclosure so that it works as an external hard disk via a USB port.
(2) Run cfdisk program in Linux and create a partition identical size to the partition you want to clone. Say external partition is sda1 and the partition to be cloned is hda3.
(3) clone the partition by command
dd if=/dev/hda3 of=/dev/sda1
(a) It is imperative that the sda1 is exactly the same size as hda3. You can ask cfdisk to display the exact sector or Mb size to match the two.
(b) Adding the block size parameter "bs=32768" can improve the transfer rate. Without it dd defaults to bs=512 bytes and each transfer is one complete sector. 32768 = 63 sectors times 512 or one complete track to be cloned at a time.
(c) If you want an easy job clone the whole disk. Just make sure the target disk is exactly equal or larger than the source disk. Drop the number in the partition reference, i.e input file = hda and output file = sda. dd will not work if the taget disk is smaller as the an OS cannot cope with a hard disk showing partition size larger than it physical size.
(d) If the whole disk is cloned it can replace the original disk and boots exactly the same. The excess capacity become unallocated space which can be incorporated into existing partitions by gparted or Parted Magic software.
A lot of the suggestions above were mentioned and scrutinized in this thread link below, I made a suggestion towards newer technology which apparently made the thread starter "giddy". I have stress free computing environment with this stuff. I do not ask questions at LQ because I solve my own problems with this. It gives me the freedom to hack away hard without any worries.
I am just curious why people would want to put a partition of 3.8Gb image into a file and not in a partition.
If the information is in a partition as I suggested Post #3 it is already in a separate disk. You can mount it to select individual files to restore. The whole idea of using dd is to copy the binary pattern of the partition and that includes its boot sector which normal backup software does not touch. Therefore with the boot sector and filing system in a mirror image available for access must be a huge advantage over saving the entire partition just to a binary file of the same size but cannot be mounted for data retrieval.
What the thread starter is after is to back up his operating system, if you back up to the same HDD, in the event of a HDD failure, you have no back up. What he/she may want is to back it up to CD/DVD. The link I provided gives you many back up mediums to choose. And if an individual were to use this newer technology to create/manage all partitions, lilo or grub would be installed in first sector of root partition and will also be backed up. You can also use the same image to install multiple copies of any OS to use for testing without harming your original copy.
That's where stress free computing comes into effect.
Last edited by Junior Hacker; 01-26-2007 at 06:04 PM.
My Post #3 suggests backing up with an external hard disk!
I don't think you understand what dd, one of the oldest commands in Linux, can do if you think of other software as "new" technology.
If you run a terminal command of "hdparm -tT /dev/hda" it will tell you the maximum transfer rate is about 60Mb/s for a modern Pata disk.
dd copies the "1" and "0" of the hard disk at about 50 to 55Mb/s and that is not easy to match by any commercial software. dd clones the exact mirror image of the partition or hard disk and there is nothing better than 100% of the original, is it?
Any DVD or CD recording of a hard disk operating system will not boot because the partition and disk number cannot be matched.
I run the maximum number of 63 partitions in my Pata disk and 62 of them will be filled with OSs except the extended partition. There can be Dos, Windows, Linux, BSD and Solaris among the 63 partitions. The way I upgrade my hard disk is to buy a bigger than, dd the entire disk, put away the original as the backup and start using the clone disk right away. I never expect any of the OSs fail to boot. I use dd to move Linux from partition to partition, from hard disk to hard disk and from computer to computer. I have tried a couple of comercial software but didn't find them anywhere as simple or powerful of dd, which is a fundamental tool available in every Linux or the Unix-based system.
To me the new technology is for users who donot want to bother with the basics in Linux.
Also you may like to know that only dd can read and save data from a dodgy hard disk on the verge of a hardware failure because we can control the DMA and slow down the hard disk speed to get more reliable reads and skip unreadable information. Good sectors of a bad disk are always saved by dd any way.
If you have new technology to beat that let us know.
Do some reading, I provide links.
You want to stay in the past, stay in the past. Yes dd is one of the oldest commands, which makes it ancient technology. I've been using bootitng for two years now and it is FLAWLESS. As I mentioned in the other thread, I can wipe 0's across a partition and restore a clean, fresh, fast, fully updated and configured backed up copy of an original install in less than "TEN MINUTES". Don't convince yourself the old technology is better, technology marches on. Backing up to CD/DVD is just that, "a backup", you do not boot from it, you restore from it to original HDD or new. As I mentioned above, if you want to boot multiple copies of the same OS, you can.
DON'T KNOCK IT TILL YOU TRY IT
Last edited by Junior Hacker; 01-26-2007 at 06:51 PM.
I do not condone anything he say's, I merely point out there are other options which can be far superior. Have you ever asked yourself why third party software designers launched a large lawsuit against Microsoft?
It is because their technology is worth protecting so the giants don't implement this better technology in their systems and profit??????
Maybe I don't see what you see, maybe you don't see what I see.
I have quoted dd can clone systems at 50Mb/s speed. Most of my systems are in 5Gb partitions and restoring one takes 5000/50 = 100 seconds or 1.66 minutes. With 10 minutes dd can restore an OS as large as 30Gb. Cloned a 400Gb disk yesterday in 7754 seconds and that is 51.6Mb/s speed. Let the figures speak for themselves.
There is nothing old in Linux. It is just a set of tools with which many new programs are based on. You may be presently surprised some of the new technology uses dd as the engine.
I have no interest in wining the argument but it would be sad if the forum members think there is a newer and better technolgy in copying the binary pattern of "1" and "0" off a hard disk than a Linux kernel can do in its simplest and most direct read and write.