dd

Copy n bytes of data x to file

放肆的年华 提交于 2021-02-18 10:44:30
问题 How we can copy for example 10 bytes of '7' to a file? How can I generate those 10 bytes of 7? For example for n bytes of zero I'm doing dd if=/dev/zero of=myFile bs=1 count=10 . 回答1: You can send the zeros to stdout and translate them to 7, or what ever you like. dd if=/dev/zero bs=1 count=10 | tr "\0" "\7" > file.bin 回答2: redirect an echo output to dd echo 7777777777 | dd of=myFile bs=1 count=10 or echo -e '\x7\x7\x7\x7\x7\x7\x7\x7\x7\x7' | dd of=myFile bs=1 count=10 if you need the binary

How to prevent windows from accessing and detecting new volumes while writing a raw image file to PhysicalDrive?

て烟熏妆下的殇ゞ 提交于 2021-02-10 03:22:09
问题 After lots and lots of try and error I am now able to flash/write a raw image file (containing multiple partitions) to \\.\PhysicalDriveN (SD-Card in my case) by just using Windows Api calls ( see below ). But as soon as I have some explorer windows open and click around, the write process fails ( error 433 ). Another annoying problem are popup messages telling me that a new volume has to be formatted (at the beginning, while I am still writing!) or autoplay asks me to select an action (after

int 13h doesn't appear to read sectors containing my kernel

眉间皱痕 提交于 2021-02-08 05:07:19
问题 I am trying to load up a little data using my bootloader on a USB, but apparently int 13h won't work! Bootloader: [bits 16] [ORG 0x7c00] jmp 0x0000:start start: cli xor ax, ax mov ss, ax mov sp, 0x7c00 mov ax, cs mov ds, ax mov es, ax mov fs, ax mov gs, ax sti mov [driveno], dl reset: ;reset drive xor ax, ax mov dl, [driveno] int 0x13 or ah, ah jnz reset mov ah, 0x02 mov al, 0x01 mov bx, 0x0000 mov es, bx mov bx, 0x7e00 mov dl, [driveno] xor dh, dh mov cx, 0x0002 int 0x13 or ah, ah jnz reset

How can i debugging my adonis ( nodejs ) framework APIs?

二次信任 提交于 2021-01-29 13:37:28
问题 I'm just beginner in adonis framework in NodeJS but I have a good experience in laravel and lumen framework in laravel and lumen framework APIs I use dd() dump and die to debugging my app but in the AONIS framework, I don't know how to debug my API code . for IDE = I'm using Microsoft visual studio ( VS Code ) 回答1: Read this : https://code.visualstudio.com/docs/nodejs/nodejs-debugging (from @damitj07) In summary : You need to create new lauch.json like: { // Use IntelliSense to learn about

Is there a fast way to read alternate bytes in dd

有些话、适合烂在心里 提交于 2021-01-27 18:12:21
问题 I'm trying to read out every other pair of bytes in a binary file using dd in a loop, but it is unusably slow. I have a binary file on a BusyBox embedded device containing data in rgb565 format. Each pixel is 2 bytes and I'm trying to read out every other pixel to do very basic image scaling to reduce file size. The overall size is 640x480 and I've been able to read every other "row" of pixels by looping dd with a 960 byte block size. But doing the same for every other "column" that remains

overwrite a file on tape

半腔热情 提交于 2020-04-30 06:24:48
问题 I'm trying to write a program to store large amount of data (100s of PB) on tapes. I'm using tar to group files together, but for technical reasons I've decided to write multiple tars in one tape. In order to easily find what data are on a tape, I've decided to create a small index and write it at the beginning of the tape. So I'm doing something like this: # create an empty index file head -c 1M < /dev/urandom > index.txt # rewind tape mt -f /dev/nst0 rewind # write index to the beginning of

linux dd命令参数及用法详解

僤鯓⒐⒋嵵緔 提交于 2020-03-14 16:48:36
dd 的主要选项 指定数字的地方若以下列字符结尾,则乘以相应的数字: b=512, c=1, k=1024, w=2, xm=number m if= file # 输入文件名,缺省为标准输入。 of=file # 输出文件名,缺省为标准输出。 ibs=bytes # 一次读入 bytes 个字节(即一个块大小为 bytes 个字节)。 obs=bytes # 一次写 bytes 个字节(即一个块大小为 bytes 个字节)。 bs=bytes # 同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。 cbs=bytes # 一次转换 bytes 个字节,即转换缓冲区大小。 skip=blocks # 从输入文件开头跳过 blocks 个块后再开始复制。 seek=blocks # 从输出文件开头跳过 blocks 个块后再开始复制。(通常只有当输出文件是磁盘或磁带时才有效)。 count=blocks # 仅拷贝 blocks 个块,块大小等于 ibs 指定的字节数。 conv=conversion[,conv ersion...] 用指定的参数转换文件,支持如下 转换参数: ascii 转换 EBCDIC 为 ASCII eb cd ic 转换 ASCII 为 EBCDIC ibm 转换 ASCII 为 alternate EBCDIC block

如何快速在Linux系统的硬盘上创建大文件

妖精的绣舞 提交于 2020-02-29 22:03:20
dd 命令可以轻易实现创建指定大小的文件,如 dd if=/dev/zero of=test bs=1M count=1000 会生成一个 1000M 的 test 文件,文件内容为全 0 (因从 /dev/zero 中读取, /dev/zero 为0源) 但是这样为实际写入硬盘,文件产生速度取决于硬盘读写速度,如果欲产生超大文件,速度很慢 在某种场景下,我们只想让文件系统认为存在一个超大文件在此,但是并不实际写入硬盘 则可以 dd if=/dev/zero of=test bs=1M count=0 seek=100000 此时创建的文件在文件系统中的显示大小为 100000MB ,但是并不实际占用block,因此创建速度与内存速度相当, seek的作用是跳过输出文件中指定大小的部分,这就达到了创建大文件,但是并不实际写入的目的。 当然,因为不实际写入硬盘,所以你在容量只有 10G 的硬盘上创建 100G 的此类文件都是可以的 来源: oschina 链接: https://my.oschina.net/u/148042/blog/319004

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

扶醉桌前 提交于 2019-12-23 02:31:18
问题 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

Windows C# implementation of linux dd command

…衆ロ難τιáo~ 提交于 2019-12-21 04:06:58
问题 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