Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Dimension X

    Clonezilla: Copying and restoring partitions on the same HDD

    Clonezilla: Clonezilla

    Steven Shiau had asked me how I solved one of my problems while using Clonezilla. Therefore, I am going to post a response/tutorial on this website.

    If you want a quick view of something you can do with the knowledge in this tutorial, then scroll ALL the way down to the end of this individual posting.

    By the time you're done with this tutorial, you ought to be able to do this:

     Partition 1 ---copy to---> Partition 3
     Partition 3 ---restore to---> Partition 1
    As with anything that involves messing with the hard drive disc (HDD), backup anything and everything you can before playing with the HDD. I hold no responsibility if you screw up your harddrive or anything else. Do this at your own risk.

    Before continuing, I'm hoping you've got multiple partitions on your HDD. This tutorial was meant for one HDD. In this tutorial, it hopes that you have an empty partition or else a good amount of free space available on the HDD, which needs to be larger than the amount of data used up by the partition you want to copy. If you don't have that free partition, I suggest making it with GParted.



    A person has a distribution using the Linux kernel (Kubuntu in this case). Kubuntu is located on partition "hda1." This partition is one of many that is on the HDD. The person wants to copy the contents of this partition and move them to a different partition on the same HDD.

    HTML Code:
    hda1 (Kubuntu) ---> hda3 (blank with empty space)
    An unfortunate part of Clonezilla is that it has the habit of backtalking to the user and saying the most obvious things.


    When the user first tried using Clonezilla with the command-line interface to copy the partition to hda3, it said that it could not copy the partition because the hard drive was already mounted.

    "Well, of course it's already mounted!" said the user. "No duh!"

    For some odd reason, copying the partition wasn't the same as it was with Windows XP. This could have been something to do with the hardware she was using, or it could have been an entirely different reason.
    Regardless, however, there is another way to copy a partition. This way is through the originally intended way: The Textual User Interface (TUI).

    First off, a person needs to have an extra partition on the HDD. That partition has to be larger than the partition being copied.

    For instance, if the partition being copied is 4GB with 15GB space left, then it would be wise to have a blank partition is that is sized at 5GB.

    I'm sure you could get away with having the partition at 4GB. However, you never know how well the compression will work.

    HTML Code:
    HDD = 80 GB
    hda1 = 15GB total with 4GB used
    hda2 = 2GB (swap space)
    hda3 = 5GB (blank partition with EXT3 format)
    Your partition table doesn't need to look just like that. You could have an extended partition and save to a partition on the extended layout. You just need to follow some of the basics: free space, file-system, etc.

    With that being said, Clonezilla doesn't copy the entire contents of the drive. In other words, all of the space not being used will not be copied. There may be ways to still copy everything even the blank space; however, I am not aware of such details at the moment.

    Also, it is suggested that you format the "blank" partition with the same file-system you are copying. This may or may not help, but it is the method I use. I said "blank," because formatting the partition with a file-system seems to take up some space. You'll want to take that into account when copying materials from one partition to another.

    With more of the details out of the way, the next few steps is to simply copy the partition with the TUI to a different partition. Using the TUI isn't too difficult, so I won't go into too many details about that.

    One of the things that will happen is that it will request you give the copied material a name. I suggest you give it a name according to date, operating system, and partition. I also suggest you use a hyphen between the date, operating system, and partition. Crunch each of the details together and you'll only be using two hyphens.

    Now that you've backed up the partition, you'll need to decide what you will do next.

    The whole idea of backing up the partition is for data recovery. In the situation that you mess with the drivers, x configuration, or something else and lose control, then you'll probably want a good data recovery option.

    If you're in the mood for playing dice, you could take the next steps at data recovery:

    The next few steps will include you deleting the partition with the operating system. Therefore, I highly suggest you backup by alternative means anything you care about.

    For the next few steps, you'll be using GParted. I suggest GParted, because it comes with the Clonezilla-Live CD.

    1. Delete the partition you just copied.

    Do not delete the other partition that has the copied information, which is the one with the compressed image.

    1a. Use GParted to delete the partition you copied.
    1b. Reboot the computer

    TIP: Use the Force VESA GParted if you keep getting annoyed by the available options.

    2. Reboot the computer and go into the command-line interface.

    I can't exactly remember the correct way to get into the command-line interface. I think a person needs to use the following: sudo su

    You need to get into root or something like that.

    3. For the next bit of information, more detail needs to be covered.

    Some HDDs are different, and they often assign different names to the partitions. If you don't know which partition is which by now, you should go to GParted and review them. Copy down the name of each partition. Take a snapshot if you can and print it out.

    type the following:

    mount /dev/hda3 /home/partimage
    hit enter (or return) or whatever people call it these days

    /opt/drbl/sbin/ocs-sr -l en -p poweroff --no-fdisk restoreparts 070707-kubuntu-hda1 "hda1"
    now hit enter or return.

    A slight explanation of the code:

    If you don't know what mount means, then search, Google, or use Wikipedia for it. I will say that backing up and restoring is different when using NTFS and Linux. This tutorial was meant for Linux.

    -l en
    That tells it to give output in the language of English.

    -p poweroff
    That tells it to use the power option of poweroff after doing its tasks. You could use reboot instead of the word poweroff. This would make the computer reboot.

    This tells the computer to NOT format the disk.
    All of this assumes your partition is blank with empty space.
    This isn't the pseudo-blank type of partition I was talking about before. There is no file-system to the new, blank partition: hda1

    This is pretty much a given. It tells the computer to restore the parts. In this case, it should be "part." The part being restored is described in the next field.


    This part is the name of the image you created from copying hda1 and put onto hda3.

    In case you're curious, the quotation marks are suppose to be there. This is the partition the image/part is going to be restored to. It has to be this partition. You have to restore data to the partition that was copied. There may be some workarounds, and I suggest you read the Clonezilla forum for that. I think I read about only one.

    And that's pretty much it. Now, if you screw up after that operating system install, you don't have to sit around waiting a good hour to put it all back in. Nor do you have to reinstall that other Linux OS once more. A good 5GB compressed image tends to decompress within 10 minutes. Compare that to a 20 or more minutes install and you'll notice that restoring from a compressed image is a much better, faster, axiologically and pragmatically enlightening choice.

  2. #2
    hi another linux newbie on the loose here. wanderin if you could help me. ive already copyed my hdd to another hdd, but i have written over the origional os, my problem is, at the begining of the setup process there are keyboard options and i think i picked the wrong option because my usb keyboard is now disabled at my widnoze xp logon screen but it works for the bios. do you know how to reenable my keyboard

  3. #3
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Dimension X
    Quote Originally Posted by m4ytt View Post
    hi another linux newbie on the loose here. wanderin if you could help me. ive already copyed my hdd to another hdd, but i have written over the origional os, my problem is, at the begining of the setup process there are keyboard options and i think i picked the wrong option because my usb keyboard is now disabled at my widnoze xp logon screen but it works for the bios. do you know how to reenable my keyboard
    You're probably going to need to give more detail.

    Alright, well this tutorial covered copying one partition to another partition.
    Is that what you did? You used clonezilla, right?

    If I'm reading you right, you have two HDDs. This means you copied from one HDD to another HDD. But what OS did you copy? Did you copy Windows XP?

    If copied Windows XP, there are certain specifications to doing that with Clonezilla.

    Someone long ago created a good amount of documentation. It's on the Clonezilla boards somewhere. Transferring Windows XP to another HDD and then using it is an annoying process; and I haven't taken the time to do it yet, although it's an incredibly useful things to do (~8 minute complete OS restore) since Windows XP often corrupts. I've only done Windows XP with partitions, not multiple HDDs.

    This tutorial was primarily for Linux; the kernel tends to figure out X11 things on its own. This is what makes me think you're talking about Windows. X tends to use any plain keyboard after a good x-server restart. Windows does that too, often on a good computer restart. I'm thinking you're trying to use Windows XP on a different HDD. Is that right?

    I think the issue with Windows XP was that it locks up if it isn't on the original HDD. Something about the registry, I think. And when you bootup Windows, it notices it's not in its house, and sits in outer space, and so it gets scared and doesn't want to talk to anyone.

    To make it not lock up, a person has to configure Windows XP before transferring it over to another HDD. I think that's right. Kind of like telling a child he'll be in Mexico after he wakes up instead of not saying anything.

    There may be a way to hack Windows via linux with the situation you're at, but I don't think anyone has made documentation for that; and I don't know how to do it.

    If you're not using Windows XP on a different HDD, and you copied the copy of Windows XP back onto the original HDD, then it might have to do with location, partition, and filesize. If the original HDD is giving you trouble, maybe totally format it and clean it. Then use clonezilla to transfer the copy from HDD2 onto HDD1. That might work.

    Worst case scenario and you had data on it, if you can use a Linux Live-CD to access the HDD, then copy files to a safe location and just reformat with a Windows reformat CD/DVD.


Posting Permissions

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