Need help cloning Linux hard drive

Posted on 2012-08-28
Last Modified: 2012-08-30
I was referred to Clonezilla in an attempt to clone a Linux hard drive to a new hard drive. I must say it worked quite well with one exception (and it did state it). The inability to resize volumes. I have one volume on the source that is 221GB. It is the "data" volume and only has 30-40 files and takes up 40MB. It does not need to be anywhere near that large. It is a 250GB SATA hard drive. I want to clone it to a 160GB SSD and I have every volume cloned with the exception of that one.

   My guess it that I could create the volume on the SSD and copy the files from the source to this smaller destination volume but I am at a loss on how to do it. I am not a Linux head. I need to do it with some kind of boot CD. I have both drives on-line at the same time but need some help creating the volume and copying the files to it from the source volume.
Question by:jimbecher
    1 Comment
    LVL 17

    Accepted Solution

    Does the volume you want to reduce have system files on it? That is, will the cloned system boot without it? If so, just copy the rest of the system, leave out that one drive, boot the cloned system. Then create a small partition (or maybe leave it on the main drive without a separate partition) and manually mount the old drive's partition. Then copy the old content to the new partition/directory and you're done ...

    e.g., if the drive was mount at "/data", make sure you have the mount point and create the partition with fdisk or a Linux graphical tool (depends on your distribution), or leave it as just a directory. If it's a directory, mount the new partition ("mount /dev/sda5 /data", with the correct device/partition)
    Then mount the old partition, e.g. "mount /dev/sdb5 /mnt" (again enter the correct device/partition of course), and copy the content:
    cd /mnt
    tar cf - . | ( cd /data ; tar xvf - )

    Open in new window

    If you created the new partition manually, you may need to update/correct the file /etc/fstab ...

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now