Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi there, I´ve got a debian installation on a 80GB Harddisk in a barebone-pc and would like to change the 80GB-hdd to a 120GB-hdd. Unfortunately I don´t know how to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7

    Harddisk cloning


    Hi there,

    I´ve got a debian installation on a 80GB Harddisk in a barebone-pc and would like to change the 80GB-hdd to a 120GB-hdd. Unfortunately I don´t know how to clone the old hdd. Is there a simple possibility to do so?
    My old hdd is /dev/hda with several ext3-filesystems, my new 120GB-hdd is /dev/hdc and completely unpartitioned.
    Can anyone help me?

    Thanks, Roland

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    If you can have both HDDs connected at the same time, it's easy. Just partition the new one you want, use dd to copy the partitions as they are, and then finish off with resize2fs to expand them to fill the entire partitions.

  3. #3
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7

    Cloning HDDs with dd

    Thanks for those infos,
    I already thought about the necessity of partitioning the new drive first.
    Let me see if got everything.
    First, I have to set up the partitions /dev/hda1 /dev/hda2 ... /dev/hda9, just as they are on the original disk (Q: How to do so? I´m not so firm with Linux yet. I would try fdisk and would use the parameters of my old drive, is this ok?)
    Then I have to create filesystems (format) on those partitions (excl. the swap-partition). (Q: which command does create ext3-filesystems?)
    Last, I´ll have to use "dd if=/dev/hdaX of=/dev/hdcX" to clone every single partition from my old drive to the new one.
    Am I right?

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    No, that's not quite correct.
    To create partitions, use either GNU parted, if you have it installed, and otherwise fdisk.
    To format a partition with ext3, use mkfs.ext3. However, you don't need to do that now. dd will copy the filesystem exactly as it is, so even you were to format the partitions with ext3, it would just be overwritten with the old filesystem, so it would be for nothing. You got the dd command right, though.
    Now I'm assuming that you have at least one partition that is larger than it was on the old disk, otherwise you wouldn't have bought a bigger disk, right? Then the thing is that, since you copied the filesystems exactly as they were, they will still be set up to use the old partition size. Use resize2fs to extend the filesystem to use the entire partition.

  5. #5
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7

    Cloning Harddisk

    Ah, I see.
    Yes you´re right, I want to extend my /var fs as I want to use this linux-pc as a stable and secure fileserver. O.K. on my last partition I have to use resize2fs.
    Am I right that I may not create smaller partitions on the the new disk than they were on the old one? In my first setup I created a much to big root and /usr partition. In this case, how may I save space after the cloning by making some other partitions smaller?
    (By the way, this should be my last question
    Thank you very much for your help.

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    You can make the partitions smaller than before, but in that case you'll need to resize2fs the filesystem _before_ you dd it over. See the man page on resize2fs, it will show you that you can specifiy the number of blocks that the filesystem will be resized to. Also note, that it will take much longer to shrink a file system than it takes to extend it.

    I don't really understand why you seperate you root, usr and var directories on different filesystems, though. Doesn't that just make it harder for you?

  7. #7
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7
    Sorry, two more questions:
    After cloning I have to install lilo into the mbr of the new disk, otherwise this disk will not boot I think. Can I tell lilo to install itself onto /dev/hdc instead of /dev/hda ?
    And what about marking one partition (/) on the new disk as bootable? I think I have to do this as well. Is this a issue for parted?

    Thanks

    Roland

  8. #8
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7
    And there seems to be another problem (maybe):
    When I start parted on /dev/hdc (the new disk) it gives me some messages like:
    hdc: dma_intr: error=0x84 (DriveStatusError BadCRC)
    hdc: dma_intr: status=0x51 (DriveReady SeekCompleteError)
    Is this disk damaged in some way?

  9. #9
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Only Microsofts boot loader uses the bootable flag, so don't worry about that.
    Just edit your lilo.conf to decide which device to write the new boot sector to. I would suggest using GRUB instead of LILO, though.

  10. #10
    Just Joined!
    Join Date
    Jun 2003
    Posts
    7
    Well, everything went well so far. I have set up the partitions I needed and was able to clone every old partition with "dd". Also, I installed lilo to the mbr of the new disk. But now, when I try to boot from the new disk, I only get "01 01 01 01 01 ..." at startup. What went wrong?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •