Drive Snapshot

Discussion in 'backup, imaging & disk mgmt' started by Hadron, Nov 11, 2019.

  1. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    This line...

    Code:
    if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF
    ... makes the command window run minimized. It's on the taskbar if you want to see it.

    If you don't want it to run minimized, use this...

    Code:
    ::if not defined RunTask set RunTask=1 & start "Snapshot" /min %SystemRoot%\system32\cmd.exe /c "%0" & goto :EOF
     
  2. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    The latest diff script produces files such as...
    H-diff-182934

    My earlier script with the custom date format produced...
    H-diff-2020-Jul-14_182719

    The first file is fine (latest script).
     
  3. paulderdash

    paulderdash Registered Member

    Joined:
    Dec 27, 2013
    Posts:
    4,644
    Location:
    Under a bushel ...
    Thanks Brian for your efforts here!

    I will give DS, and the scripts, as soon as I get a gap.

    Wrt the (new) files like H-diff-182934, the creation date will still be visible in file properties or whatever?
     
    Last edited: Jul 14, 2020
  4. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Sure. You don't need date or time in the filename. It was a way of creating a unique name so the next run of the script didn't delete the previous diff.

    I could have created diff1, diff2, diff3, etc. But I don't know how to do that. And you can't rename the diff after it has been created. DS doesn't like that and won't restore the image.
     
  5. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Date format...

    https://en.wikipedia.org/wiki/Date_format_by_country
     
  6. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    If you are running the script from a Scheduled Task there is a good chance your timestamp could be the same as a previous timestamp. The previous .sna backup will be over-written. I suggest date is included in the filename as a precaution.

    Code:
    set hh=%time:~0,2%
    if "%time:~0,1%"==" " set hh=0%hh:~1,1%
    set timestamp=%time:~0,8%
    if @%timestamp:~0,1% == @ set timestamp=0%timestamp:~1,7%
    set timestamp=%date:.=%_%timestamp::=%
    echo.Timestamp :: %timestamp%
    For this, use the ISO 8601 date format.
     
  7. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    You can use any format that doesn't use /

    Using - is fine.
     
  8. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    No, mine's working very well, Brian.
     
    Last edited: Jul 15, 2020
  9. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Hadron, if you are still using / format, change your line to this...

    snapshot64.exe HD1:* "%DSpath%\Entire-1\$disk-diff-%timestamp%-%random%.sna" -h"%DSpath%\Entire-1\$disk.hsh" -R -L0 --UseVSS -W

    It adds a random number to the image filename. That makes it pretty safe from having the same filename in a Scheduled Task situation.

    Edit... You know what to do if your line doesn't have %DSpath%
     
  10. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    I am not sure what you are suggesting with your edit above, Brian.

    I am using this at present.
    Code:
    snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\$disk.sna" -L0 --UseVSS -W
    Code:
    Snapshot V1.48 - Jun 10 2020 - Copyright 2001-2019 by www.drivesnapshot.de
    
    [backup a volume]
      Snapshot C: X:\C-DRIVE.sna
             -A    - save ALL sectors, ignore free cluster info (maintenance)
             -L650 - Limit resulting imagesize to 650MB (CDROM size)
             -T    - Test generated image file (verify correct checksums)
             -W    - suppress <Hit any key> if started from scheduler
             -R    - Empty Recycle Bin for this drive before Backup
             -G    - Graphical status display for command line mode
             -PW=MyPassword    (also used for restore and viewing)
             -PWGEN=KeyFile.txt -PW=MyPassword    - generate a key file from password
             -PWUSE=KeyFile.txt                   - use KeyFile.txt to encrypt the image
             -C="My comment" add a comment to the image
             -o[path][filename]  generate hash file with name "path\filename"
             -o    - don't generate hash file
             -h<HashFile> make a differential image
    
    [backup multiple volumes and drives without drive letters]
      Snapshot C:+D:+HD1:3 X:\$disk-DRIVE.sna
              HD1:3 is the third partition on the first disk
              HD1:* can be used to backup all partitions on the first disk
    
    
    
    Options for command line substitutions
    Possible values for substitution are:
             $disk  is substituted with the drive letter
               $hd  is substituted with HdX-Y
             $date  results in 050131 which represents January 31 2005
     $computername  is substituted with the computername
             $type  results in "dif" or "ful" for differential or full image
          $weekday  is substituted with the first two characters of the Weekday
             $week  is substituted with the calendar week (2digits)
             $year  is substituted with the year (4 digits)
            $month  is substituted with the month (2 digits)
              $day  is substituted with the day of the month (2 digits)
             $hour  is substituted with the hour
           $minute  is substituted with the minute
           $second  is substituted with the second
           $label=  is substituted with the volume with label=Name
    
    [restore a volume]
      Snapshot X:\C-DRIVE.sna C:
             -Y    - Answers all questions automatically with "Yes"
    
    [view a saved file]
      Snapshot X:\C.sna Z: -V
           explores X:\C.sna as virtual drive Z: (-VM for mount only)
           (-VQ for mount only and wait for event. Use --unmount to terminate)
    
    [generate a new hash file from a full image]
      Snapshot X:\C.sna -h<HashFileName>
    
    [info about a file]  Snapshot X:\C-DRIVE.sna    -I
    [partition info   ]  Snapshot X:\C-DRIVE.sna    -P
    [validate  file   ]  Snapshot X:\C-DRIVE.sna    -T
    
     
    Last edited: Jul 15, 2020
  11. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Hadron,

    A potential problem is with images made from Scheduled Tasks. Let's say your Task is set for 7 am. the backup image filename could be...

    H-diff-070000.sna

    When the Task runs at 7 am the next day, the backup image filename could be identical and the first backup image will be deleted. If you add a random number to the backup image filename, this makes identical filenames very unlikely.

    A backup image filename like this...

    H-diff-070000-19235.sna

    Your full script would be the same but your diff would be...

    Code:
    snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\Entire-1\$disk-diff-%timestamp%-%random%.sna" -h"D:\System_Backup\Drive_Snapshot\Entire-1\$disk.hsh" -L0 --UseVSS -W
     
  12. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    OK.
    I gave you the wrong script. I should have shown you the diff.
    My current diff is this. I'll change it to that. Will the current fulls and diffs still be OK, or do I need to delete them?
    Code:
    snapshot64.exe HD1:* "D:\System_Backup\Drive_Snapshot\Entire-1\$disk-diff-%timestamp%.sna" -h"D:\System_Backup\Drive_Snapshot\Entire-1\$disk.hsh" -L0 --UseVSS -W
    I see you've added %random%.
    I didn't know about that one.

    Edit:
    DS Differential Entire-1.jpg
     
    Last edited: Jul 15, 2020
  13. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Your current full and diffs are fine. Just keep going with the new diff script. You can use both diff scripts for the same Entire-1 folder. Mixed diffs are fine.
    I see you are doing that. Great.

    When you create your next diff the random number will be different.
     
  14. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    It's interesting how it comes up with a random number.
    I wonder if it is always 4 digit.
     
  15. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    0 to 32767

    2^15 numbers.
     
  16. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    Oh, yeah.
    I got a 5 digit number this time.
     
  17. EASTER

    EASTER Registered Member

    Joined:
    Jul 28, 2007
    Posts:
    11,126
    Location:
    U.S.A. (South)
    :thumb:
     
  18. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    I found a good site. SS64.com
     
  19. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    I've done numerous backups and a few restores. All have been successful.
    All restores have been run from TBLauncher outside of Windows.

    But I have been testing restores from within Windows and I get two different results depending whether I select.
    Restore Complete Disk From Images
    or
    Restore Disk From File

    Here are the screens that I am presented with.

    Restore Complete Disk From Images
    DS - Restore Complete Disk From Images.jpg

    Restore Disk From File
    DS - Restore Disk From File.png

    I am just wondering why when I select Restore Complete Disk From Images, I am not offered to reboot.
    Both options are attempting to restore the system disk C: . The only difference is one is all partitions and one only one partition.

    As you can see with Restore Disk From File, I am presented with the message that restoring the system disk C: is impossible with the operating system running and offers to schedule a restore at next reboot.
    But Restore Complete Disk From Images doesn't give me that option. It gives me the message that restoring a complete disk to the current system disk is not supported.
     
  20. Krabbath

    Krabbath Registered Member

    Joined:
    Jun 24, 2020
    Posts:
    49
    Location:
    Earth
    Did you back up all partitions at the same time with a Snapshot version 1.45 or later? Only then can a complete disk be restored with this method.

    Source (I did not find an English translation for this page).
     
  21. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Krabbath,

    http://www.drivesnapshot.de/en/rest1.htm

    This is a partition restore and not a Complete Disk restore.
    For Drive, read partition. For Disk, read Complete Disk.

    Hadron, it looks like we need to accept that boot media is needed for a Complete Disk restore.
     
  22. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    It's a Restore Disk From File which translates to a partition.
    The language could be more informative, but I realise that it's German software. Great software.
     
  23. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    Thanks for the confirmation, Brian.
     
  24. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,175
    Location:
    NSW, Australia
    Hadron, you can restore a Complete Disk from Windows without requiring a reboot, as long as the disk doesn't contain the booted OS. But if the disk contains the booted OS you need boot media.
     
  25. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    2,145
    Yes, Brian.
    I knew that would be the case that it would need to be rebooted if the restoration contains the OS in use.
    But the point I was making is the Restore Disk From File option can have the OS in use and offer to schedule a restore at next reboot, but Restore Complete Disk From Images option doesn't.
    Also, as I said earlier, I think the options could be better worded as Restore Disk From File is still restoring an image, but only a single partition.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.