26 votes

dd on entire disk, but do not want empty portion

Use dd, with the count option. In your case you were using fdisk so I will take that approach. Your "sudo fdisk -l "produced: Disk /dev/sda: 64.0 GB, 64023257088 bytes 255 heads, 63 sectors/...
plasmapotential's user avatar
19 votes

Linux / BSD "quickly" wipe a USB drive?

The Linux command to remove all disklabel and file systems signatures is: wipefs -a /dev/sd### Most modern flash disks and flash USB sticks are supporting TRIM / DISCARD / SCSI UNMAP. For USB you ...
Mircea Vutcovici's user avatar
18 votes

dd on entire disk, but do not want empty portion

While /dev/zeroing the free-disk-space and use dd conv=sparse/gz -c is possible, on huge disks with empty space running in 100s of GBs, /dev/zeroing is painfully slow - not to mention that as other ...
Ashish Chopra's user avatar
16 votes

Break up a dd image into multiple files

It is my command line: dd if=/dev/sda bs=4M | gzip -c | split -b 2G - /mnt/backup_sda.img.gz It will create 2GB files in this fashion: backup_sda.img.gz.aa backup_sda.img.gz.ab backup_sda.img.gz.ac ...
Aaron's user avatar
  • 161
15 votes
Accepted

Linux / BSD "quickly" wipe a USB drive?

The fastest way is to remove all partitions on the drive. This will "remove" also filesystems. And zero first megabyte (boot record and so). dd if=/dev/zero of=/dev/da0 bs=1M count=1 and ...
Romeo Ninov's user avatar
  • 5,932
10 votes

Linux / BSD "quickly" wipe a USB drive?

There's different kinds of USB storage devices. If your device supports it, blkdiscard /dev/da0 on Linux, or trim /dev/da0 on FreeBSD will tell the drive to just drop all data. That's going to be ...
Marcus Müller's user avatar
8 votes

Best way to remove text from the beginning of a huge file

bunzip2 -c backup.sql.bz2 | \ sed -n '/-- Table structure for `mytable`/,$p' Explanation: -n suppress automatic printing of pattern space Address range construction: Start with regex /-- Table ...
Mark Wagner's user avatar
  • 18.1k
7 votes
Accepted

Does it involve network to copy a file within a NFS share?

NFSv4.2 does have a offload-copy operation which can do server-to-server copy without proxying data trough the client. Modern linux kernels (> 3.13?) supports that. I don't know about other servers....
kofemann's user avatar
  • 4,866
7 votes
Accepted

dd: zero-out all the remaining unused space of a drive

The /zero-Tag is actually a file name. The command just copies zeros from the virtual File /dev/zero (infinite number of zeros) into /mnt/hdb/zero until the disk is full, or some other error occurs. ...
x539's user avatar
  • 162
7 votes

Linux / BSD "quickly" wipe a USB drive?

I do not care about "securely" wiping the data I just want it wiped so I can re-establish the partition structure and filesystem from scratch Just run mkfs on the partitions.
symcbean's user avatar
  • 22.4k
6 votes

Cloning a bitlocker encrypted disk

Since it seems like the original question was never answered, I've tested using GNU dd to clone a disk encrypted with Microsoft BitLocker (in my case it was a spinning disk to a SSD) and it worked ...
codesniffer's user avatar
6 votes

Cloning data from a damaged SSD

Clonezilla might come handy in your situation. You can definitely copy mismatched partitions with it! https://clonezilla.org/
BaronSamedi1958's user avatar
5 votes

Create a VHD file from a Linux disk

You wrote that "QEMU is a Linux package", but is not fully true anymore. One example of build of QEMU for Windows is as part of WinSetupFromUSB 1.8 program. The other build of QEMU is in qemu-img for ...
user1742529's user avatar
5 votes

dd on entire disk, but do not want empty portion

The accepted answer is not right. I agree with the comment above. I use dd with count parameter to back up my disk on a regular base. Simply replace the BACKUP_FOLDER and letter of your device with "X"...
Aloha D's user avatar
  • 51
4 votes
Accepted

Repair FAT filesystem on image

You have made the image of your whole USB pen drive with your dd command. This means that the image includes also a partition table. That is why you cannot mount the image directly as a file system. ...
Tero Kilkanen's user avatar
4 votes
Accepted

