Thinking Out Loud

January 27, 2016

Checksum entire directory using md5sum

Filed under: linux — mdinh @ 11:52 pm

When you are backing up 3.5+ TB database, resulting in 600+ GB backupset, transferring to new DC, you would want to ensure there are no corruptions resulting from transfer.

Here is an example of how to perform checkum using md5sum for all the contents in the directory.

Taking the process further, split the .md5 file into multiple files for parallel processing.

oracle@arrow:hawklas:/oradata/keep
$ md5sum *MIG* > backup.md5


oracle@arrow:hawklas:/oradata/keep
$ cat backup.md5
080adb9ba716f3bf6f91efb06adc311e  HAWK_3130551611_20160127_hfqsdvfv_1_1_DB_MIG_1583_1
36bd695b6d87b25d153edc91ee79992f  HAWK_3130551611_20160127_hfqsdvfv_2_1_DB_MIG_1583_2
730c32ef5415bc9dd931d026fb42bcd7  HAWK_3130551611_20160127_hgqsdvg0_1_1_DB_MIG_1584_1
36fd7d0098bd628921ac789155f0a712  HAWK_3130551611_20160127_hgqsdvg0_2_1_DB_MIG_1584_2
072f757dfb808c96aef92555f80165eb  HAWK_3130551611_20160127_hgqsdvg0_3_1_DB_MIG_1584_3
767e06a7eea3cb72243d180a5591e2a2  HAWK_3130551611_20160127_hgqsdvg0_4_1_DB_MIG_1584_4
600ef7710995dcb1d11c0b27a6ee9971  HAWK_3130551611_20160127_hgqsdvg0_5_1_DB_MIG_1584_5
28c279a24cf47fb53b1f7840b7df7fc5  HAWK_3130551611_20160127_hgqsdvg0_6_1_DB_MIG_1584_6
e418ac58da6629f6aeec9c9f7bc47ca5  HAWK_3130551611_20160127_hgqsdvg0_7_1_DB_MIG_1584_7
3e6d8788ec1b5c2071b435c10b34b746  HAWK_3130551611_20160127_hgqsdvg0_8_1_DB_MIG_1584_8
5b1c964eabcc8bd602f6cef15482820a  HAWK_3130551611_20160127_hgqsdvg0_9_1_DB_MIG_1584_9
4655bac6d066ff47799ef8dcf423f532  HAWK_3130551611_20160127_hhqsdvg6_1_1_DB_MIG_1585_1
da4add20652a16726006f46a294cf90a  HAWK_3130551611_20160127_hhqsdvg6_2_1_DB_MIG_1585_2
a2ce4073fb16336c2f8a3cf78f1709ec  HAWK_3130551611_20160127_hhqsdvg6_3_1_DB_MIG_1585_3
301ef428887aba61aa33410d6c8b3c70  HAWK_3130551611_20160127_hhqsdvg6_4_1_DB_MIG_1585_4
47379e228a839bb4257aa141dbfd5107  HAWK_3130551611_20160127_hiqsdvgm_1_1_DB_MIG_1586_1
84e2cd2931f7272832b3c4cd3923e69d  HAWK_3130551611_20160127_hiqsdvgm_2_1_DB_MIG_1586_2
33da63364865b3b959491545905fdc9f  HAWK_3130551611_20160127_hiqsdvgm_3_1_DB_MIG_1586_3
06e04d3e05aff26a197621964fcb8617  HAWK_3130551611_20160127_hiqsdvgm_4_1_DB_MIG_1586_4
5436a855b3d287f9b6ed87ba07cefeb7  HAWK_3130551611_20160127_hiqsdvgm_5_1_DB_MIG_1586_5
0bc71d9930bf2653b6c8661dbf388989  HAWK_3130551611_20160127_hjqsdvh9_1_1_DB_MIG_1587_1
fa2447d3842b476ed365ef37c74db7d9  HAWK_3130551611_20160127_hkqsdvhd_1_1_DB_MIG_1588_1
beb4c1726c99335dff262224828925f5  HAWK_3130551611_20160127_hlqsdvhf_1_1_DB_MIG_1589_1
93aede1cc96dc286ff6c7d927d9505af  HAWK_3130551611_20160127_hmqsdvhh_1_1_DB_MIG_1590_1
eb0a7eb4cab45e5c9b053abb7c736f0d  HAWK_3130551611_20160127_hnqsdvhu_1_1_AL_MIG_1591_1
77808e8a0cb4ac766e7e4d868c7c81b4  HAWK_3130551611_20160127_hoqsdvhu_1_1_AL_MIG_1592_1
5994fe2cf07786495f99d2fd9f42b1f8  HAWK_3130551611_20160127_hpqsdvi5_1_1_AL_MIG_1593_1
784be893cd558cecf65aa51ba79b3e04  HAWK_3130551611_20160127_hpqsdvi5_2_1_AL_MIG_1593_2
5859c37d98d77174675f89e7590ed597  HAWK_3130551611_20160127_hqqsdvi6_1_1_AL_MIG_1594_1
6f2a8a68ab0e9847f8f2248de55cb51a  HAWK_3130551611_20160127_hrqsdvi9_1_1_AL_MIG_1595_1
446976ee788754e8cb48fb00a0acec92  HAWK_3130551611_20160127_hsqsdvid_1_1_AL_MIG_1596_1
73a488bc5aa0664fd80237a2b8da5ea8  HAWK_3130551611_20160127_htqsdvig_1_1_AL_MIG_1597_1
c0200bb23218859fb6a1edc3f7cba94d  HAWK_3130551611_20160127_huqsdvii_1_1_AL_MIG_1598_1
802c8f1524b7c6405d4d41a3b64f0a47  HAWK_3130551611_20160127_hvqsdvil_1_1_AL_MIG_1599_1
acf0c5b5ca6a3f9b58e7880eb093330a  HAWK_3130551611_20160127_i0qsdvil_1_1_AL_MIG_1600_1
dd1746fbaf90b1d867300286e297d2b3  HAWK_3130551611_20160127_i1qsdvin_1_1_AL_MIG_1601_1
7bb58056cac524304a88ba95a6837ac8  HAWK_3130551611_20160127_i2qsdvin_1_1_AL_MIG_1602_1
81ea52aadb6767ac3d3e2ae33acc9d64  HAWK_3130551611_20160127_i3qsdvio_1_1_AL_MIG_1603_1
8481443992c6858edbc03a481e13f579  HAWK_3130551611_20160127_i4qsdvip_1_1_AL_MIG_1604_1
539716837bd98835cf9b43b83cb60b79  HAWK_3130551611_20160127_i5qsdvj0_1_1_CF_MIG_1605_1
d2715ac45c5aa1e7dcd4c706c0a542ee  HAWK_3130551611_20160127_i6qsdvj5_1_1_CF_MIG_1606_1
9532408727adfd012728f989dd9a41ad  HAWK_3130551611_20160127_i7qsdvj8_1_1_CF_MIG_1607_1
840cd94839941643ecd1cbacc568ff9c  HAWK_3130551611_20160127_i8qsdvja_1_1_CF_MIG_1608_1


