Migrate antiX installation from one harddisk to another (same computer)

Forum Forums New users New Users and General Questions Migrate antiX installation from one harddisk to another (same computer)

  • This topic has 15 replies, 9 voices, and was last updated Jun 9-5:00 am by blur13.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #61015
    Member
    blur13

      Hi!

      I’m wondering if there is a simple way to migrate an existing installation of antiX to a new harddrive on the same computer. I guess I could just install antiX again but then I would lose a lot of customizations and installed programs.

      Thanks!

      #61018
      Member
      Xecure
        Helpful
        Up
        0
        ::

        There are many tutorials on the web on how to clone a partition, then edit fstab and update grub on them. You could even chroot into them.

        The other option is to use Iso Snapshot tool to create a personal ISO copy of your system and use it (in live USB or booting the ISO from grub) to install your system to the other partition.

        Do a bit of research and choose what you like the most or seems the easiest.

        • This reply was modified 1 year, 11 months ago by Xecure.

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #61050
        Forum Admin
        Dave
          Helpful
          Up
          0
          ::

          Are you able to put both drives in the computer or do you have an enclosure you could put one in.
          If so you can connect both to the computer, boot a live usb, then use dd to clone the one drive to the other.
          Make sure that you select the correct drive as the source. An example for sata drives would be like:
          dd if=/dev/sda of=/dev/sdb bs=512 status=progress
          where “if=” is the source drive and “of=” is the new destination drive.
          Then use gparted to move / expand the partitions as needed.
          Once done shutdown, remove the original drive, and try booting.

          If the new drive does not work after moving and expanding partitions then you may have to partition the new drive as needed with gparted, mount each partition, followed by using rsync to move the contents to the new drive/partition. Once all the rsync processes complete run a grub install / repair either using the grub repair utility or manually via the command line. This should also be done using a live usb.

          Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

          #61051
          Member
          calciumsodium
            Helpful
            Up
            0
            ::

            Hi @Dave,
            Would your suggestion also work for two IDE hard drives connected to the same motherboard? One could be Master, and the other one Slave?

            I mean, could you use the same code to the two IDE drives?

            dd if=/dev/sda of=/dev/sdb bs=512 status=progress

            Thanks

            #61054
            Moderator
            christophe
              Helpful
              Up
              0
              ::

              @calciumsodium – That should work. ๐Ÿ™‚
              (Obviously backup any valuable data first.)

              • This reply was modified 1 year, 11 months ago by christophe.

              confirmed antiX frugaler, since 2019

              #61058
              Moderator
              BobC
                Helpful
                Up
                0
                ::

                That will copy one entire disk drive to the other. If they are the same size and don’t have bad areas it should work.

                #61070
                Member
                olsztyn
                  Helpful
                  Up
                  0
                  ::

                  Are you able to put both drives in the computer or do you have an enclosure you could put one in.
                  If so you can connect both to the computer, boot a live usb, then use dd to clone the one drive to the other.
                  Make sure that you select the correct drive as the source. An example for sata drives would be like:
                  dd if=/dev/sda of=/dev/sdb bs=512 status=progress
                  where โ€œif=โ€ is the source drive and โ€œof=โ€ is the new destination drive.

                  Thank you… My understanding is dd will clone the entire drive as is and this might entail the requirement that the second drive be at least the same size as the original.
                  As the other option requires partitioning first and using rsync to copy data followed by grub repair, etc., my question is whether there is a tool in existence, such as Acronis True Image, which I used to use, that would create a drive image on a network share or USB of the entire sata drive and then restore such image to the new drive? Acronis had intelligence to adapt to different size or geometry of drives, automatically resizing partitions.
                  However, Acronis Image worked great for Windows drives but never worked reliably for me on Linux drives.
                  My point is simplicity of such methodology, as it does not require mounting both drives to the same motherboard (usually not possible for laptops), such using a network share or USB for image.
                  Thanks and Regards…

                  • This reply was modified 1 year, 11 months ago by olsztyn.
                  • This reply was modified 1 year, 11 months ago by olsztyn.

                  Live antiX Boot Options (Previously posted by Xecure):
                  https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

                  #61080
                  Forum Admin
                  Dave
                    Helpful
                    Up
                    0
                    ::

                    Two IDE drives are fine, just make sure to set the jumpers correctly and change them when the clone is done.

                    For laptops I use a NAS to store the hard drive image on.
                    Then it is a two step procedure…
                    Boot live USB, mount the network drive (I use NFS), then make the output a file on the NAS.
                    dd if=/dev/sda of=/mnt/NAS/disk-image.img bs=512 status=progress
                    After swapping the drive in the laptop, boot the live USB again and remount the NAS.
                    Then use the image that you made to write to the new disk.
                    dd if=/mnt/NAS/disk-image.img of=/dev/sda bs=512 status=progress

                    Yes this will clone the entire drive.
                    Yes the new drive must be the same size or larger than the original (if not I use the rsync option).
                    Note: sometimes you can shrink and move the original drive to fit the new, but this is EXTREMELY dangerous
                    Yes if your drive has bad spots you may see problems with dd. You can enable dd to continue on error by adding ‘conv=sync,noerror’ such as.
                    dd if=/dev/sda of=/dev/sdb bs=512 conv=sync,noerror status=progress
                    This also may translate to a bad clone as those bad spots in the original drive will be copied with the corruption. But then again chances are it will be the same with rsync.
                    If there are bad spots on the new drive (or you are cloning to a questionable used drive), best to use the rsync meathod.

                    The only tool I know of is clonezilla (Clonezilla). Generally I do cloning the manual way.
                    If cloning a windows partition make sure to first fully shutdown the windows install if you do not have fast boot disabled. (hold shift when pressing shutdown IIRC)

                    Another option you may wish to consider using (especially if copying to a much larger drive. EX: 250GB to 1TB drive) is the count= option
                    You first get the size of the disk from the fdisk -l output then add that to the end of the dd command.
                    dd if=/dev/sda of=/dev/sdb bs=512 conv=sync,noerror status=progress count=1234567890

                    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                    #61082
                    Member
                    olsztyn
                      Helpful
                      Up
                      0
                      ::

                      Thank you Dave!
                      This is an excellent info I was looking for, especially for using dd and writing image to NAS. I am snapping this post to my tech knowledge reference…
                      In my case I will be using SMB rather than NFS, but it should not make a difference. Thanks also for care to address such details as handling of bad spots, as I understand dd works sector by sector, so it is implied, I think.
                      In principle this methodology should also work for mixed Windows/Linux partitions and also for both MBR and GPT drives, if I am correct in this my conjecture…
                      Greatly appreciated!
                      Regards.

                      Live antiX Boot Options (Previously posted by Xecure):
                      https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

                      #61088
                      Forum Admin
                      Dave
                        Helpful
                        Up
                        0
                        ::

                        Yes it works for mixed installed systems. I think the most I have cloned was one disk with 5+ different OS installs and the recovery / efi partitions.
                        The greatest issue was the moving / resizing the partitions to fill the new disk.

                        However as noted, you should fully shutdown the windows partitions or you are most likely going to need to run the windows recovery / reinstall functions as it will try to fast boot from the saved hyberfil which it may or may not find, let alone fine without being altered/corrupt. I have had it work before, but from experience this is more of a one time lucky thing (the drive was also the same size, no resizing needed).

                        Edit:
                        I think sending to an SMB share should work out ok, however I have not tried this.
                        Keep in mind the permissions between your computer and the SMB share change. So this will not work with an rsync backup for example (unless using the archive function to make a compressed package)

                        Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                        #61093
                        Member
                        olsztyn
                          Helpful
                          Up
                          0
                          ::

                          However as noted, you should fully shutdown the windows partitions or you are most likely going to need to run the windows recovery / reinstall functions as it will try to fast boot from the saved hyberfil which it may or may not find, let alone fine without being altered/corrupt.

                          This is understood for typical default setup but I always run with fastboot turned off as I do not trust integrity in multiboot setup.

                          Keep in mind the permissions between your computer and the SMB share change.

                          I think I am handling this already in mapping CIFS share using some parameters in fstab but I will play with this to make sure permissions work as needed…
                          Thanks again for details…
                          Regards.

                          Live antiX Boot Options (Previously posted by Xecure):
                          https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

                          #61098
                          Member
                          calciumsodium
                            Helpful
                            Up
                            0
                            ::

                            I tried @Dave ‘s suggestion to clone one IDE hard drive with another IDE hard drive.

                            sudo dd if=/dev/sda of=/dev/sdb bs=512 status=progress

                            It works!!

                            Some observations:

                            My original IDE hard drive had an antiX 19 ext4 partition, a swap ext4 partition, a Windows 7 NTFS partition, and a Windows boot NTFS partition. All four partitions were successfully copied in the process. My grub installation had windows 7 boot as the default. The clone boots up in windows 7 just like the original. The clone even automatically connects to the network just like the original. It boots to the antix 19 just like the original. It was just the exact as the original.

                            The downside:

                            The process on my old system took a long time: 15374 seconds (4.27 hours) to copy a 40 GB IDE hard drive. Moreover, the CPU percentage was a constant 85% for the whole time. So, my computer was working hard and it took a long time, at least on my system, to clone the hard drive.

                            #61104
                            Moderator
                            Brian Masinick
                              Helpful
                              Up
                              0
                              ::

                              I wonder if the device to device copy would still work with a larger bs parameter.

                              I’ve copied from one partition to another with a MUCH larger number. I’m sure that I have used 4096 and 8192, but I think that I have also used values with B, M, MB. G and GB are also supported.

                              Given that dd simply copies bits and bytes at a time and that the original tool was used to exchange data between IBM mainframe computer systems and UNIX systems. (Think of JCL and the DD card for data definition).

                              I suspect that much larger block sizes would considerably reduce transfer time, as long as available memory is not completely consumed.

                              Try transferring a few files to experiment and then consider using bs=32768. That’s a reasonable number that should not exhaust available memory for most of us.

                              • This reply was modified 1 year, 11 months ago by Brian Masinick.
                              • This reply was modified 1 year, 11 months ago by Brian Masinick.

                              --
                              Brian Masinick

                              #61174
                              Member
                              seaken64
                                Helpful
                                Up
                                0
                                ::

                                I had to go back to the top of the thread because I got confused. I thought the question was how to migrate an antiX install but then I realized what was being discussed was cloning an entire disk drive. Now I realize that the OP was not the same as some of the other commenters. I’m getting old and easily distracted I guess.

                                Anyway, my answer would be to use the “snapshot” feature built in to antiX to migrate from one drive to another. Just don’t reformat and use the old drive until you are sure the new drive is working the way you expect.

                                Use the snapshot to install and all your stuff is already set up.

                                The drive clone should also work as an option. But if all you want to do is move the antiX installation, and do not have multi-boot and other considerations, then a snapshot is easier, in my opinion.

                                Seaken64

                                #61188
                                Moderator
                                Brian Masinick
                                  Helpful
                                  Up
                                  0
                                  ::

                                  @Seaken64: I agree; snapshot is great and that’s typically what I do these days.

                                  However, also being “old school” I have used both tar and dd to either copy or move things.

                                  With both UNIX and Linux systems there are choices available and that’s”a good thing!” ๐Ÿ‘Œ๐Ÿ˜

                                  • This reply was modified 1 year, 11 months ago by Brian Masinick.

                                  --
                                  Brian Masinick

                                Viewing 15 posts - 1 through 15 (of 16 total)
                                • You must be logged in to reply to this topic.