Using DD to clone a 600GB drive using SSH to remote location with only 60 GB of allocated data [server migration]

Ok, guys... finally, server migration was executed with status SUCCESS! Data copy time was aprox 5hs 30Min. Command & total time: dd if=/dev/sda bs=5M conv=fsync status=progress | gzip -c -9 | ssh ...
Diego Ferrarese's user avatar
4 votes

Cloning data from a damaged SSD

Do you have to do it at partition level? It might be easier to move the files instead, as you wouldn't need to mess around with shrinking the old filesystem or anything like that. A cp -avx will do ...
u1686_grawity's user avatar
3 votes

ddrescue -- which files are in error locations?

ddrutility was created for just this purpose. I successfully got it to list affected NTFS files given a ddrescue mapfile in under 20 seconds. It writes its log file in the current directory.
Tom Hale's user avatar
  • 1,155
3 votes

Does it involve network to copy a file within a NFS share?

The "copy a file" operation is not a basic file-system operation such as read, write, open, close, and similar operations. See this page for a good explanation of the operations a filesystem has to ...
Andrew Henle's user avatar
  • 1,282
3 votes

Moving a Logical Volume directly from one server to another over the network?

First make sure that the logical volume is not mounted. If it is and you want to make a "hot copy", create a snapshot first and use this instead: lvcreate --snapshot --name transfer_snap --size 1G I ...
bhelm's user avatar
  • 141
3 votes

Moving a Logical Volume directly from one server to another over the network?

First I would take a snapshot of the lv: lvcreate --snapshot --name my_shot --size <thesize> /dev/<name of vg>/<name of lv> After that you have to create a new lv on the new host (...
Woolf's user avatar
  • 31
3 votes

Using DD for disk cloning

The most info was described in previous inserted recipies, but not all was described. Under linux you can clone hard drive or partition by dd command. Attention, when you'll make a mistake, you will ...
Znik's user avatar
  • 348
3 votes

Why does dd make the host unresponsive?

Short answer: the server become unresponsive because you filled almost all memory with dirty pages (ie: data to be flushed out). Long answer: generally, writes do not push data to the backing device ...
shodanshok's user avatar
  • 50.5k
3 votes

Cloning data from a damaged SSD

Disk cloning is the process of making an image of a partition or of an entire hard drive. This can be useful for copying the drive to other computers or for backup and recovery purposes. Note: Disk ...
Z0OM's user avatar
  • 328
3 votes
Accepted

Cloning data from a damaged SSD

You have to shrink the PV before cloning it with dd, but read only status of the SSD prohibits this. But, using an overlay difference image you can still do it. In general it is the same as I ...
Nikita Kipriyanov's user avatar
2 votes

Cloning a bitlocker encrypted disk

You'll find that AOMEI and other backup solutions can clone Bitlocker drives, but the result is an unencrypted drive (using sector by sector copy, and the bitlocker source has to be unlocked). Casper ...
AlW's user avatar
  • 21
2 votes

PXE booting .IMG and .DD images

First of all, ensure memdisk is actually present on your TFTP server and can be served to clients. It's not a magic invocation, memdisk is a separate component of syslinux. Secondly, loading ISOs in ...
Carcer's user avatar
  • 1,007
2 votes

Backup and Restore Using dd and gzip

You can use ddrescue with its -S option: -S --sparse Use sparse writes for outfile. (The blocks of zeros are not actually allocated on disc). May save a lot of disc space in some cases. Not all ...
shodanshok's user avatar
  • 50.5k
2 votes
Accepted

dd's relation with page cache

dd does not directly use page cache, it does I/O which is automatically cached. Dropping a cache simply because something was committed is inefficient. The next read would need to come from the ...
John Mahowald's user avatar
2 votes
Accepted

Find out exact location of GRUB / GRUB not working after copying disk image

In the GRUB2-created MBR, starting at offset 0x5c, there is a little-endian 64-bit value indicating the number of the next disk block to be loaded. This is often block 0x00000000 00000001, i.e. the ...
telcoM's user avatar
  • 4,598

Only top scored, non community-wiki answers of a minimum length are eligible