Situation: I hung up a 10 gb of disk/dev/VDB on Linux, a single sector size of 512, points inside a zone/dev/vdb1, vdb1 start sector number is 2048, corruption,
Then I through the dd to/dev/vdb1 seek=2048 bs=1 b the location of the count=1 write 512 characters a,
Next I through dd/dev/VDB skip=4096 bs=1 b count=1, the location of the reading data is read out is not the characters a, why???
CodePudding user response:
You use the wrong, I remember is written to the hard disk read is to seek the skipCodePudding user response:
The seek is effective to target the skip is effective to the sourceCodePudding user response:
The command processes:# df -h
The Filesystem Size, informs the Avail Use % Mounted on
Devtmpfs 0 0% 3.7 G/3.7 G dev
TMPFS 3.7 G 3.7 G 0 0%/dev/SHM
TMPFS 21 m 3.7 G 3.7 G 1%/run
TMPFS 3.7 G 3.7 G 0 0%/sys/fs/cgroup
39 G 3.3 G/dev/vda2 34 G 10%/
/dev/vda1 1022 M, 7.7 M, 1015 M 1%/boot/efi
TMPFS 758 m 0 758 m 0%/run/user/0
37 m/dev/vdb1 9.8 G 9.2 G 1%/data//vdb1 mount the
C # (the head - 512/dev/urandom | base64) & gt; ./af
. # dd if=/af bs x1=16 count=1 | od - t
1 + 0 records in
1 + 0 records out
16 bytes (16 B) 48 46 copied0000000 49 36 66 66 45 46 4 B 2 B 4 c 33 42 2 f 37 4 e
0000020
And 3.7831 e-05 s, 423 kB/s
. # dd if=/af of=/dev/vdb1 bs=512 count=1 the seek=2048
# dd if=/dev/vdb1 bs x1=16 | od - t | grep "48 46 49 36 66 66 45 46 4 b 2 b 4 c 33 42 2 f 37 4 e"
48 46 49 36 4000000 66 66 4 c 46 4 b 2 b 45 33 42 2 f 37 4 e
1274685 + 0 records in
1274685 + 0 records out
20394960 bytes (20 MB) copied, 1.7184 s, 11.9 MB/s//here in vdb1 found above the dd write offset is the
# dd if=/dev/VDB bs x1=512 | od - t | grep "48 46 49 36 66 66 45 46 4 b 2 b 4 c 33 42 2 f 37 4 e"
20971520 + 0 records in
20971520 + 0 records out
10737418240 bytes (GB) copied, 57.087 s, 188 MB/s//in VDB but did not find here,
CodePudding user response:
I tested the discovery is not practical to write inside, what you see is the kernel cache, you write after unmounting partitions in view can
[root @ ll TMP] # df -h
File system capacity already available already use % hardpoints
Dev 7.8 G 7.8 G 0 0%/dev
Run 7.8 G 1.2 M 7.8 G 1%/run
/dev/sda2 55 g 257 g, 328 g 18%/
TMPFS 250 m 7.6 G 7.8 G 4%/dev/SHM
TMPFS 7.8 G 7.8 G 0 0%/sys/fs/cgroup
TMPFS 116 m 7.7 G 7.8 G 2%/TMP
/dev/sda3 24 g 129 g, 99 g 20%/home
/dev/sda1 57 m 509 m 427 m 12%/boot
TMPFS 1.6 G 1.6 G 1% 52 k/run/user/1000
/dev/sdb1 945 m 69 m 811 m 8%/MNT
[root @ ll TMP] # (head - 512 c/dev/urandom | base64) & gt; ./rand
[root @ ll TMP]. # dd if=/rand bs x1=16 count=1 | od - t
Recorded the read of 1 + 0
Recorded the write of 1 + 0
16 bytes copied, 0.000140631 s, 114 kB/s0000000 43 55 6 a 38 45 59 42 and 43 30 5 6 7 a 54 36 b 46 69
0000020
[root @ ll TMP] # dd if=rand of=/dev/sdb1 bs=512 count=1
Recorded the read of 1 + 0
Recorded the write of 1 + 0
512 bytes copied, 0.00262536 s, 195 kB/s
[root @ ll TMP] # dd if=rand of=/dev/sdb1 bs=512 count=1 ^ C
[root @ ll TMP] # dd if=/dev/sdb1 bs x1=16 | od - t | grep 43 43 to 55 "6 a"
43 43 to 55 0000000 6 a 38 45 59 42 30 5 6 7 a 54 36 b 46 69
Recorded 720095 + 0 ^ C read
Recorded the write of 720094 + 0
11521504 bytes (12 MB, 11 MiB) copied, 1.35463 s, 8.5 MB/s
[root @ ll TMP] # sync
[root @ ll TMP] # umount/dev/sdb1
[root @ ll TMP] # dd if=/dev/SDB bs x1=16 | od - t | grep 43 43 to 55 "6 a"
43 43 to 55 4000000 6 a 38 45 59 42 30 5 6 7 a 54 36 b 46 69
Recorded 556692 + 0 ^ C read
Recorded the write of 556691 + 0
8907056 bytes (8.9 MB, 8.5 MiB) copied, 1.03778 s, 8.6 MB/s
CodePudding user response:
Brother this points but conscience, I didn't eat lunch to verify this problem