How to clone 80GByte hard-disk to 40GByte hard-disk on Red-hat 9.0 ?
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
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.
Red Hat 9 is way out of date and totally unsupported, so I wouldn't bother with that at all and install a supported version.
1. Boot from a live-CD.
2. Create partitions on the new disk.
3. Copy the files from the old partitions to the respective new ones.
4. Mount all the new partitions to a complete tree, including /dev, /sys and /proc.
5. Chroot into that tree and install Grub to the MBR.
6. Power off, detach the old disk and boot.
Thanks on the info.
The application runs on Redhat 9.0
Where to find GRUB and how to install on the MBR ?
As already was said RedHat 9.0 is quite old. You may have a very hard time to find hardware where RH9.0 will run.
In this case you may resort to installing RH9.0 in VM (VMWare, VirtualBox, qemu - whatever)
Another option - use statifier (http://statifier.sf.net) or Ermine (http://magicErmine.com) to convert your application into self-containing executable. This executable should be able to run on virtually any Linux distribution without any dependencies
Actually one can do it with dd "if" the partition table of the 80Gn disk uses space no bigger than 40Gb. I have done this a lot of times.
If the systen has been cloned the grub-install must be told where the Grub located. Normally it is in hda1, say then boot up any Linux Live CD, create a mount point, mount hda1and the do the grub-install
mount /dev/hda1 /mnt/hda1
grub-install --root-directory=/mnt/hda1 /dev/hda
A Fedora Live CD can also be used to restore Grub as described in Task B6 of Just booting tips in my signature.
I use the following commands to "move" one partition hda1 to another hdb1. hda1 is the one to read from and hdb1 is the one to write on, assuming hdb1 has been formatted previously
mount /dev/hda1 /mnt/hda1
mount /dev/hdb1 /mnt/hdb1
tar cf - . | (Cd /mnt/sdb1; tar xf -)
The hdb1 can be different size and have different filing system to hda1. I litertally move every Linux this way and then fix the boot loader as described previously.
Just a warning : If Red Hat has Selinux installed it would not like a change of partition number. After migration the Selinux may have to be disabled. Most server-grade distro has this rigidity built in.
A Linux don't normally need to be cloned and the file copying procedure is adequate. Howver if the operating system itself is being copied then dd should be used because filing copying prcedure could copy mounted folders also.
Come to think of it, I should comment a little more fully:
The problem with using dd on your partitions, is that dd reads every byte available, _INCLUDING_ the blank ones you don't need, and then, of course, it wants to also write all that it has read. Which means it tries to stuff the second HD with everything, both data and the intermingled free space.
The command-pair of 'find' and 'cpio', on the other hand, copies files, links and directories - and ignores unallocated space. Hence, you need only find the space for what's actually stored in your filesystem(s). The "downside" of this, is that the filesystems have to be mounted when you copy, since it traverses the file system as such, rather than treating a partition as a stream of bytes, such as 'dd' can do.
I have also looked up some documentation, and it looks to me like the following incantation should work (but: NO GUARANTEES!):
To clarify, for readers: "print0" and "-0" contain zeroes, not capital Os.
One word about output: The instruction "V" tells cpio to print one "." for each file processed. This way, you get a visual progress report, but safeguards the terminal against possible effects of "funny" filenames...
UPDATE: The intervening poster reminded me of something: To avoid filesystems mounted downstream of the source directory, add '-mount' to the arguments for the find command (in front of 'print0' - the program is slightly finicky about order order ;-)
Last edited by InNomineLibertas; 08-22-2011 at 06:57 AM.
Reason: Additional info