PDA

View Full Version : [ubuntu] clonig in a smaller hdd



cris_1986
September 22nd, 2011, 02:27 PM
hy,
i have installed ubuntu 10.04 64 bit in a 500gb hdd.
I want to clone the hdd on a new ssd 64 gb.
Clonezilla doesnt work, becouse the destination is smaller than the source.
How can i resolve?

sanderd17
September 22nd, 2011, 02:31 PM
take a look at dd: http://en.wikipedia.org/wiki/Dd_%28Unix%29

cris_1986
September 22nd, 2011, 02:33 PM
to work with dd i must use a live cd ?

haqking
September 22nd, 2011, 02:34 PM
hy,
i have installed ubuntu 10.04 64 bit in a 500gb hdd.
I want to clone the hdd on a new ssd 64 gb.
Clonezilla doesnt work, becouse the destination is smaller than the source.
How can i resolve?

is it one big 500gb partition ?

resize to the used space and then clonezilla will do it.

sanderd17
September 22nd, 2011, 02:36 PM
to work with dd i must use a live cd ?

You must at least unmount the partitions you're working on. So if it's a partition you need to run your OS, you have to do it from a live CD.

But before you use dd, please read the manuals etc.

cris_1986
September 22nd, 2011, 02:37 PM
I only have one partition on the whole disc. data on the partition is about 15 gb

haqking
September 22nd, 2011, 02:39 PM
I only have one partition on the whole disc. data on the partition is about 15 gb

so resize to about 20 then, and then you can clone that using clonezilla

cris_1986
September 22nd, 2011, 02:50 PM
I just tried it with virtual machines but Clonezilla is not cloning because the destination disk is too small

haqking
September 22nd, 2011, 02:52 PM
I just tried it with virtual machines but Clonezilla is not cloning because the destination disk is too small

i repeat, resize your 500GB partition to a smaller one, then clone that partition.

You can clone it as an image, then clone the image to your new HDD

cris_1986
September 22nd, 2011, 03:24 PM
I resize the partition (40gb), I saved to an external drive.
I unplugged the old drive (500gb), I turned on Clonezilla and I restored the image on the new disk ssd.
Clonezilla tells me that the disk is too small and crashes

haqking
September 22nd, 2011, 03:41 PM
I resize the partition (40gb), I saved to an external drive.
I unplugged the old drive (500gb), I turned on Clonezilla and I restored the image on the new disk ssd.
Clonezilla tells me that the disk is too small and crashes

mmm thats weird, are you sure when you cloned you didnt clone the disk instead of the 40gb partition ?

cris_1986
September 22nd, 2011, 03:55 PM
I redid the whole process. I even cloned the partition (not disk) and then I restored. Clonezilla crashes and says the partition is corrupt ..
Can I change my software?

haqking
September 22nd, 2011, 03:57 PM
I redid the whole process. I even cloned the partition (not disk) and then I restored. Clonezilla crashes and says the partition is corrupt ..
Can I change my software?

change what software ?

I dont know whats happening, as long as the partition is under the size of the destination, and was cleanly dismounted...if not you can ask clonezilla to do an expert mode and choose the fsck option.

Then choose partition to clone (40gb) clones as a file to an ext hdd. Then restore that image to the destination.

I do it all the time with various paritions and such like, i am not not sure what is going on your end

YesWeCan
September 22nd, 2011, 05:06 PM
Would you post the output of this so it's clear what the partition layout is on your 500GB drive?
sudo fdisk -lu

cris_1986
September 22nd, 2011, 06:41 PM
i m working with a virtual machine and 3 hdd: sda is the smaller disk(destination), sdb in the larger disk (source), sdc is the NTFS archive


sudo fdisk -lu
Disco /dev/sda: 19.3 GB, 19327352832 byte
255 testine, 63 settori/tracce, 2349 cilindri, totale 37748736 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00094c12

Dispositivo Boot Start End Blocks Id System
/dev/sda1 2048 37748735 18873344 5 Esteso
/dev/sda5 4096 37748735 18872320 83 Linux

Disco /dev/sdb: 26.8 GB, 26843545600 byte
255 testine, 63 settori/tracce, 3263 cilindri, totale 52428800 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00094c12

Dispositivo Boot Start End Blocks Id System
/dev/sdb1 * 2048 20482047 10240000 83 Linux
/dev/sdb2 50169854 52426751 1128449 5 Esteso
/dev/sdb5 50169856 52426751 1128448 82 Linux swap / Solaris

Disco /dev/sdc: 53.7 GB, 53687091200 byte
255 testine, 63 settori/tracce, 6527 cilindri, totale 104857600 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00098d9e

Dispositivo Boot Start End Blocks Id System
/dev/sdc1 2048 104857599 52427776 5 Esteso
/dev/sdc5 4096 104857599 52426752 7 HPFS/NTFS

YesWeCan
September 22nd, 2011, 06:51 PM
sudo fdisk -lu
Disco /dev/sda: 19.3 GB, 19327352832 byte
255 testine, 63 settori/tracce, 2349 cilindri, totale 37748736 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00094c12

Dispositivo Boot Start End Blocks Id System
/dev/sda1 2048 37748735 18873344 5 Esteso
/dev/sda5 4096 37748735 18872320 83 Linux

Disco /dev/sdb: 26.8 GB, 26843545600 byte
255 testine, 63 settori/tracce, 3263 cilindri, totale 52428800 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00094c12

Dispositivo Boot Start End Blocks Id System
/dev/sdb1 * 2048 20482047 10240000 83 Linux
/dev/sdb2 50169854 52426751 1128449 5 Esteso
/dev/sdb5 50169856 52426751 1128448 82 Linux swap / Solaris
To copy sdb to sda you'll need to make sure you shrink the partitions on sdb so that the end sector of the last partition is less than the total sectors on sda.
Or you could delete sdb5 and sdb2 and then clone sdb to sda.

To clone sdb to sda (using a live CD/USB):
sudo dd if=/dev/sdb of=/dev/sda bs=64k conv=notrunc,noerror

After using dd you should tell the kernel to re-read the destination disk partition table:
sudo hdparm -z /dev/sda

Important: when you clone a disk its partition UUIDs are also cloned. This will cause problems for Grub if you have two disks connected with duplicated UUIDs. So before you try to boot off the clone make sure you disconnect the original drive.

If you want to use both the original and clone at the same time, you should change the UUIDs on one of them. Check the UUIDs using 'sudo blkid'. Change them (on extfs partitions) using 'sudo tune2fs -U random /dev/sdxy'. Changing the UUID of NTFS is more complicated. Changing UUIDs will then require a change to the affected fstab file and a Grub reinstall.

cris_1986
September 22nd, 2011, 07:02 PM
ok.. This problem exists only for this virtual machine? clone disks when in reality it is likely that still has this problem?
sorry for bad english

YesWeCan
September 22nd, 2011, 07:09 PM
ok.. This problem exists only for this virtual machine? clone disks when in reality it is likely that still has this problem?
sorry for bad english
Which problem do you mean? I think what I have said applies just the same to real drives.

perspectoff
September 22nd, 2011, 07:29 PM
+1 for dd over Clonezilla

+1 for using dd from a LiveCD (or while running an OS from a partition other than the one you're trying to clone/move/copy).

As long as my destination partition is at least as big as the total aggregated size of the actual files on the partition being transferred (not the size of the source partition, which usually has lots of empty unused space), I haven't had a problem. I have shrunk a 200 Gb partition that only had 40 Gb in files down to a 45 Gb partition (for archival on an external hard drive) using dd. In fact, I do that periodically for full backups (although it is not efficient for differential backups).

The biggest problem in cloning/moving/copying/resizing partitions is doing it to/from network-mounted partitions. That is a horror show (because of permissions problems and symbolic links being dropped).

In that instance, move/copy/clone the partition to an external hard drive (using dd) first, and then move it to the final location from the external hard drive.

YesWeCan
September 22nd, 2011, 08:44 PM
+1 for using dd from a LiveCD (or while running an OS from a partition other than the one you're trying to clone/move/copy).
Thanks, I forgot to mention that. Never dd "live" partitions or disks.

Drew Woodard
January 20th, 2012, 01:37 AM
Some of the confusion here may be due to what I assume is a bug introduced into recent versions of Clonezilla.

I have been using Clonezilla rather heavily for the last couple years, what I usually do is set up a machine with a small 20GB partition, install the os, then make a clonezilla image.
Then when I set up a new machine I take that disk image, apply it to the drive of the new machine, boot off the Ubuntu live cd, and then use gparted to expand the partition to take up the entire drive, be it a 90GB SSD or a 500GB HD.

This has always worked fine until this last week when I switched to the new version:
2011-11-25 - alternative stable Oneiric based
and I started getting these "destination disk is too small!" errors

I switched back to a previous version:
2011-09-22 - alternative stable Natty based
and everything started working again.

So in summary:
2011-09-22 - alternative stable Natty based (http://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative/OldFiles/20110922-natty/) (GOOD)
2011-11-25 - alternative stable Oneiric based (BUGGY/BROKEN)