Clone usb flash linux

How to clone a USB flash drive using dd?

Using ‘dd’ to clone a USB drive -cfdisk: resized the destination partition to be of same size made the partition bootable same ‘type’ ext3 ran ‘mkfs.ext3’ after exit cfdisk then dd if=dev/sda1 of=/dev/sdb1 result booting: Missing operating system. The source USB device boots on multiple laptops USB destination filesystem looks the same. Any idears?

Why are you gooing through all the effort to setup partitions and filesystems? Just copy the entire disk. dd if=/dev/sda of=/dev/sdb

You are probably right, but this is the result. the 2nd USB is slightly smaller in size dd if=/dev/sda of=/dev/sdb dd: writing to `/dev/sdb’: No space left on device 15654849+0 records in 15654848+0 records out 8015282176 bytes (8.0 GB) copied, 3430.66 s, 2.3 MB/s

then you have to first resize the partition on the originating drive soi that it won’t end after the end of the device after clone, after that it’s just simple dd if=/dev/sda of=/dev/sdb bs=8192 and ignoring the error

4 Answers 4

I recently had to clone a 32gb trancend thumbdrive onto another. My drive is a multiboot with additional software so I didn’t want to just copy all files on the FS. DD was a clear choice, but I was on windows.

I had cygwin installed and did the following.

first I had to figure out what /dev/sdX device my f: volume was. To do so run this command in cygwin. (TIP: Make sure you start cygwin with admin privs.. *Right click on cygwin and «Run as Administrator»)

 8 0 3813383838 sda 8 1 4031 sda3 C:\ 8 15 30588303 sdb 8 15 30588303 sdb1 E:\ 8 21 30530020 sdc 8 22 30530020 sdc1 F:\ 

etc. Here you can clearly see for me to clone my F: drive to my E: drive I’d issue the following command.

dd if=/dev/sdc of=/dev/sdb bs=8M 

My image was 32gb.. and I didn’t want to just sit and wait with a blinking cursor.. I wanted to see progress so I installed «pv» in cygwin.

dd if=/dev/sdc | pv | dd of=/dev/sdb bs=8M 

To follow the progress of the copy, no need to use pv , just add the status=progress option to your command : dd if=/dev/sdc of=/dev/sdb bs=8M status=progress

You copied the partition, but not the MBR. Copy the first 446 bytes of the device itself.

No, that will wipe the partition table as well. And I’m not psychic, so I don’t know if those are the correct devices. You’re definitely on the right track though.

Everything past byte 440 is unique to the drive and should not be copied. And I speak not only from experience. en.wikipedia.org/wiki/Master_boot_record

As the story goes. did dd if=/dev/sda of=/dev/sdb bs=512 count=1, tried booting from it. All I got was ‘GRUB’ So then tried example from first comment of Zoredache above: result —> cfdisk /dev/sdb «FATAL ERROR Bad primary partition 1: Partition ends after end-of-disk Press any key to exit cfdisk back to my Pretty good friend Google.

Читайте также:  Rust compiler install linux

‘should not’ be copied? you’re cloning the thumb drive, i’ve done similar things in the past, and granted it’s been a long time, but i don’t seem to remember any issues of two thumb drives sharing the same MBR, bit for bit. MentalBlister: DROP THE count=1 you’re only copying the first 512 bytes with count=1 get rid of the count parameter completely.

If the drives are the same size, why not just clone the entire drive?

dd if=/dev/sda of=/dev/sdb bs=(whatever) count=(whatever)

I’ve used this to clone HP ThinState configuration disks for HP thin clients that «don’t work» with devices over 2GB — so long as I have a small enough drive to use as a master, I can clone it onto e.g. a 4GB drive and the thin client will happily boot from it.

Edit: Reading the above on «unique» IDs in/near the MBR, I don’t see a problem with cloning an identical device if it’s truly a clone — as long as you don’t try to copy things between the two.

Источник

How do I clone a USB stick including partitions?

To clone directly from drive to drive, use this command: Alternatively, if you have enough space on your internal drive, you could create an image first, making creation of multiple copies easier: Then, use the image to create clones: This way, you could provision multiple drives at the same time, provided one target drive doesn’t already saturate the USB bandwidth. Also, to make it bootable, you must copy from device-to-device (e.g. ), NOT from partition to partition ( ) Use or to find out which block devices your target internal hard disk (usually ) and external USB hard disk (usually ) are.

How do I clone a USB stick including partitions?

Yes, this is very easy. Of course, the target drives need to be at least as large as the source drive.

Then, having both source and target drive connected, use something like fdisk -l , lsblk or whatever to identify the device names (like /dev/sdb ) for each. Make absolutely sure you get the order right!

To clone directly from drive to drive, use this command:

dd if=/dev/source of=/dev/target bs=1M 

Alternatively, if you have enough space on your internal drive, you could create an image first, making creation of multiple copies easier:

dd if=/dev/source of=/home/me/image.img bs=1M 

Then, use the image to create clones:

dd if=/home/me/image.img of=/dev/target bs=1M 

This way, you could provision multiple drives at the same time, provided one target drive doesn’t already saturate the USB bandwidth.

If the target drive is larger, you might want to enlarge the last partition afterwards, using parted or another suitable tool. Do note that you cannot resize partitions between other partitions if you copy the whole structure.

You can use dd https://en.wikipedia.org/wiki/Dd_(Unix)

Example: dd if=/dev/sdc of=/dev/sdd bs=1M

if is the source device. Use the device name not the partition (the number at the end is the partition, for example /dev/sdc1).

of is the destination device.

Be VERY careful with this command. It will completly wipe the destination device.

Partitioning — Fastest way to copy HDD, Given HDD 1TB with a two partitions: one is small ~24GB (for Ubuntu) and all the rest is the second partition with about 10% occupied space for multimedia files. I want to duplicate it as fast as possible. I boot from USB stick. The second disk is /dev/sdb. sfdisk -d /dev/sda > a sfdisk /dev/sdb < a. Then I …

Читайте также:  Linux имя файловой системы

🔴HOW TO CLONE A FIRESTICK TO ANOTHER

Are you looking for a way to copy apps from one firestick to another? This application will allow you to backup all your application installed on your Firest

How to Delete All Partitions On a USB Flash Drive

A tutorial on how to delete all partitions on a USB flash drive in Windows.Text: https://simpletechtutorials.blogspot.com/2016/09/how-to …

How do I use dd to clone an external USB drive installation to a local hard disk?

Using dd to clone an Ubuntu installation

Yes, you can use dd to clone an installation, but it’s not the fastest/easiest way to do it. It’s better to do it via backup/restore with a live-tool such as Clonezilla.

  • If you wish to use dd , note that the target disk must be the same size or larger than the source.
  • Also, to make it bootable, you must copy from device-to-device (e.g. /dev/sdX ), NOT from partition to partition ( /media/. )
  • Use sudo fdisk -l or gparted to find out which block devices your target internal hard disk (usually /dev/sda ) and external USB hard disk (usually /dev/sdb ) are.
  • Then use dd with exactly the following syntax, where x is the letter for the USB drive and y the letter for the internal drive which you have determined in the previous step:
 sudo dd if=/dev/sdx of=/dev/sdy bs=8M && sync 

TAILS on USB: How to use the rest of the stick, Use program in tails to clone/install tails onto flash drive. Boot from flash drive. Create persistence partition using persistence installer in tails once booted from flash drive. You could do this replacing the DVD with another flash drive if you have one. I felt like this method was pretty easy and fool proof.

How to move Linux on a USB stick to a hard drive partition?

Try installing Ubuntu and moving home directory to your new system.

If you need to move it and it’s a proper installation (not live version) then use

dd bs=4M if=/dev/partition_on_pendrive of=/dev/partition_on_disk

Then chroot into partition you’ve created and install grub. Don’t forget about swap.

i used fsarchiver in SystemrescueCD(www.sysresccd.org).

Steps to backup and restore:

  1. Boot with SystemrescueCD
  2. type fsarchiver probe in terminal to see the devices
  3. to save the Ubuntu 14.04(partition) in /dev/sdb1 as a .fsa file, type the below command in terminal $fsarchiver savefs -j2 -o /media/masha/Data/backup/backup/Ubuntu1404.fsa /dev/sdb1

NOTE: use -j2 (dual core) -j4 (quad) to speed up

  1. to restore the Ubuntu 14.04( fsa file) in /dev/sda1 (OS partition), type the below command in terminal fsarchiver restfs /media/masha/Data/backup/backup/Ubuntu1404.fsa
  2. After restoring, open Gparted , select /dev/sda5 and get new uuid.
  3. mount /dev/sda5 using mount /mnt/ubuntu14 /dev/sda5 and update ubuntu14/etc/fstab with new id. And also update mtab file.
  4. if required change host, hostname files.
  5. then restart with ubuntu and update grub using Grub customiser . verify uuid before updating

I use Gparted and boot-repair on a live USB (in many system rescue iso).

Читайте также:  Update public key linux

Boot with this live USB. Mount your external drive and your internal drive.

With Gparted : Free space for the new primary partition (non logical) on your internal drive. (size > size of the partition on the external drive). Copy-paste the ext4 linux partition of your external drive on your free space created in the internal drive. Wait . Adjust the size, add partition(s), add swap.

With boot-repair : Update GRUB2.

Reboot (without USB stick and USB external drive).

You’ll see grub menu, choose linux. Test the settings of your linux programs. Change in some programs /sdbX (or /sdaX or /sdcX) to /sdaY (Y = your / or /home partiton number). You can also customize the GRUB2 menu with grub-customizer.

Clone — SD card cloning using the dd command, Insert the original SD card and check the name of the device (usually mmcblkX or sdcX ): sudo fdisk -l You might see: Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 * 2048 2099199 2097152 1G c W95 FAT32 (LBA) /dev/mmcblk0p2 2099200 31116287 29017088 13.9G 83 Linux

How to edit a bootable USB stick?

Depending on how you created the USB boot drive, it will be read-write or read-only.

Cloned drive

A cloned drive created with the ‘Startup Disk Creator’ in Ubuntu 16.04 LTS or newer versions, has a hybrid iso9660 file system, which works both in DVDs and USB pendrives (and memory cards), but it is read-only by design, so you cannot edit anything in it. Also ‘Disks’ alias gnome-disks , and ‘mkusb’ (when cloning and creating live-only drives) make USB drives with a hybrid iso9660 file system.

Extracted drive

An extracted drive, for example

can be edited. You can add nomodeset and other boot options to the boot configuration file, so that they will persist (survive to be used in the future). Edit boot/grub/grub.cfg in partition #3, ‘usbboot’ for mkusb. You may need to boot from another drive in order to mount the FAT32 file system read-write for Rufus.

New tips to make your USB boot drive with Ubuntu 19.10+

  • You can edit your binary iso file and replace the cosmetic boot options quiet splash with the boot option ‘persistent ‘ or ‘nopersistent’ (the strings contain 12 characters, so the replacement can be done without any offset in the following part(s) of the iso file. You can do it with sed
sed 's/quiet splash/persistent /' standard.iso > persistent.iso sed 's/quiet splash/nopersistent/' standard.iso > nopersistent.iso 
sed 's/quiet splash/persistent /' standard.iso > /dev/sdx sed 's/quiet splash/nopersistent/' standard.iso > /dev/sdx 

You could try UNetBootIn. It’s a software which allows you towrite to existing partitions on the usb stick, like fat32 or ext4. Persistence only works with fat32. However the usb stick is writeable due to its filesystem.

Unetbootin can be downloaded using

sudo apt update && sudo apt install unetbootin 

If you flash your image using rufus on windows using GPT boot structures then you can use (on Ubuntu 16.04 LTS): sudo mount -o remount,rw /media/cdrom /media/cdrom to remount your drive. I wouldn’t recommend it but it does work.

🔴HOW TO CLONE A FIRESTICK TO ANOTHER, Are you looking for a way to copy apps from one firestick to another? This application will allow you to backup all your application installed on your Firest

Источник

Оцените статью
Adblock
detector