FOG Checksum



  • Hi all,

    is there a way i can check via a checksum if the image was copied correctly on a client?


  • Moderator

    @Marc2 Probably yes and no… and it depends on when you do the checksum…

    If you are using FOG’s early hostname change, then a simple changing of the name on the OS disk would totally change the checksum. Booting the computers before the comparison is likely to totally change the checksum. The checksum must be done before namechange and before boot.

    This means you’d have to either schedule a shutdown after imaging and then boot to a linux live CD and do the checksum test, or, do a debug deployment and cancel the process right at the early host name change point and manually do the checksum during debug (which has very limited commands and you’d probably need to install some utilities right then and there) and then proceed to manually finish the imaging process via command line.

    I found this post on another site:


    But it depends on the layer you define “same”

    For this answer I assume

    • /dev/sdb1 and /dev/sdc1 are the ones you want to compare
    • both partitions are not mounted
    • if they are mounted, you have the permission to read each file

    You can test the two partitions on blocklevel.
    ie:
    Code:

    md5sum /dev/sdb1
    md5sum /dev/sdc1
    

    But for this to produce the same hash, the partitons have to be exactly the same.
    Even the slightest change in one of the files in either of the two,
    will produce a different hash.

    You can also test on filelevel.
    There are probably already tools, that could be used for your purposes (tripwire maybe?),
    but a quick-and-dirty solution can be this:
    Code:

    mkdir ~/comparedir
    sudo mkdir /mnt/test_sdb1
    sudo mkdir /mnt/test_sdc1
    
    sudo mount -o ro /dev/sdb1 /mnt/test_sdb1
    sudo mount -o ro /dev/sdc1 /mnt/test_sdc1
    
    find -type f /mnt/test_sdb1 -exec md5sum {} 2>/dev/null \; >~/comparedir/tmp_sdb1_hashes
    find -type f /mnt/test_sdc1 -exec md5sum {} 2>/dev/null \; >~/comparedir/tmp_sdc1_hashes
    
    sudo umount /mnt/test_sdb1
    sudo umount /mnt/test_sdc1
    sudo rm -r /mnt/test_sdb1
    sudo rm -r /mnt/test_sdb1
    
    sort -k2 ~/comparedir/tmp_sdb1_hashes > ~/comparedir/sdb1_hashes
    sort -k2 ~/comparedir/tmp_sdc1_hashes > ~/comparedir/sdc1_hashes
    rm ~/comparedir/tmp_sdb1_hashes ~/comparedir/tmp_sdc1_hashes 
    
    diff ~/comparedir/sdb1_hashes ~/comparedir/sdc1_hashes
    

    Source: http://www.linuxforums.org/forum/miscellaneous/158910-can-i-compare-two-partitions.html


Log in to reply
 

397
Online

38937
Users

10696
Topics

101490
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.