Changes between Version 16 and Version 17 of BadBlockHowto


Ignore:
Timestamp:
Mar 30, 2017, 11:13:27 AM (7 years ago)
Author:
Christian Franke
Comment:

Add shell examples for hex <> decimal conversions

Legend:

Unmodified
Added
Removed
Modified
  • BadBlockHowto

    v16 v17  
    10001000[=#footnote4 [4]] Important: set blocksize range is arbitrary, but do not only test a single block, as bad blocks are often social. Not too large as this test probably has not 0% risk.
    10011001
    1002 [=#footnote5 [5]] The rather awkward {{{`expr 484335 + 100`}}} (note the back quotes) can be replaced with `$((484335+100))` if `bash` or any [http://pubs.opengroup.org/onlinepubs/007908799/xcu/chap2.html#tag_001_006_004 POSIX 1997+] compatible shell is being used. Similarly the last argument can become `$((484335-100))`.
     1002[=#footnote5 [5]] The rather awkward {{{`expr 484335 + 100`}}} (note the back quotes) can be replaced with `$((484335+100))` if `bash` or any [http://pubs.opengroup.org/onlinepubs/007908799/xcu/chap2.html#tag_001_006_004 POSIX 1997+] compatible shell is being used. Similarly the last argument can become `$((484335-100))`. See also ^[#footnote11 11.]^ below.
    10031003
    10041004[=#footnote6 [6]] `testdisk` scans the media for the beginning of file systems that it recognizes. It can be tricked by data that looks like the beginning of a file system or an old file system from a previous partitioning of the media (disk). So care should be taken. Note that file systems should not overlap apart from the fact that extended partitions lie wholly within a extended partition table allocation. Also if the root partition of a Linux/Unix installation can be found then the `/etc/fstab` file is a useful resource for finding the partition numbers of other partitions.
     
    10121012[=#footnote10 [10]] In this case the corruption was manufactured by using the `WRITE LONG SCSI` command. See `sg_write_long` in `sg3_utils`.
    10131013
    1014 [=#footnote11 [11]] Most window managers have a handy calculator that will do hex to decimal conversions.
     1014[=#footnote11 [11]] Most window managers have a handy calculator that will do hex to decimal conversions. On the shell command level, the [http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html printf] command or [http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04 Arithmetic Expansion] could be used: `printf '%d\n' 0xC0DEBA5E` and `echo $((0xC0DEBA5E))` print `3235822174`. The command `printf '0x%X\n' 3235822174` prints `0xC0DEBA5E`. At least recent versions of `bash`, `busybox`, `dash` and `zsh` support 64-bit signed integer arithmetic, other shells may be limited to 32-bit.
    10151015
    10161016[=#footnote12 [12]] See [https://cygwin.com/].