oracle@arrow:hawklas:/oradata/keep
$ md5sum -c -w backup.md5
HAWK_3130551611_20160127_hfqsdvfv_1_1_DB_MIG_1583_1: OK
HAWK_3130551611_20160127_hfqsdvfv_2_1_DB_MIG_1583_2: OK
HAWK_3130551611_20160127_hgqsdvg0_1_1_DB_MIG_1584_1: OK
HAWK_3130551611_20160127_hgqsdvg0_2_1_DB_MIG_1584_2: OK
HAWK_3130551611_20160127_hgqsdvg0_3_1_DB_MIG_1584_3: OK
HAWK_3130551611_20160127_hgqsdvg0_4_1_DB_MIG_1584_4: OK
HAWK_3130551611_20160127_hgqsdvg0_5_1_DB_MIG_1584_5: OK
HAWK_3130551611_20160127_hgqsdvg0_6_1_DB_MIG_1584_6: OK
HAWK_3130551611_20160127_hgqsdvg0_7_1_DB_MIG_1584_7: OK
HAWK_3130551611_20160127_hgqsdvg0_8_1_DB_MIG_1584_8: OK
HAWK_3130551611_20160127_hgqsdvg0_9_1_DB_MIG_1584_9: OK
HAWK_3130551611_20160127_hhqsdvg6_1_1_DB_MIG_1585_1: OK
HAWK_3130551611_20160127_hhqsdvg6_2_1_DB_MIG_1585_2: OK
HAWK_3130551611_20160127_hhqsdvg6_3_1_DB_MIG_1585_3: OK
HAWK_3130551611_20160127_hhqsdvg6_4_1_DB_MIG_1585_4: OK
HAWK_3130551611_20160127_hiqsdvgm_1_1_DB_MIG_1586_1: OK
HAWK_3130551611_20160127_hiqsdvgm_2_1_DB_MIG_1586_2: OK
HAWK_3130551611_20160127_hiqsdvgm_3_1_DB_MIG_1586_3: OK
HAWK_3130551611_20160127_hiqsdvgm_4_1_DB_MIG_1586_4: OK
HAWK_3130551611_20160127_hiqsdvgm_5_1_DB_MIG_1586_5: OK
HAWK_3130551611_20160127_hjqsdvh9_1_1_DB_MIG_1587_1: OK
HAWK_3130551611_20160127_hkqsdvhd_1_1_DB_MIG_1588_1: OK
HAWK_3130551611_20160127_hlqsdvhf_1_1_DB_MIG_1589_1: OK
HAWK_3130551611_20160127_hmqsdvhh_1_1_DB_MIG_1590_1: OK
HAWK_3130551611_20160127_hnqsdvhu_1_1_AL_MIG_1591_1: OK
HAWK_3130551611_20160127_hoqsdvhu_1_1_AL_MIG_1592_1: OK
HAWK_3130551611_20160127_hpqsdvi5_1_1_AL_MIG_1593_1: OK
HAWK_3130551611_20160127_hpqsdvi5_2_1_AL_MIG_1593_2: OK
HAWK_3130551611_20160127_hqqsdvi6_1_1_AL_MIG_1594_1: OK
HAWK_3130551611_20160127_hrqsdvi9_1_1_AL_MIG_1595_1: OK
HAWK_3130551611_20160127_hsqsdvid_1_1_AL_MIG_1596_1: OK
HAWK_3130551611_20160127_htqsdvig_1_1_AL_MIG_1597_1: OK
HAWK_3130551611_20160127_huqsdvii_1_1_AL_MIG_1598_1: OK
HAWK_3130551611_20160127_hvqsdvil_1_1_AL_MIG_1599_1: OK
HAWK_3130551611_20160127_i0qsdvil_1_1_AL_MIG_1600_1: OK
HAWK_3130551611_20160127_i1qsdvin_1_1_AL_MIG_1601_1: OK
HAWK_3130551611_20160127_i2qsdvin_1_1_AL_MIG_1602_1: OK
HAWK_3130551611_20160127_i3qsdvio_1_1_AL_MIG_1603_1: OK
HAWK_3130551611_20160127_i4qsdvip_1_1_AL_MIG_1604_1: OK
HAWK_3130551611_20160127_i5qsdvj0_1_1_CF_MIG_1605_1: OK
HAWK_3130551611_20160127_i6qsdvj5_1_1_CF_MIG_1606_1: OK
HAWK_3130551611_20160127_i7qsdvj8_1_1_CF_MIG_1607_1: OK
HAWK_3130551611_20160127_i8qsdvja_1_1_CF_MIG_1608_1: OK

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5

