Thursday, June 28, 2018

נו, יש לך גיבוי?

Don't worry, I got your back(up)


נעלמתי לזמן מה, בשל מגוון סיבות. אחת מהן הייתה שהכנתי את ההרצאה שלי לCAST, והעברתי אותה במיטאפ של TestIL, לי היה כיף, ואני מקווה שגם לקהל. 
סיבה אחרת בגללה נעלמתי היא שקרס לי המחשב. כך, בבוקר שישי אחד, אני מדליק מחשב שעד אתמול היה בסדר גמור (קצת יותר גמור מבסדר, אבל פעל באופן סביר) ולפתע אני מקבל הודעה שאי אפשר למצוא מערכת הפעלה. טוב נו, מתארגנים על תקליטור של אובונטו ומפעילים את המחשב בכל זאת כדי לראות אילו קבצים אפשר להציל. התשובה הקצרה - אי אפשר. משהו בכונן הקשיח נהרס והמחשב אפילו לא מזהה אותו. 
עכשיו, תרגיל קצר לקוראים:
עצמו את העיניים ונסו לדמיין אתכם במצב דומה, המחשב הראשי שלכם התקלקל\נגנב\הוצפן. עדיין יש לכם גישה לכל המידע המגובה שנמצא בעוד מקום נוסף על המחשב. מה אבד לבלי שוב? מה חשוב לכם לשחזר ואי אפשר? מה סתם ייקח המון זמן לשחזר?
עדיין לא עצמתם עיניים? עכשיו זה זמן טוב. 
...
אני מנחש שכנראה הצלחתם למצוא דבר או שניים, אבל סביר להניח שכמעט כל מה שיגרום לכם לכאב ראש כבר מגובה איפשהו - בענן או על כונן חיצוני. זה גם היה המצב אצלי, חוץ מאשר מצגת שהתחלתי לעבוד עליה אבל לא שמרתי עדיין בגוגלדרייב, יש לי גיבוי לכל מה שהצלחתי לחשוב עליו - תמונות מטיולים ומוזיקה שהעברתי מדיסקים ישנים למחשב (וגם כזו שהגיעה למחשב שלי בימי נאפסטר וקאזה, אבל אל תספרו לאף אחד) נמצאים על כונן חיצוני (שניים, למעשה), כמעט כל המסמכים שחשובים לי נמצאים בדוא"ל ואת התוכנות שמותקנות אפשר להוריד שוב. גם רוב הסימניות שלי בדפדפן, שמורות בגוגל בטעות, אחרי שחיברתי פעם את החשבון לכרום ודברים סונכרנו לפני שהספקתי לומר ג'ק רובינזון.גם המשחקים שקניתי היו דרך Steam או אחת החנויות האלה והמידע שלי שמור בענן, עד כדי משחקים שמורים שאולי נשמרים מקומית בלבד.  סך הכל, אחלה, לא?
בכל זאת, היה לי קצת חבל על שלוש השעות שאצטרך כדי לבנות מחדש את המצגת, ועל אבדנו של קובץ אקסל בו אני עוקב אחרי צריכת הדלק של הרכב שלי. לא סוף העולם, אבל סתם מציק. חוץ מזה, יש פה אתגר - כונן קשיח נגיש לחלוטין, אבל לא מזוהה ע"י מערכת ההפעלה. לא יכול להיות שמידע נעלם סתם ככה, נכון? מה שכנראה קרה הוא שהסקטור הראשון נדפק, ואז מערכת ההפעלה לא יודעת אילו ביטים הם חלק מקובץ ואילו אינם.
אז הורדתי תוכנה בשם testDisk, שנועדה לשחזור מחיצות ומסתבר שהיא יודעת גם לשחזר קבצים אבודים, עד רמה מסויימת, ולפתע - כל הכונן שלי נגיש שוב. פתאום גיליתי מה עוד לא בדיוק מגובה:
  • האם אתם זוכרים אילו תוכנות מותקנות לכם על המחשב? הגעתי לשלושים וארבע תוכנות שרציתי להתקין מחדש, לא כולל תוספים לnotepad++ או לכרום. סיור בתיקיות program files עזר לי למצוא את מה שאני רוצה להתקין באופן אקטיבי.
  • %APPDATA% - ועם אנשי הלינוקס הסליחה. לכל מיני אפליקציות מותקנות יש מידע שנשמר תוך כדי עבודה, ומכיל את מה שחשוב לכם באמת. למשל, נזכרתי שמותקן לי על המחשב לוח שנה עברי, יחד עם תאריכי ימי ההולדת של כמה חברים קרובים. אני לא זוכר את תאריך הלידה העברי של רובם, והיה מאוד נוח כשיכולתי למשוך את הקבצים הרלוונטיים מתוך ההיסטוריה. אותו הדבר היה נכון למסד הנתונים של ditto, בו אני שומר כל מיני דברים שחוסכים לי זמן. 
  • דברים שהשארתי על שולחן העבודה - למשל, יש לי תיקייה עם צילומים של שירים, כאלה שגזרתי מעיתון, או צילמתי מאחד מספרי השירה שלי. אני כנראה יכול לשחזר את הרוב, אבל לכו תזכרו מה היה שם. עד שלא ראיתי את זה, לא זכרתי שזה שם.
  • סיכומים מהאוניברסיטה  ושאר מסמכים מmy documents - לא שמשהו משם בער לי, אבל יוצא לי בערך פעם בחצי שנה להיזכר במשהו שאמור להיות בסיכומים שם ולחטט בו. 
  • תיקיות נוספות תחת כונן C - מדי פעם יש דברים שצריך לבחור להם מקום. למשל, כל מיני ספרים בפורמט PDF שקניתי או קיבלתי. די בטוח שהרוב שם מגובה, אבל אולי משהו הוחמץ. 
בקיצור - מגוון הפתעות נחמדות חיכו לי כשהתחלתי לחטט בכונן ההרוס, ואני בהחלט שמח שהצלחתי לשחזר ממנו את רוב המידע (לא מצאתי מה עוד חסר לי, אבל אני מניח שפספסתי דבר או שניים). 
עכשיו לתרגיל השני: טיילו בחמשת המקומות שהזכרתי והשוו את הרשימה של דברים שתרצו לומר "את זה אני מעביר למחשב הבא" לרשימה שבניתם בעיניים עצומות קודם - עד כמה הרשימה הזו ארוכה יותר?

חוץ מזה, האם מישהו מכיר דרך נוחה לסנכרן תיקיות לגיבוי? אני לא רוצה לשמור את הכל בdropbox, אבל הייתי שמח להגדיר תהליך שירוץ באופן שבועי ויגבה את כל הדברים הקטנים האלה שאני לא רוצה לטפל בגיבוי שלהם בעצמי. 





I've been away for a while - for many reasons. One of which is that I was busy preparing a talk for CAST, and practicing it in a local meetup. I had a lot of fun, and I hope the audience enjoyed it as well. 
Another reason, which is also the reason for this blog post, is that my PC died. Or rather, my hard drive did: One day my computer works (sort of) fine, then the next I switch it on, just to get a nice message that it cannot find an operating system. Oh well, I created an Ubuntu disk and managed to get the computer past the problematic point, just to see that the hard drive is not recognized. Something there is messed up. 
Now, a short exercise for the readers: Close your eyes and imagine your main computer crashes in a similar way, or gets stolen or encrypted by a ransomware. Your backups and online data are intact. How much data have you lost? 
Eyes still open? You can close them now.
...
My guess is that your answer would be "not very much" - I imagine that while you managed to find an item or two, most of the data that you expect to be missing in such a case is probably backed up either on the nebulous "cloud" or on a physical external drive (sometimes connected to a secondary computer). 
For me, the case was very similar: I had a presentation I worked on for a small number of hours and  did not yet save to my google drive, but apart from that, I had almost everything backed up: music that I ripped from discs purchased ages ago and probably lost by now (some of them might still be buried in a drawer at my parents house), pictures I took at various trips. Most of the important documents can be found in my gmail, my games are in Steam\Origins and their save data too (or, if it isn't, it's not important for me), the software I had installed can be downloaded again and even most of my bookmarks are stored in Google servers after I once signed in to Chrome and before I could say Jack Robinson my bookmarks were synced (up until the point where I disabled that and logged out). All in all - not that bad, right?
Well, I I decided to not give up, and downloaded a piece of software called testDisk and maybe save myself the need to reconstruct the slides. Surprisingly, it worked. I then found that there were some other stuff I really didn't want to lose, but have not thought about. 
  • Do you remember all of the programs that are installed on your computer? After brosing through the folder structure with special care for "program files" folders I could list about 34 programs I wanted to install again (not including plugins for notepad++ or chrome).
  • %APPDATA% (and the Linux people will have to find the equivalent on their own) - Some programs are valuable not because of the functionality they have, but rather because of the data stored in them, I had a Hebrew calendar where some friends Hebrew birthdays were stored, and some of them I did not remember. I managed to get this back by restoring the relevant files from %APPDATA%. Same goes for chrome bookmarks, or ditto's database (where I keep some copied strings as a shortcut).
  • Speaking of that calendar, I encountered another problem - downloading it again was a bit challenging, as the official site is "under construction" for at least a couple of years (according to the wayback machine). Installation files are not what I would normally bother to backup. 
  • Stuff I left on the desktop - A plethora of tiny things that are nice to have handy - I have a folder with poems I took out of some of the poetry books I have, or received by mail, or found online - it is backed up, but I'm not certain how up to date is the backup. 
  • "My documents" - while most of the documents there can be forgotten, some of them are in the category of stuff I remember once in a blue moon and recall that I want to share some of it, or read again. My University notes are such thing, and some documents with sentimental value to me. 
  • Other folders directly under C:\  - I found there a folder with PDFs I bought or received over the years (most of them are RPG books, probably from a kickstarter). 
Now, for the 2nd part of the exercise - Go over those folders on your computer and think - "what would I like to keep and wasn't in my list?"

And now to the question I have for you - Do you know a tool that allows syncing a folder to my preferred backup? Updating backups manually is not a real option, and I would rather be able to click something and have all of those small things backed up for me.  I think I'll give cwRsync a chance.