Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
If they're identical, you can use dd (maybe run it off a live-cd so you don't have to mount the disks). There's a great thread here at LQ about dd, so you maybe want to read it, but the short usage is
dd if=/dev/hda of=/dev/hdb
Where you'll change the parameters when necessary - hda would be primary IDE disk, hdb secondary, but they might nowadays be called sda and sdb, so check it out. Also don't make that the wrong way, or it'll write the older drive empty
More options and help at:
Or you could use a cloning software like Nortong Ghost, but whatever you like..if the disks aren't equal in size (for example the new disk is bigger), you need to do something else, because dd doesn't (at least "by default") expand the filesystem over the whole disk, it merely makes an image and copies it to the other disk, exactly the same as the source is.
If you use dd or other software that will clone the drive, i.e. make an image of it and then put the image onto the other disk, no. The image contains filesystems etc. too, so then you don't have to. If you want to, you can partition and format it and install a new OS yourself and then copy just files off the original disk, but cloning makes what it says - clones everything.
EDIT: you'll notice this also from (for example) what dd uses as source and destination: device file for the entire disk (hda and hdb). It doesn't ask for partitions if you're dd'ing the whole disk (partitions like hda1, hda2, hdb1, ...), nor ask you anything about the filesystems - simply which device (whole disk in this case) you want to read from, and which device to write to.
Cloning had done but after removing old hdd and installed new linix was not booting its shows error
If you clone a drive, and the drives have different geometry, you will have an incorrect partition table in the MBR. This can cause boot problems. I use partimage to save and restore partitions, and fdisk to partition drives. After you setup the partitions on a new drive, you will still need to install a boot loader. Look at the man page for grub-install. Typical usage is to mount the restored boot partition and run something like this:
About your latest exemple, I understand the following: to write a file in a partition (hdb1 in this case), this partition must *already* exist. So, this would be just something like an image of the original disk. Nevertheless, which filesystem in hdb1 would permit a 20GB long file?
Oh ! Thanks masterclass. I forgot that dd would copy the entire hd and not ONLY just the "system + files." Meaning that if my OS and all the associated files took up say 2Gb out of the 20Gb on the HD, dd would copy the 2Gb along with the "empty" remaining 18Gb. So
# dd if=/dev/hda of=/mnt/hdb1/tmp/hda.clone
would not be viable as no f/s allows for such big files.