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.
Thankyou for the reply guys. So dd will work by simply by giving 'dd if=/dev/hda of=/dev/hdb'. Will it make any difference if the hard disk as SCSII Hardisk? Also is there any need to give anysort of parameter like sector size and things like that, casue I'm really impressed if it this simple!!
I don't think it maters if the drive is scsi or ide, I have only done this with ide drives myself.
By default dd uses block size of 512 bytes which will work with most hard drives. If in doubt do a fdisk -l /dev/scd0 and look to see what the units are. Below mine says Units = cylinders of 16065 * 512 = 8225280 bytes. That means 16065 X 512bytes = 8225280 bytes. So the default 512 is OK. If yours has something other than 512 you can add a bs=1024 for example. You don't need a count because dd will stop when it reaches the end of the drive.
# fdisk -l /dev/hda
Disk /dev/hda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1274 10233373+ b Win95 FAT32
/dev/hda2 * 1275 1401 1020127+ 4d QNX4.x
/dev/hda3 1402 1783 3068415 4f QNX4.x 3rd part
/dev/hda4 1784 4998 25824487+ 5 Extended
/dev/hda5 * 1784 2420 5116671 83 Linux
/dev/hda6 2421 3312 7164958+ 83 Linux
/dev/hda7 3313 3821 4088511 83 Linux
/dev/hda8 3822 3948 1020096 83 Linux
/dev/hda9 3949 3998 401593+ 83 Linux
/dev/hda10 * 4249 4502 2040223+ 83 Linux
/dev/hda11 3999 4248 2008093+ 83 Linux
/dev/hda12 4503 4998 3984088+ 83 Linux
I 'will' (when I buy my new HD ) have the same problem. My hdc is 20GB and I'd like to replace it. Maybe 20GB => 120GB, but I'd like to keep all (information, OS, ...).
Yes dd will work as long as the destination drive is as big as or bigger than the source:
dd if=/dev/hda of=/dev/hdb
Would it mean a conflict with BIOS? (BIOS looks at the HD and sees the structure, but the beginning of the new HD has the structure information of the old one, What then?)
Will I be able to create new partitions in the free space?
(If not I'm wasting 100GB!!!)
I ask, because I had (have) many problems doing such 'simple' things with harddisks...
I don't know too much about these questions; sorry about my imprecise language
I have done it at work going from 3G drive to 20G and yes the extra space is wasted. There are ways to retrieve it if you need to. Our machines only require the 3G and since you can't hardly find a 3G drive any more we just buy 20G.
You could first partition the new drive and create a 20G partition then you would copy like this:
dd if=/dev/hda of=/dev/hdb1
However; if hda has partitions then that wouldn't work, you would have to create the same size partitions and copy them individually.
It may end up easier to just do like spurious suggested and use partimage.
I have done it at work going from 3G drive to 20G and yes the extra space is wasted.
Unless it really doesn't matter, there is no reason for the wasted space. At least not that much.
I would use dd partition by partition and copy it onto a slightly larger new partition. You would still have wasted space, but not 17 GB.
Doing this you would want to create new partitions before copying your old data to them and would need to be able to write your boot manager to the new hard disk.
It's not that the space is wasted it's that it's not required. If I install the software off a CD it will create 3 partitions and they will use 3G of space. So when I make a backup I just use dd if=/hda of=/hdb, it's much quicker than partitioning and the 17G will never be used anyway.
Thank you, /bin/bash and 2damncommon for your comments and the instructive discussion
Let's suppose (as is the case) I only want (need) the 18GB hdc3 partition from hdc(20GB) to the new hd (120GB), and moreover I have mandrake on hdc3 and, of course I would like to preserve it; afterwards I'd like to work with it again,
what can I do?
As I see in the partimage home page it is like dd but it's optimized to work only with partittions (is not 'the same', I mean I'm not sure if it is 'much better' for the use I'm thinking about)
Correct me (please), but what I think is to use 'dd', but what do I do with the very first part of the new HD?
I'm pretty sure that I'd have serious problems in with it. (in fact, right now I have a nasty problem with boot sectors, MBRs, etc... )
The kicker to using dd is that when you copy hdc3 to the new drive, it will still want to be hdc3. So you would want to put some planning into how you are going to partition the drive so it is most useful for you.
What I would think about doing:
Make a boot floppy. Confirm it works. It should be able to boot hdc3 on either drive. (after being copied by dd, of course). You can rewrite your boot manager after booting with the floppy or from another system.
Before using dd to copy Mandrake over, you may want to check /etc/fstab and comment out or delete anything but your Linux partiton, floppy, and CD. Is your swap going to be in the same place?
Before rewriting your boot manager, check that configuration file also.
A reinstall might be just as easy.
Just curious now.
Is this, like, a custom install, firewall software, or a particular program or distro?
It's much worse than a custom install it's an "automated custom install", once you press the y key to continue it's all over. 3 partitions, 3G, thats all you get no matter what size drive you use. I know it's stupid but I just push the y key I didn't write the install script, somebody "really smart" did
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
If you're copying/mirroring data from a small HD to a larger one, I suggest you use tar (or something else like it). You won't waste any space and you can exactly mirror the data.
On the new disk make partitions slightly larger than on your old disk, then do the following:
cd /old/partition/mount/point; tar pcf - . | (cd /new/partition/mount/point; tar xf -)
This will take some time, but it should do what you need. You can read the man page to check that you don't need to include other options. . .