oracle@arrow:hawklas:/oradata/keep
$ vi backup.md5  -- create false error by modifying checksum.

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5
HAWK_3130551611_20160127_hfqsdvfv_1_1_DB_MIG_1583_1: FAILED
md5sum: WARNING: 1 of 43 computed checksums did NOT match
oracle@arrow:hawklas:/oradata/keep
$
oracle@arrow:hawklas:/oradata/keep
$ ls *MIG*|wc -l
43

oracle@arrow:hawklas:/oradata/keep
$ split -l 10 backup.md5 backup.md5 -- split file to contain 10 checksums per file.

oracle@arrow:hawklas:/oradata/keep
$ ll ba*
-rw-r--r--. 1 oracle oinstall 3698 Jan 27 12:52 backup.md5
-rw-r--r--. 1 oracle oinstall  860 Jan 27 12:56 backup.md5aa
-rw-r--r--. 1 oracle oinstall  860 Jan 27 12:56 backup.md5ab
-rw-r--r--. 1 oracle oinstall  860 Jan 27 12:56 backup.md5ac
-rw-r--r--. 1 oracle oinstall  860 Jan 27 12:56 backup.md5ad
-rw-r--r--. 1 oracle oinstall  258 Jan 27 12:56 backup.md5ae

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5aa
HAWK_3130551611_20160127_hfqsdvfv_1_1_DB_MIG_1583_1: FAILED
md5sum: WARNING: 1 of 10 computed checksums did NOT match

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5ab

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5ac

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5ad

oracle@arrow:hawklas:/oradata/keep
$ md5sum -c --quiet backup.md5ae
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: