Thread: It's that time

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195

    It's that time

    Had to reformat and reinstall windows today, took most of the day to install all the updates. And it inspired me to write a bootable disk that will fully restore my hard drive to its current condition. Currently my drive takes up just over 7 GB of space, so I think I can easily fit the whole restore program on a single bootable DVD.

  2. #2
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    Norton Ghost could create a restore DVD for you.

    Maybe even Nero.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I used the Microsoft backup that came with Vista... I'll never make that mistake again. Sure it backs up, but does it restore? No. After my drive died, it tooks me weeks to extract my files from the MS backup image (which is also a MS Virtual PC image) by hand.

    I bought a copy of Norton Ghost and tested both the backup and restore, and I feel very secure now.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Or boot into a Linux Live-CD
    Code:
    dd if=/dev/sda1 of=backup.image
    And to restore
    Code:
    dd if=backup.image of=/dev/sda1
    Gets a bit more complex if you want to compress it, though.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by abachler View Post
    Had to reformat and reinstall windows today, took most of the day to install all the updates. And it inspired me to write a bootable disk that will fully restore my hard drive to its current condition. Currently my drive takes up just over 7 GB of space, so I think I can easily fit the whole restore program on a single bootable DVD.
    So, you put the Windows 7 beta on it right?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cpjust View Post
    I bought a copy of Norton Ghost and tested both the backup and restore, and I feel very secure now.
    But do you keep your backups in the same building as the system you're backing up?

    I know a guy who made meticulous backups of a PC he kept out in his barn. He also kept the tapes and other backup media in the same room. Then the whole barn burned down. D'oh.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by brewbuck
    But do you keep your backups in the same building as the system you're backing up?
    Heh, I recall this quote, attributed to Linus Torvalds, that says something like "real men don't make backups - they upload it via FTP and let the world mirror it". Mailing your backup DVDs to relatives or friends overseas is probably overkill, and you probably would need to encrypt the backup unless you want your "sensitive data" to be leaked.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by laserlight View Post
    Heh, I recall this quote, attributed to Linus Torvalds, that says something like "real men don't make backups - they upload it via FTP and let the world mirror it". Mailing your backup DVDs to relatives or friends overseas is probably overkill, and you probably would need to encrypt the backup unless you want your "sensitive data" to be leaked.
    I store my most important backups in triplicate -- one copy at my house, one copy at someone else's house (usually a parent or friend), one copy in a safety deposit box at the bank. Seriously. Stuff like my wedding photographs, backups of my source code library, my master password list...

    (EDIT: If some event actually eliminated all three of these backups... Well, the only thing I can imagine that could do that would be a nuclear explosion, in which case I'd probably be dead anyway, or at least I'd have much worse things to worry about)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Well, it appears the hard drive is in teh early stages of failure. When I run the following code, it does great up to about 512MB, then it slows to a crawl and pauses after every 3-8 writes.

    Code:
    #include <windows.h>
    #include <stdio.h>
    BYTE Info[65536];
    int main(){
     
     DWORD BytesWritten = 1;
     for(int x = 0;x<65536;x++) Info[x] = 0;
     DWORD Sector = 0;
     DWORD SectorsWritten = 0;
     DWORD BytesRead = 512;
     DWORD ByteCount = 0;
     DWORD Start = 0;
     HANDLE hFileTemp = CreateFile("C:\\temp.temp" , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL);
     while(BytesWritten){
      Start = GetTickCount();
      WriteFile(hFileTemp , (LPVOID)Info , 65536 , &BytesWritten , NULL);
      Sector += BytesWritten / 1024;
      printf("%d\n" , Sector); // actually reports kilobytes written so far
      if(GetTickCount() - Start > 55){
       printf("Pausing...(%d ms)\n" , GetTickCount() - Start );
       Sleep(1000);
       }
      }
     CloseHandle(hFileTemp);
     Sector = 0;
     return 0;
     
     
     HANDLE hFile = CreateFile("\\\\.\\C:" , GENERIC_READ , FILE_SHARE_READ , NULL , OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL , NULL);
     HANDLE hFileOut = CreateFile("D:\\HardDrive.bin" , GENERIC_WRITE , FILE_SHARE_WRITE , NULL , CREATE_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL);
     BytesRead = 1;
     while(BytesRead){
      ReadFile(hFile , (LPVOID)Info , 512 , &BytesRead , NULL);
      if(BytesRead){
       ByteCount = 0;
       for(int x = 0;x<512;x++) ByteCount += Info[x];
       if(ByteCount){
        SectorsWritten++;
        printf("Sectors - %d\n" , SectorsWritten);
        //WriteFile(hFileOut , (LPVOID)&Sector , sizeof(DWORD) , &ByteCount , NULL);
        //WriteFile(hFileOut , (LPVOID)Info , 512 , &ByteCount , NULL);
        }
       }
      Sector++;
      }
     CloseHandle(hFileOut);
     CloseHandle(hFile);
     return 0;
     }

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Maybe. Maybe not. Faults can appear without the hard drive beginning to fail.
    Checking the SMART status and surface scans should keep one safe.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    performance on the drive has degraded to the point where its obvious there is somethign wrong. A properly functioning drive wouldnt take 40 minutes to write 1GB of data. Maybe if it was made in the 80's, but not a modern drive. Not this drive, which normally performs at 3.0 Gb/s per second. There is obviously something wrong. Even after disabling write caching, thinking per haps the 512MB was the maximum cached write size, it still bahaves like that, the first 512MB goes through very fast, then it bogs down to nothing, always at the same spot too, so there are obviously errors that chkdsk isnt finding.

  12. #12
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by abachler View Post
    Not this drive, which normally performs at 3.0 Gb/s per second.
    I don't think there are any drives in existence that can read/write that fast. That's just the max theoretical transfer speed for the SATA interface, not the actual drive itself.

    Run HD Tune to check the performance along the entire disk as well as doing a surface scan & checking the SMART log.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  13. #13
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    even so, this drive is exhibiting write speeds measured in kilobytes per second.I coudl see if it were running slower than normal by 50% even, but this is rediculous.

    and HD Tune only tests read performance, not write performance unles I delete all partitions, in which case I cant run the program because theres no drive to boot from...

    even the read speed is beign reported at 3 MB/s, which is increadibly slow.
    Last edited by abachler; 03-14-2009 at 02:44 PM.

  14. #14
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by abachler View Post
    even so, this drive is exhibiting write speeds measured in kilobytes per second.
    Sounds like it's ECC'ing like crazy due to media being totally screwed. I suppose you could have a problem on the controller board, too...

    EDIT: I still think you should throw Win7 on there
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  15. #15
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Try a difference HD and that should narrow it down to the HD being the problem. By the sounds of it, I'm pretty sure it is a drive problem.
    Then check if it's still under warranty and get a new drive.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get current time
    By tsubasa in forum C Programming
    Replies: 3
    Last Post: 05-01-2009, 02:03 AM
  2. Replies: 11
    Last Post: 03-29-2009, 12:27 PM
  3. Help with assignment!
    By RVDFan85 in forum C++ Programming
    Replies: 12
    Last Post: 12-03-2006, 12:46 AM
  4. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM