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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-22-2014, 07:47 AM
|
#1
|
Member
Registered: May 2007
Location: Florida, USA
Distribution: Ubuntu
Posts: 96
Rep:
|
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.
|
|
|
01-22-2014, 09:38 AM
|
#2
|
Member
Registered: Oct 2009
Location: NJ
Distribution: fedora 20 and rawhide
Posts: 47
Rep:
|
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
|
|
|
01-22-2014, 09:43 AM
|
#3
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,330
|
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.
|
|
|
01-22-2014, 02:55 PM
|
#4
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,968
|
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/* .
|
|
|
01-22-2014, 08:04 PM
|
#5
|
Moderator
Registered: Mar 2008
Posts: 22,361
|
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.
|
|
|
01-22-2014, 08:35 PM
|
#6
|
LQ 5k Club
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842
Rep: 
|
+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
|
|
|
01-22-2014, 10:06 PM
|
#7
|
Member
Registered: Jul 2013
Posts: 749
Rep: 
|
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.
|
|
|
01-24-2014, 04:51 PM
|
#8
|
Member
Registered: May 2007
Location: Florida, USA
Distribution: Ubuntu
Posts: 96
Original Poster
Rep:
|
Quote:
Originally Posted by Doug G
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.
|
|
|
All times are GMT -5. The time now is 02:23 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|