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

    DiskDump to a smaller USB

    IT Discussion
    diskdump usb cloning smaller
    7
    43
    5.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.
    • DustinB3403D
      DustinB3403
      last edited by

      So /dev/sdd has

      sdd1 etc3 4GB
      sdd2 fat32 4gb
      sdd3 lvm2 pv 21.82GB

      MattSpellerM 1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403
        last edited by

        Now I very well might need to restart the setup if in fact this USB is using almost 22GB on a partition that stores nothing..

        1 Reply Last reply Reply Quote 0
        • MattSpellerM
          MattSpeller @DustinB3403
          last edited by

          @DustinB3403 http://www.computerhope.com/unix/dd.htm

          Examples at the bottom, you want to take a copy of the whole SDD drive and dump it to an image of whatever flavour you fancy.

          1 Reply Last reply Reply Quote 1
          • DustinB3403D
            DustinB3403
            last edited by

            So

            dd if=/dev/sdd of=/dev/sdb
            

            Should clone it from the larger to the smaller disk?

            MattSpellerM 1 Reply Last reply Reply Quote 0
            • MattSpellerM
              MattSpeller @DustinB3403
              last edited by MattSpeller

              @DustinB3403 said:

              So

              dd if=/dev/sdd of=/dev/sdb
              

              Should clone it from the larger to the smaller disk?

              Uhhhh yeahhhhhhh but you don't want to do that like that

              First you want someone to double check what I'm suggesting, then read on

              Something like:

              dd if=/dev/sdd of=/dev/(hard drive)/(backup folder)/imageof32gbimportantthingy.img bs=4k

              will get you a backup copy of the 32gb, then you can mangle it with GParted and not worry

              DD is the ultimate "I want to copy X to Y and don't bother me with the details" tool - it's INCREDIBLY powerful

              1 Reply Last reply Reply Quote 1
              • DustinB3403D
                DustinB3403
                last edited by

                So I have to backup it up to an img file first and then write it, is that correct?

                MattSpellerM 1 Reply Last reply Reply Quote 0
                • MattSpellerM
                  MattSpeller @DustinB3403
                  last edited by MattSpeller

                  @DustinB3403 said:

                  So I have to backup it up to an img file first and then write it, is that correct?

                  Back it up to the img file then consult with someone who knows more man. We're at the bleeding edge of my linux expertise here.

                  Were it me, I'd take the backup then resize the 32GB usb with gparted then you can use gparted or DD to copy it to the other USB

                  1 Reply Last reply Reply Quote 1
                  • stacksofplatesS
                    stacksofplates
                    last edited by stacksofplates

                    There might be an easier way, but I would dd it to a logical volume, then shrink the logical volume and then dd the volume to the smaller USB.

                    lvcreate -L 32G -n <name> <volumegroup>
                    
                    dd if=/dev/usbdrive of=/dev/<volumegroup>/<volumename> bs=4M
                    
                    resize2fs /dev/<volumegroup>/<volumename> 16G
                    
                    lvreduce -L 16G /dev/<volumegroup>/<volumename>
                    
                    dd if=/dev/<volumegroup>/<volumename> of=/dev/smallerusbdrive
                    

                    I would take a backup of the 32 GB usb drive before I did anything. You can just dd if=/dev/usbdrive of=/home/dustinb3403/usbfile bs=4M to make sure nothing is lost.

                    MattSpellerM 1 Reply Last reply Reply Quote 2
                    • MattSpellerM
                      MattSpeller @stacksofplates
                      last edited by

                      @johnhooks said:

                      then shrink the logical volume

                      How?

                      Also, what do you mean by a logical volume?

                      DashrenderD stacksofplatesS 2 Replies Last reply Reply Quote 0
                      • DashrenderD
                        Dashrender @MattSpeller
                        last edited by

                        @MattSpeller said:

                        @johnhooks said:

                        then shrink the logical volume

                        How?

                        Also, what do you mean by a logical volume?

                        A partition.

                        MattSpellerM 1 Reply Last reply Reply Quote 2
                        • MattSpellerM
                          MattSpeller @Dashrender
                          last edited by MattSpeller

                          @Dashrender Thank you, I'm going to get a coffee, I'm slow today.

                          1 Reply Last reply Reply Quote 1
                          • stacksofplatesS
                            stacksofplates @MattSpeller
                            last edited by

                            @MattSpeller said:

                            @johnhooks said:

                            then shrink the logical volume

                            How?

                            Also, what do you mean by a logical volume?

                            I updated my post to show how

                            MattSpellerM 1 Reply Last reply Reply Quote 1
                            • MattSpellerM
                              MattSpeller @stacksofplates
                              last edited by

                              @johnhooks hero of the thread - thank you, I'm saving that to try at home!

                              stacksofplatesS 1 Reply Last reply Reply Quote 1
                              • stacksofplatesS
                                stacksofplates @MattSpeller
                                last edited by

                                @MattSpeller said:

                                @johnhooks hero of the thread - thank you, I'm saving that to try at home!

                                Ha don't call me a hero until we are sure it works 😛

                                And like I said, there might be an easier way to do this but that's the first I thought of.

                                1 Reply Last reply Reply Quote 1
                                • stacksofplatesS
                                  stacksofplates
                                  last edited by

                                  All of that is also assuming you have space left to make a logical volume. I always leave extra room for LVM snapshots and one off scenarios like this.

                                  1 Reply Last reply Reply Quote 0
                                  • stacksofplatesS
                                    stacksofplates
                                    last edited by

                                    One other thing to watch for. Resize2fs only works with ext file systems. Last I heard you can't shrink an XFS file system, only grow it.

                                    1 Reply Last reply Reply Quote 0
                                    • stacksofplatesS
                                      stacksofplates
                                      last edited by stacksofplates

                                      I thought of one other way that could possibly work also. You can just copy the MBR on the big USB to the small one to make it bootable with dd if=/dev/bigusb of=/dev/smallusb bs=512 count=1 then you can just copy the actual files from the big USB to a new partition on the small one.

                                      1 Reply Last reply Reply Quote 1
                                      • JaredBuschJ
                                        JaredBusch
                                        last edited by

                                        BUy a 32gb USB. They are < $20. How much time are you wasting on this?

                                        DustinB3403D 1 Reply Last reply Reply Quote 3
                                        • DustinB3403D
                                          DustinB3403 @JaredBusch
                                          last edited by

                                          @JaredBusch Thank you Jared, always so wise.

                                          JaredBuschJ 1 Reply Last reply Reply Quote 0
                                          • JaredBuschJ
                                            JaredBusch @DustinB3403
                                            last edited by

                                            @DustinB3403 said:

                                            @JaredBusch Thank you Jared, always so wise.

                                            It is a serious statement man. How much have you cost your company in the pursuit of of this?

                                            DustinB3403D 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post