dd

create a virtual floppy image without mount? [closed]

不想你离开。 提交于 2019-12-17 22:24:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . There are a lot of posts to show to create a virtual floppy image file as a super user or users can run sudo command. The basic steps are: create empty 1.44MB image file by dd command format the image file by mkfs.msdos mount the image file to some mount point copy something to the mount point umount the virtual

Using grep to search for hex strings in a file

女生的网名这么多〃 提交于 2019-12-17 17:42:23
问题 I have been trying all day to get this to work. Does anyone know how to get grep, or something of the like, to retrieve offsets of hex strings in a file? I have a bunch of hexdumps that I need to check for strings and then run again and check if the value has changed. I have tried hexdump and dd, but the problem is because it's a stream, I lose my offset for the files. Someone must have had this problem and a workaround. What can I do? To clarify, I have a series of dumped memory regions from

Low-Level-Writing in C

那年仲夏 提交于 2019-12-07 08:12:43
问题 How can I write to any block on my HDD using the C programming language? There was a question about writing the MBR but it didn't cover the C aspects that much. Since filedescriptors are - as the word says - for files, I guess there is no way to use them in this case. The Low-level I/O included in the C standard library is also implemented with filedescriptors. To put it more precisely: This question is rather about writing HDD blocks than files (OS independent). The answers to the question

Reading a sector on the boot disk

扶醉桌前 提交于 2019-12-07 07:56:48
问题 This is a continuation of my question about reading the superblock. Let's say I want to target the HFS+ file system in Mac OS X. How could I read sector 2 of the boot disk? As far as I know Unix only provides system calls to read from files, which are never stored at that location. Does this require either 1) the program to run kernel mode, or 2) the program to be written in Assembly? I would prefer to avoid either of these restrictions, particularly the latter. 回答1: In Linux, you can read

testing - intentionally corrupt a .Z file using 'dd'

天涯浪子 提交于 2019-12-06 15:08:24
I am trying to test my Python program, which takes in either .zip or .Z files and decompresses them using Python's zipfile module or Unix's gzip , respectively. It makes sure that the filetype is either .zip or .Z (in the latter case, using Unix's file command) before trying to do anything. I wanted to test my error handling in the very rare case in which a verified archive file errors out while being decompressed. So basically, I want to feed it a corrupt .Z file. Someone suggested that I could use Unix's dd command to just mess up a good .Z file and use that as my bad input. I couldn't find

Low-Level-Writing in C

感情迁移 提交于 2019-12-05 13:15:15
How can I write to any block on my HDD using the C programming language? There was a question about writing the MBR but it didn't cover the C aspects that much. Since filedescriptors are - as the word says - for files, I guess there is no way to use them in this case. The Low-level I/O included in the C standard library is also implemented with filedescriptors. To put it more precisely: This question is rather about writing HDD blocks than files (OS independent). The answers to the question mentioned above basically suggested using dd (coreutils) on UNIX-Systems. This is why I am asking for a

Reading a sector on the boot disk

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 11:55:11
This is a continuation of my question about reading the superblock . Let's say I want to target the HFS+ file system in Mac OS X. How could I read sector 2 of the boot disk? As far as I know Unix only provides system calls to read from files, which are never stored at that location. Does this require either 1) the program to run kernel mode, or 2) the program to be written in Assembly? I would prefer to avoid either of these restrictions, particularly the latter. In Linux, you can read from the special device file /dev/sda , assuming the hard drive you want to read is the first one. You need

Reorder lines near the beginning of a huge text file (>20G)

狂风中的少年 提交于 2019-12-05 00:57:00
问题 I am a vim user and can use some basic awk or bash commands. Now I have a text (vcf) file with size more than 20G. What I wanted is to move the line #69 to below line#66: $less huge.vcf ... 66 ##contig=<ID=9,length=124595110> 67 ##contig=<ID=X,length=171031299> 68 ##contig=<ID=Y,length=91744698> 69 ##contig=<ID=MT,length=16299> ... What I wanted is: ... 66 ##contig=<ID=9,length=124595110> 67 ##contig=<ID=MT,length=16299> 68 ##contig=<ID=X,length=171031299> 69 ##contig=<ID=Y,length=91744698> .

Windows C# implementation of linux dd command

◇◆丶佛笑我妖孽 提交于 2019-12-03 12:34:11
I'm writing a C#.Net app to run on windows that needs to take an image of a removable disk and chuck it onto a Linux Live USB. The Live USB is the inserted into the target machine and boots, on start up it runs a script which uses the dd command like so to flash it onto another drive: dd if=/path/to/file/from/csharp/program of=/dev/sdX The problem I am having is creating the image on the windows side. I have tried my Live Linux out with files I have created on a Linux system using dd and that works fine, but I need to be able to create these files from within a C#.Net application on Windows. I

dd: How to calculate optimal blocksize? [closed]

跟風遠走 提交于 2019-12-03 00:10:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . How do you calculate the optimal blocksize when running a dd ? I've researched it a bit and I've not found anything suggesting how this would be accomplished. I am under the impression that a larger blocksize would result in a quicker dd ... is this true? I'm about to dd two identical 500gb Hitachi HDDs that run