Skip to content

Instantly share code, notes, and snippets.

@rdmarsh
Last active July 16, 2016 01:09
Show Gist options
  • Save rdmarsh/0e3ab46c9a64d479ee8edff960cf93a4 to your computer and use it in GitHub Desktop.
Save rdmarsh/0e3ab46c9a64d479ee8edff960cf93a4 to your computer and use it in GitHub Desktop.
check data near end of disk

write last 2MB of disk to a file

# tailfile="taildisk-`date "+%Y%m%dT%H%M%S"`.dat"
# dd if=/dev/sda of=${tailfile} bs=512 skip=$(( $(blockdev --getsz /dev/sda) - 4096 ))
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0185222 s, 113 MB/s
# ls -lah ${tailfile}
-rw-r----- 1 root root 2.0M Jul 16 11:08 taildisk-20160716T110821.dat
# hexdump ${tailfile}
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0200000
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment