-
-
Save bsdnomad/20c4065b9cafd20026f9538d8f108df9 to your computer and use it in GitHub Desktop.
Revisions
-
cetinajero revised this gist
Jan 29, 2024 . No changes.There are no files selected for viewing
-
cetinajero revised this gist
Jan 29, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Guide for using Ddrescue to recover data Start command: -
cetinajero revised this gist
May 5, 2023 . 1 changed file with 8 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -253,14 +253,19 @@ cat file.iso.* > file.iso ## Binary hex editor #### Open file in binary mode ```bash vi -b file.img ``` #### Binary to hex ```bash :%!xxd ``` #### Hex back to binary ```bash :%!xxd -r -
cetinajero revised this gist
May 5, 2023 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -248,3 +248,20 @@ split -b 1G file.iso file.iso. ```bash cat file.iso.* > file.iso ``` --- ## Binary hex editor #### Convert binary to hex using Vim ```bash :set binary :%!xxd ``` #### Convert hex back to binary ```bash :%!xxd -r ``` -
cetinajero revised this gist
Mar 16, 2022 . No changes.There are no files selected for viewing
-
cetinajero revised this gist
Mar 16, 2022 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -226,7 +226,11 @@ tar cf - /directory -P | pv -s $(($(du -sk /directory | awk '{print $1}') * 1024 Uncompress: ```bash # normal tar xzvf file.tar.gz # with progress bar pv file.tar.gz | tar xzf - ``` --- -
cetinajero revised this gist
Mar 16, 2022 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -228,3 +228,19 @@ Uncompress: ```bash tar xzvf file.tar.gz ``` --- ## Splitting files #### Split ```bash split -b 1G file.iso file.iso. ``` #### Join ```bash cat file.iso.* > file.iso ``` -
cetinajero revised this gist
Mar 15, 2022 . 1 changed file with 38 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -183,10 +183,48 @@ Decrypt: openssl enc -aes-256-cbc -d -in encrypted -out decrypted ``` --- ## Hashing files #### Create an MD5 hash ```bash md5 file.img > file.md5 ``` --- ## Compressing files #### ZIP Compress: ```bash zip -vr file.zip directory/ -x "*.DS_Store" ``` Uncompress: ```bash unzip file.zip ``` #### Tar gzip Compress: ```bash # normal tar czvf file.tar.gz directory # with progress bar tar cf - /directory -P | pv -s $(($(du -sk /directory | awk '{print $1}') * 1024)) | gzip > file.tar.gz ``` Uncompress: ```bash tar xzvf file.tar.gz ``` -
cetinajero revised this gist
Mar 15, 2022 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -182,3 +182,11 @@ Decrypt: ```bash openssl enc -aes-256-cbc -d -in encrypted -out decrypted ``` ## Hashing files #### Create an MD5 hash ```bash md5 file.img > file.md5 ``` -
cetinajero revised this gist
Mar 15, 2022 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -169,16 +169,16 @@ bak y 3000000000 \x54\x41\x50\x45 ## Encrypting files #### Strongest symmetric-key algorithm ([AES-256](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) Encrypt: ```bash openssl enc -aes-256-cbc -e -in plaintext -out encrypted ``` Decrypt: ```bash openssl enc -aes-256-cbc -d -in encrypted -out decrypted ``` -
cetinajero revised this gist
Mar 15, 2022 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -164,3 +164,21 @@ foremost.conf: # extension case-sensitive-header? max-file-size header optional-footer bak y 3000000000 \x54\x41\x50\x45 ``` --- ## Encrypting files #### Encrypt using symmetric-key algorithm ([AES-256](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) Encrypt: bash``` openssl enc -aes-256-cbc -e -in plaintext -out encrypted ``` Decrypt: bash``` openssl enc -aes-256-cbc -d -in encrypted -out decrypted ``` -
cetinajero revised this gist
Jul 31, 2021 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,6 +40,12 @@ Input size unknown command: input_size=500123456789; start=199000000000; ddrescue -i$start -s$(($input_size - $start)) /dev/sda output.img output.mapfile ``` Mount img as read-only: ```bash hdiutil attach output.img -shadow output.shadow ``` Here’s what this does: - `-d` tells ddrescue to use direct disk access and ignore the kernel’s cache. @@ -113,7 +119,7 @@ Environment: Download the ddrescue [source code](https://www.github.com/cetinajero/ddrescue). Compile the binary using the static linked libraries flag: ```bash ./configure LDFLAGS="-static" -
cetinajero revised this gist
Jul 31, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ Only copy using certain phases: ddrescue --cpass=1,3-4 /dev/sda output.img output.mapfile ``` Enable retrying phase: ```bash ddrescue -r3 /dev/sda output.img output.mapfile @@ -90,9 +90,9 @@ Then mark the bad sectors found (if any) as bad-sector, and mark the rest of the Scrape together the data not recovered by the copying or trimming phases. Scraping is done in one pass. Each non-scraped block is read forwards, one sector at a time. Any bad sectors found are marked as bad-sector. #### 4. Retrying phase (disabled by default) Try to read again the bad sectors until the specified number of retry passes is reached. The direction is reversed after each pass. Every bad sector is tried only once in each pass. Ddrescue can't know if a bad sector is unrecoverable or if it will be eventually read after some retries. -
cetinajero revised this gist
Jul 30, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,9 @@ Start command: ddrescue -d /dev/sda output.img output.mapfile ``` > NOTE: If _direct disc access_ is not available in your system, try _raw devices_. > > Read your system documentation to find how to bind a _raw device_ to a _regular block device_. Some OSs provide _raw access_ through especial device names, like `/dev/rdisk`. Define the starting position: -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Start command: ddrescue -d /dev/sda output.img output.mapfile ``` > NOTE: If _direct disc access_ is not available in your system, try _raw devices_. Read your system documentation to find how to bind a _raw device_ to a _regular block device_. Some OSs provide _raw access_ through especial device names, like `/dev/rdisk`. Define the starting position: -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Start command: ddrescue -d /dev/sda output.img output.mapfile ``` > NOTE: If _direct disc access_ is not available in your system, try raw devices. Read your system documentation to find how to bind a raw device to a regular block device. Some OSs provide raw access through especial device names, like /dev/rdisk. Define the starting position: -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -80,13 +80,9 @@ The purpose of the multiple passes is to delimit large bad areas fast, recover t #### 2. Trimming phase Trimming is done in one pass. For each non-trimmed block, read forwards one sector at a time from the leading edge of the block until a bad sector is found. Then read backwards one sector at a time from the trailing edge of the block until a bad sector is found. Then mark the bad sectors found (if any) as bad-sector, and mark the rest of the block as non-scraped without trying to read it. If any edge is already adjacent to a bad sector, it is considered as already trimmed and is not trimmed again. #### 3. Scraping phase -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -80,7 +80,13 @@ The purpose of the multiple passes is to delimit large bad areas fast, recover t #### 2. Trimming phase Trimming is done in one pass. For each non-trimmed block, read forwards one sector at a time from the leading edge of the block until a bad sector is found. Then read backwards one sector at a time from the trailing edge of the block until a bad sector is found. Then mark the bad sectors found (if any) as bad-sector, and mark the rest of the block as non-scraped without trying to read it. If any edge is already adjacent to a bad sector, it is considered as already trimmed and is not trimmed again. #### 3. Scraping phase -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -72,7 +72,7 @@ The purpose of the multiple passes is to delimit large bad areas fast, recover t - **First pass**: The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. - **Second pass**: The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. - **Third and fourth passes**: The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. @@ -88,7 +88,9 @@ Scrape together the data not recovered by the copying or trimming phases. Scrapi #### 4. Retrying phase Optionally try to read again the bad sectors until the specified number of retry passes is reached. The direction is reversed after each pass. Every bad sector is tried only once in each pass. Ddrescue can't know if a bad sector is unrecoverable or if it will be eventually read after some retries. --- -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,13 +68,15 @@ Each sector is tried at most two times; the first in the Copying phase as part o Copying is done in up to five passes. The copying direction is reversed after each pass until all the rescue domain is tried. The purpose of the multiple passes is to delimit large bad areas fast, recover the most promising areas first, keep the mapfile small, and produce good starting points for trimming. - **First pass**: The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. - **Second pass**: The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. The skipped areas are tried later in one or three additional passes (before trimming). - **Third and fourth passes**: The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. - **Fifth pass**: The last pass is a sweeping pass, with skipping disabled. #### 2. Trimming phase -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 4 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,21 +68,13 @@ Each sector is tried at most two times; the first in the Copying phase as part o Copying is done in up to five passes. The copying direction is reversed after each pass until all the rescue domain is tried. - **First pass**: The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. - **Second pass**: The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. The skipped areas are tried later in one or three additional passes (before trimming). - **Third and fourth passes**: The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. - **Fifth pass**: The last pass is a sweeping pass, with skipping disabled. The purpose of the multiple passes is to delimit large bad areas fast, recover the most promising areas first, keep the mapfile small, and produce good starting points for trimming. #### 2. Trimming phase -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,21 +68,21 @@ Each sector is tried at most two times; the first in the Copying phase as part o Copying is done in up to five passes. The copying direction is reversed after each pass until all the rescue domain is tried. - First pass The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. - Second pass The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. The skipped areas are tried later in one or three additional passes (before trimming). - Third and fourth passes The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. - Fifth pass The last pass is a sweeping pass, with skipping disabled. The purpose of the multiple passes is to delimit large bad areas fast, recover the most promising areas first, keep the mapfile small, and produce good starting points for trimming. #### 2. Trimming phase -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,19 +68,19 @@ Each sector is tried at most two times; the first in the Copying phase as part o Copying is done in up to five passes. The copying direction is reversed after each pass until all the rescue domain is tried. ##### 1.1 First pass The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. ##### 1.2 Second pass The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. The skipped areas are tried later in one or three additional passes (before trimming). ##### 1.3 Third and fourth passes The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. ##### 1.5 Fifth pass The last pass is a sweeping pass, with skipping disabled. The purpose of the multiple passes is to delimit large bad areas fast, recover the most promising areas first, keep the mapfile small, and produce good starting points for trimming. -
cetinajero revised this gist
Jul 29, 2021 . 1 changed file with 40 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,6 +58,46 @@ Here’s what this does: --- ### Algorithm Only non-tried areas are read in large blocks at Copying phase. Trimming, scraping, and retrying are done sector by sector. Each sector is tried at most two times; the first in the Copying phase as part of a large block read, the second in one of the phases below as a single sector read. #### 1. Copying phase Copying is done in up to five passes. The copying direction is reversed after each pass until all the rescue domain is tried. #### 1.1 First pass The first pass reads the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them. #### 1.2 Second pass The second pass delimits the blocks skipped by the first pass. The first two passes also skip beyond slow areas. The skipped areas are tried later in one or three additional passes (before trimming). #### 1.3 Third and fourth passes The third and fourth passes read the blocks skipped due to slow areas (if any) by the first two passes, in the same direction that each block was skipped. For each block, passes 2 to 4 skip the rest of the block after finding the first error in the block. #### 1.5 Fifth pass The last pass is a sweeping pass, with skipping disabled. The purpose of the multiple passes is to delimit large bad areas fast, recover the most promising areas first, keep the mapfile small, and produce good starting points for trimming. #### 2. Trimming phase Trimming is done in one pass. For each non-trimmed block, read forwards one sector at a time from the leading edge of the block until a bad sector is found. Then read backwards one sector at a time from the trailing edge of the block until a bad sector is found. Then mark the bad sectors found (if any) as bad-sector, and mark the rest of the block as non-scraped without trying to read it. If any edge is already adjacent to a bad sector, it is considered as already trimmed and is not trimmed again. #### 3. Scraping phase Scrape together the data not recovered by the copying or trimming phases. Scraping is done in one pass. Each non-scraped block is read forwards, one sector at a time. Any bad sectors found are marked as bad-sector. #### 4. Retrying phase Optionally try to read again the bad sectors until the specified number of retry passes is reached. The direction is reversed after each pass. Every bad sector is tried only once in each pass. Ddrescue can't know if a bad sector is unrecoverable or if it will be eventually read after some retries. --- ### Statically compiling ddrescue for an ESXI hypervisor v5.5 Install a GNU/Linux OS based on the 2.4 Linux Kernel (e.g. CentOS 3.9). -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,39 +3,39 @@ Start command: ```bash ddrescue -d /dev/sda output.img output.mapfile ``` > NOTE: Use _direct access_ if available. Define the starting position: ```bash ddrescue -i30GiB /dev/sda output.img output.mapfile ``` Define the maximum recovery size of the execution: ```bash ddrescue -s10GiB /dev/sda output.img output.mapfile ``` Only copy using certain phases: ```bash ddrescue --cpass=1,3-4 /dev/sda output.img output.mapfile ``` Deep command: ```bash ddrescue -r3 /dev/sda output.img output.mapfile ``` Input size unknown command: ```bash input_size=500123456789; start=199000000000; ddrescue -i$start -s$(($input_size - $start)) /dev/sda output.img output.mapfile ``` Here’s what this does: -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,6 +32,12 @@ Deep command: # ddrescue -r3 /dev/sda output.img output.mapfile ``` Input size unknown command: ```bash # input_size=500123456789; start=199000000000; ddrescue -i$start -s$(($input_size - $start)) /dev/sda output.img output.mapfile ``` Here’s what this does: - `-d` tells ddrescue to use direct disk access and ignore the kernel’s cache. -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,12 @@ Define the starting position: # ddrescue -i30GiB /dev/sda output.img output.mapfile ``` Define the maximum recovery size of the execution: ```bash # ddrescue -s10GiB /dev/sda output.img output.mapfile ``` Only copy using certain phases: ```bash @@ -32,6 +38,8 @@ Here’s what this does: - `-i bytes` defines the starting position of the rescue domain in infile, in bytes. Defaults to 0. This is not the point from which ddrescue starts copying. (For example, if you pass the option '--reverse' to ddrescue, it starts copying from the end of the rescue domain). - `-s bytes` defines the maximum size of the rescue domain in bytes. It limits the amount of input data to be copied. If ddrescue can't determine the size of the input file, you may need to specify it with this option. Note that this option does not specify the size of the resulting outfile. - `--cpass` selects what pass(es) to run during the copying phase. Valid pass values range from 1 to 5. To run only the given pass(es), specify also `--no-trim` and `--no-scrape`. `--cpass=0` skips the copying phase entirely. - `-r3` tells `ddrescue` to retry bad sectors 3 times before giving up. Note: On a failing drive you may want to eliminate this option the first time so as to not waste time hammering on bad sectors and risking drive failure. You can always use the mapfile to go back and retry the bad sectors after you get an image from the first sweep. -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,16 @@ Start command: ```bash # ddrescue -d /dev/sda output.img output.mapfile ``` > NOTE: Use _direct access_ if available. Define the starting position: ```bash # ddrescue -i30GiB /dev/sda output.img output.mapfile ``` Only copy using certain phases: @@ -24,10 +30,12 @@ Here’s what this does: - `-d` tells ddrescue to use direct disk access and ignore the kernel’s cache. - `-i bytes` defines the starting position of the rescue domain in infile, in bytes. Defaults to 0. This is not the point from which ddrescue starts copying. (For example, if you pass the option '--reverse' to ddrescue, it starts copying from the end of the rescue domain). - `--cpass` selects what pass(es) to run during the copying phase. Valid pass values range from 1 to 5. To run only the given pass(es), specify also `--no-trim` and `--no-scrape`. `--cpass=0` skips the copying phase entirely. - `-r3` tells `ddrescue` to retry bad sectors 3 times before giving up. Note: On a failing drive you may want to eliminate this option the first time so as to not waste time hammering on bad sectors and risking drive failure. You can always use the mapfile to go back and retry the bad sectors after you get an image from the first sweep. - `/dev/sda` is the drive we are rescuing…the whole disk. Naturally, if you just wanted a specific partition, you would use something like `/dev/sda1` instead. - `output.img` is the name of the image file. @@ -74,6 +82,8 @@ brew install testdisk photorec ``` --- #### Foremost Foremost's [Source code](http://foremost.sourceforge.net) -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,23 @@ ## Guide to Using DDRescue to Recover Data Start command: > NOTE: Use _direct access_ if available. ```bash # ddrescue -d /dev/sda output.img output.mapfile ``` Only copy using certain phases: ```bash # ddrescue --cpass=1,3-4 /dev/sda output.img output.mapfile ``` Deep command: ```bash # ddrescue -r3 /dev/sda output.img output.mapfile ``` Here’s what this does: -
cetinajero revised this gist
Jul 28, 2021 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ```bash # ddrescue -d -r3 --cpass=1,3-4 /dev/sda output.img output.mapfile ``` Here’s what this does: @@ -11,12 +11,16 @@ Here’s what this does: - `-r3` tells `ddrescue` to retry bad sectors 3 times before giving up. Note: On a failing drive you may want to eliminate this option the first time so as to not waste time hammering on bad sectors and risking drive failure. You can always use the mapfile to go back and retry the bad sectors after you get an image from the first sweep. - `--cpass` selects what pass(es) to run during the copying phase. Valid pass values range from 1 to 5. To run only the given pass(es), specify also `--no-trim` and `--no-scrape`. `--cpass=0` skips the copying phase entirely. - `/dev/sda` is the drive we are rescuing…the whole disk. Naturally, if you just wanted a specific partition, you would use something like `/dev/sda1` instead. - `output.img` is the name of the image file. - `output.mapfile` is the name of the mapfile. Always use a mapfile. This allows you to resume an interrupted image at the point you left off, or to retry bad sectors after an initial pass. Without a mapfile, you will have to start over again! --- ### Statically compiling ddrescue for an ESXI hypervisor v5.5 Install a GNU/Linux OS based on the 2.4 Linux Kernel (e.g. CentOS 3.9).
NewerOlder