ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux Copy a Disk Over SSH with DD

    IT Discussion
    linux dd storage ssh
    5
    7
    2.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      This is a really handy command when you need to get an image of a filesystem to a remote machine.

      ssh root@hostname "dd if=/dev/sda" | dd of=mydisk.img
      
      AdamFA K 2 Replies Last reply Reply Quote 4
      • jmooreJ
        jmoore
        last edited by

        the dd command is so useful

        1 Reply Last reply Reply Quote 0
        • AdamFA
          AdamF @scottalanmiller
          last edited by

          @scottalanmiller said in Linux Copy a Disk Over SSH with DD:

          This is a really handy command when you need to get an image of a filesystem to a remote machine.

          ssh root@hostname "dd if=/dev/sda" | dd of=mydisk.img
          

          Going to use this today. Do you have to boot into "rescue" mode to do this? Or can you run this right from the live running system that you are copying from?

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @AdamF
            last edited by

            @AdamF said in Linux Copy a Disk Over SSH with DD:

            @scottalanmiller said in Linux Copy a Disk Over SSH with DD:

            This is a really handy command when you need to get an image of a filesystem to a remote machine.

            ssh root@hostname "dd if=/dev/sda" | dd of=mydisk.img
            

            Going to use this today. Do you have to boot into "rescue" mode to do this? Or can you run this right from the live running system that you are copying from?

            You can run live. But you definitely want to unmount it if there is ANY possibility to do so. Or go read only.

            1 Reply Last reply Reply Quote 1
            • K
              krisleslie @scottalanmiller
              last edited by

              @scottalanmiller can this be used while on XCP-NG host?

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller @krisleslie
                last edited by

                @krisleslie said in Linux Copy a Disk Over SSH with DD:

                @scottalanmiller can this be used while on XCP-NG host?

                Can be used on every non-Windows system.

                S 1 Reply Last reply Reply Quote 0
                • S
                  sigmatelco @scottalanmiller
                  last edited by sigmatelco

                  if you want to also know the progress you can pipe it to pv, like in the below example

                  ssh [email protected] "sudo dd if=/dev/nvme0n1" | pv | dd of=/Users/someuser/Desktop/mydisk.img
                  
                  1 Reply Last reply Reply Quote 2
                  • 1 / 1
                  • First post
                    Last post