Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: cloning a new drive?

  1. #1
    Join Date
    Apr 2007
    Location
    South Carolina
    Beans
    938
    Distro
    Ubuntu Studio 16.04 Xenial Xerus

    cloning a new drive?

    I'm planning on going to a Solid state drive for my boot drive so i want to clone my older standard HD to a new SSD. I'm thinking about using the dd command to do the clone the since it looks pretty simple. My standard HD is 1TB & I plan on getting a 1TB SSD to replace it with. I have two questions for anyone familiar with the cloning process.

    1 - Is the dd command as reliable as typical cloning software or is there a better recommended way to clone the drive?
    2 - Will Grub need to be reinstalled or updated to recognize the new drive uuid# ?
    Gary

    I wish I knew what I used to know before I knew what I didn't know.

  2. #2
    Join Date
    Feb 2015
    Beans
    Hidden!
    Distro
    Ubuntu Mate 18.04 Bionic Beaver

    Re: cloning a new drive?

    1 - Be EXTREMELY careful when using dd. If you make a mistake it is very easy to overwrite your system partition or, as I have done, overwrite a storage drive. Such accidents are usually totally unrecoverable. Make sure you have everything important you don't want to lose backed up prior to using dd. It has a few nicknames including the likes of "disk destroyer" or "data destroyer".

    There is a wrapper script for dd written by one of the staff members here, sudodus, that may be safer to use and worth checking out...--Tutorial for mksub--. I have never used mkusb myself but from what I've read it has quite a few uses for dd, including cloning and writing image files etc. It would be much safer to use such a script than plain dd if you are not familiar with the dd command.

    2 - I suspect you may need to run the "grub-mkconfig" command on the new system, though I'm not 100 % sure about that. Await further advice from more experienced helpers with grub issues there.

    Regards, yeti.

  3. #3
    Join Date
    May 2008
    Beans
    622
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: cloning a new drive?

    I would suggest that you consider using Clonezilla https://clonezilla.org/

    It will allow you to choose source and destination when using the device-device option which should reduce the risk of mistakes.
    yetimon_64 kindly pointed out the dangers of dd.

    If you clone device to device (i.e. hdd to sdd), your uuids will remain the same.
    However, you should not have your source drive and target drive connected after cloning because you will have duplicate uuids and confusion will occur.

    Clonezilla should have no difficulty copying and using grub unless you have some unusual set-up.

    If you have Windows installed also, then there are special considerations when changing drives. I do not have Windows so I am unable to elaborate further. The Clonezilla FAQ has some pointers.

    If you only have Linux Operating Systems on your hdd, then give Clonezilla a whirl because, in my experience, the source disk will still function perfectly even if the clone to the destination doesn't go as planned.

  4. #4
    Join Date
    Jan 2011
    Location
    Bournemouth UK
    Beans
    333
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: cloning a new drive?

    Gary-
    Clonezilla is your friend. Forget all other solutions. The easiest way is to stick it on a bootable thumb drive, run it as root and choose "Expert" not beginner.

    Do a disk-to disk clone, choosing your source and destination drives with care!

    When you get to the multiple options screen, there is an option to clone to unalike drive sizes.

    Sods law, you will probably find the SDD drive is a few megabytes smaller than the old HDD, so it is important you check this box.

    I do this operation on a regular basis, and I have 7 partitions on my 250gb O/S sdd drive.

    The EFI partition (fat32) is the most important for booting, I try to make this at least 400mb, the default is about 250mb from my failing memory and I make this the first (dev/sda1). Then there is a windows hidden 100mb, then my windows 10, about 100gb, then a windows recovery about 500mb, then my Ubuntu partition of about 50gb, my /home partition of 76gb, then some unallocated space for the unequal size of my three 250gb sdd's of different manufacture. See below.

    1. Boot partition <>400mb /dev/sda1
    2. Windows hidden 100mb /dev/sad2
    3. Windows 10 100gb /dev/sda3
    4. Windows recovery <>500mb /dev/sda4
    5. Ubuntu 50gb /dev/sda5
    6. /home 76gb /dev/sda6
    7. unallocated


    I have had 100% success with Clonezilla on all three of these drives.

    Just take your time and double check each step and you'll be ok.

    UUID's will be identical, and you should be able to boot without any extra steps.

    I also use a standalone 2-drive cloning dock which makes life much easier!

    Cheers, Tony.
    Last edited by vidtek; February 16th, 2020 at 01:34 PM. Reason: more info
    Asus Z270 i7 16gb ram 8.25tb GT960 TSB6205 Quad tuner 64-bit Kubuntu 18.04 Bionic & win 10 Be/FE mythtv 0.29
    Laptop Samsung NP R580 i5 nvidia linux ultimate & win 10 Homerun dual netwk tuner 55¨ Samsung ES8000

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    19,149
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: cloning a new drive?

    Quote Originally Posted by garyed View Post
    I'm planning on going to a Solid state drive for my boot drive so i want to clone my older standard HD to a new SSD. I'm thinking about using the dd command to do the clone the since it looks pretty simple. My standard HD is 1TB & I plan on getting a 1TB SSD to replace it with. I have two questions for anyone familiar with the cloning process.

    1 - Is the dd command as reliable as typical cloning software or is there a better recommended way to clone the drive?
    2 - Will Grub need to be reinstalled or updated to recognize the new drive uuid# ?
    Generally, I use ddrescue instead of dd. ddrescue keeps going after a failed sector is hit and will try multiple times. dd/ddrescue is only dangerous if you don't read and understand the manpage. Any other tool is only more complex because it tries to prevent humans from making mistakes. I suppose these mistakes are common enough to have a cottage industry?

    I've never cloned an entire disk from HDD --> SSD. Seems there are enough physical differences to make that less than optimal. If the sectors are misaligned or the sizes are even slightly off, then performance will be impacted.

    Also, this is a good opportunity to
    • Ensure GPT is used
    • Resize partitions
    • Use LVM, if you like
    • Add encryption
    • Test your current backup + restore method


    If you don't have a backup/restore method today, now is the time to get one and test it over and over until it does what you need.

    With respect, Clonezilla and other similar tools are great if you need to create a master image for 20-50,000 systems. Regardless, you still need a backup solution that is run weekly (at least!), supports versioning, doesn't require booting off alternate media, can be installed onto completely different hardware without risks - and clonezilla just ain't that. Clonezilla is more complex than a byte-for-byte clone needs. Plus, using dd/ddrescue, we can create a file-based, compressed, copy of the partitions, file systems or entire disk just by using normal Unix piping and redirection.

    fsarchiver can make images, similar to clonezilla or dd/ddrescue, but it can also restore them to smaller partitions without fail provided the actual needed data will fit into the smaller partition. Just an option. But it is still an imaging tool, just with a few more options and understanding about select file systems to be a little more efficient.

    1% of the time when I don't use my normal restore methods (which is the other 99%), I'd use rsync to copy data to the new storage. rsync can be used to grab the most recent data from my backup tool of choice (rdiff-backup), so nothing special is needed. Or you can just mirror the partitions using ....
    Code:
    sudo ionice rsync -av --stats --progress /source/ /target/
    Do that for each partition and be happy. I'd use temporary locations for the target to keep out of trouble. Might want to exclude the /target/ from the source if the target is mounted below it. The problem with not using the restore method of a backup tool is that certain special files will cause problems - like /dev/urandom & /dev/zero - which never runs out of data when asked. rdiff-backup has an exclude option for that --exclude-special-files. A tiny thing unless you forget it.

    If your current install has LVM already, there are many more options by adding a mirror, then breaking it or using pvmove. pvmove is freakin' amazing.

  6. #6
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: cloning a new drive?

    I always suggest new install.
    It also housecleans all the cruft that builds up even with regular housecleaning.

    And as TheFu suggests it is a good time to confirm your backup procedures are correct as you still have original drive to go back to in case you are missing something important.
    And if planning to continue to use HDD, you may want to reorganize your system.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  7. #7
    Join Date
    Apr 2007
    Location
    South Carolina
    Beans
    938
    Distro
    Ubuntu Studio 16.04 Xenial Xerus

    Re: cloning a new drive?

    Thanks for all the advice,

    I really don't want to have to do a fresh install & that is why I want to clone the drive. I just upgraded to Windows 10 on the drive I want to clone & I have two other versions of Ubuntu on that drive too.
    If I reformat the original drive after it is cloned will that change the uuid so it won't conflict with the new SSD?
    Here's a gparted view of the drive I want to clone.
    Attached Images Attached Images
    Gary

    I wish I knew what I used to know before I knew what I didn't know.

  8. #8
    Join Date
    Oct 2005
    Location
    Al Ain
    Beans
    9,817

    Re: cloning a new drive?

    BTW, all the copy commands work the same and are all equally 'dangerous' to the uninitiated. You can copy a disk with dd, cat, head, tail and a few even more obscure ones and they will all run at the same speed also, since they are all doing exactly the same thing: Copy a file.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    19,149
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: cloning a new drive?

    Quote Originally Posted by garyed View Post
    Thanks for all the advice,

    I really don't want to have to do a fresh install & that is why I want to clone the drive. I just upgraded to Windows 10 on the drive I want to clone & I have two other versions of Ubuntu on that drive too.
    If I reformat the original drive after it is cloned will that change the uuid so it won't conflict with the new SSD?
    Here's a gparted view of the drive I want to clone.
    You can force a UUID to change. Having 2 identical UUIDs connected to the same machine when storage is mounted will return to the old "whatever is found first" solution by the kernel/systemd.
    I think there is an easier way than this : https://www.tecmint.com/change-uuid-...tion-in-linux/
    or
    https://unix.stackexchange.com/quest...id-2-same-uuid

  10. #10
    Join Date
    Jan 2011
    Location
    Bournemouth UK
    Beans
    333
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: cloning a new drive?

    Quote Originally Posted by garyed View Post
    Thanks for all the advice,

    I really don't want to have to do a fresh install & that is why I want to clone the drive. I just upgraded to Windows 10 on the drive I want to clone & I have two other versions of Ubuntu on that drive too.
    If I reformat the original drive after it is cloned will that change the uuid so it won't conflict with the new SSD?
    Here's a gparted view of the drive I want to clone.
    Gary-

    My understanding from your original post was that your needs were a one-off clone from HDD to SDD, not a complex daily/weekly routine.

    Forget all the other ideas if that is the case and stick with Clonezilla. If you really do want ongoing backups, then that is a different question altogether.

    If you do want to change the UUID of the old drive that can be done in Windows with diskpart, there are linux alternatives as in the Fu's post.

    FS-archiver will clone a saved image to a different size drive, it is in the Ubuntu repos, there is also a QT gui version to make life easier.

    Best regards, Tony.
    Asus Z270 i7 16gb ram 8.25tb GT960 TSB6205 Quad tuner 64-bit Kubuntu 18.04 Bionic & win 10 Be/FE mythtv 0.29
    Laptop Samsung NP R580 i5 nvidia linux ultimate & win 10 Homerun dual netwk tuner 55¨ Samsung ES8000

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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