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.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to clone 80GByte hard-disk to 40GByte hard-disk on Red-hat 9.0 ?
Hi all,
As per subject, how can this be done ?
I tried
1) create partition ie fdisk
2) make file systems on /dev/hdb1 & /dev/hdb2
3) use dump & restore
4) use dd to transfer MBR from source (80GByte) to destination
(40GByte)
but when boot up from 40GByte hdd, the GRUB cannot be started.
Also i have taken into consideration the size differences.
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.
But anyways:
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 ?
Rgds
johnny
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
Code:
su
mkdir /mnt/hda1
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
Code:
mkdir /mnt/hda1
mkdir /mnt/hdb1
mount /dev/hda1 /mnt/hda1
mount /dev/hdb1 /mnt/hdb1
cd /mnt/hda1
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.