LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-22-2014, 07:47 AM   #1
williepabon
Member
 
Registered: May 2007
Location: Florida, USA
Distribution: Ubuntu
Posts: 96

Rep: Reputation: 0
Question Best practice to clone a disk


Hi:
The hdd of my laptop is almost full. It has a Windows partition and Linux partitions (root, home, swap). I have a bigger disk (previously used with windows 7) that will be the unit where I will clone my laptop disk. My idea, unless you people suggest a better way, is to use Clonezilla for the cloning activity. Then, use the GParted editor to move and resize the different partitions to take advantage of the bigger sized disk. Please, let me know if I will have problems with this method. Your advice/recommendations are welcome. Thanks.
 
Old 01-22-2014, 09:38 AM   #2
jayfree
Member
 
Registered: Oct 2009
Location: NJ
Distribution: fedora 20 and rawhide
Posts: 47

Rep: Reputation: 8
I have sucessfully migrated to a larger hard disk by partitioning the larger disk first and then using FSArchiver to backup/restore from small disk to large one using a backup drive and SystemRescueCD. Check out the details at,http://www.fsarchiver.org/Main_Page
 
Old 01-22-2014, 09:43 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,330

Rep: Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920
in the past i have done stuff like
Code:
dd if=/dev/sdx of=/dev/sdy bs=8192
and then boot up a live-usb and fiddle with the partition bounderies.
 
Old 01-22-2014, 02:55 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,968
Blog Entries: 13

Rep: Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007Reputation: 5007
An alternative is to do it fully manually. Add your new disk to the system. In Linux, run fdisk on the entire original disk and view the partition table. For instance, say the original disk is /dev/sda1, /dev/sda2, ... however many partitions it has:
Code:
sudo fdisk /dev/sda
View that partition table. Some partitions; such as the boot, Windows, and swap partitions you may want to keep at the same size. Unless the Windows partition needs expanding. I'd still recommend duplicating that size. What you call home, or your root file system (RFS); which I figured is the same as what you call root is your Linux data partition. That size can be expanded. Run fdisk on your new disk, delete any default partitions that the provider has given you; knowing that in doing this you are obliterating any software they gave you with your disk purchase. Create partitions on that new drive; the critical ones such as the boot partition, the Windows partition, same sized as they are on the original. And the Linux data partition you can make larger. You can also leave un-partitioned space for later gparted operations. I don't do that, just my style.

After exiting fdisk, you can use dd to copy the boot partitions as well as Windows; basically anything that matches size one for one and also nothing that I intended to alter. For any data partitions where I've changed the size, firstly you need to create a file system for that new partition. You don't need to do that for the other partitions because you've copied bit for bit, using dd and that will translate the file system attributes to the destination partition. Use one of the mkfs.<xxx> tools to create and set up your new file system, you do not need to make the same file system type, you can decide to use a newer file system type that you prefer if the older one was OK but you wish to try a newer one.

From there, the old file system is mounted, get the newly created file system mounted. And then perform a cp using the -a argument. Example, old file system is mounted on /media/old, new file system is mounted on /media/new:
Code:
cd /media/new
cp -a /media/old/* .
 
Old 01-22-2014, 08:04 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,361

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
Clonezilla or redobackup isn't bad. I might use windows native partition ability to move or increase MS partitions. I do use gparted too.


Some tips.

/boot may need to be moved to lower area on disk or separate partition.

Entries such as how disk is used may need to be edited to generic before clone or fixed after. /dev/sda1 for example over some device-by-name or other convention.
 
Old 01-22-2014, 08:35 PM   #6
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
+1 to jayfree and fsarchiver but I would add

after you have imaged across and used a live cd to change sizes of partition table

pls look at your new /etc/fstab to see if its using UUID or LABEL or /dev/sdx structures

If its using UUID run either of these commands pls and copy and paste into fstab the NEW UUIDs

Code:
sudo blkid 
(or  no sudo required for next)
ls -al /dev/disk/by-uuid/
# if using labels I find the easiest command to use is
sudo e2label /dev/sdxn

replace sdxn with say--sdb1 to find new drive's label and set it (if its missing or wrong) with

sudo e2label /dev/sdxn newlabelname

good luck
 
Old 01-22-2014, 10:06 PM   #7
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
I have just stuck the new disk in an external usb dock, booted from a live cd then use dd to clone the old hard disk. Swap the disks, reboot and the laptop thinks you still have the old disk since the partition table was cloned. Gparted has been able to resize partitions after cloning, I've changed the final size of both ntfs and ext4 partitions without problems.
 
Old 01-24-2014, 04:51 PM   #8
williepabon
Member
 
Registered: May 2007
Location: Florida, USA
Distribution: Ubuntu
Posts: 96

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by Doug G View Post
I have just stuck the new disk in an external usb dock, booted from a live cd then use dd to clone the old hard disk. Swap the disks, reboot and the laptop thinks you still have the old disk since the partition table was cloned. Gparted has been able to resize partitions after cloning, I've changed the final size of both ntfs and ext4 partitions without problems.
Essentially that's what I did. The only difference was that I used Clonezilla to clone the disk. Then, I resized the partitions with GParted as you did. Finally, I disassembled my laptop and replaced the old disk with the bigger one. Now, I have a 500 Gig HD when originally I had 80 Gig. The only hard part of the project was opening the laptop to replace the disk. Thanks.
 
  


Reply

Tags
clonezilla


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any software to do ddrescue job to Clone a hard disk to another disk ganjavi Linux - Newbie 1 09-24-2013 12:39 PM
is it bad practice to clone drbd - crypt partitions? tripialos Linux - Newbie 1 07-13-2013 08:17 AM
clone hard disk with: cat /dev/sda >/media/disk/backup deathalele Linux - Security 3 04-17-2009 12:29 AM
RAID1 array down to one disk with bad blocks, clone to good disk with dd noerror? ewolf Linux - Server 2 05-10-2008 12:40 AM
Clone IDE disk to SATA disk sdem Linux - Software 1 02-16-2006 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration