Thursday, October 26, 2017

Downloading or Backing up an Image or Drive from AWS

So we have an  EC2 instance on AWS.  But we need to terminate it as the project has to give way to something urgent and therefore not on foreseeable future will it be used. So instead of accruing cost, (as an image cost something if its in AWS although it is not being used), we decided to download the image or drive directly on our drive and store it.

This is what we did.


  1. Create a snapshot of the existing image you want to download in AWS. 
  2. From that snapshot, create an image.
  3. Once the image is available, add that image as part of the EC2 Instance you wish to download.
  4. Create another image. Make sure this is bigger than the image that you want to backup. Basically this will hold the image backup
  5. Mount it as part of the EC2 Instance.


For this, this is what I have :




here,

  • /dev/sda1 is the source or what I will backup
  • /dev/sdf is a copy of /dev/sda1
  • /dev/sdg will contain the backup.

To get the available mountpoints that can be mounted :

execute :



As you can see..  /dev/sdf  (which is xvdf) is mounted as :



For /dev/sdg, the mountpoint is xvdg.


Since this is a new image, do the following commands :




Then mount  (make sure that the folder /mnt/image is available)\:




Afterwards, create an image :





Once created, go to /mnt/image and do a tar/gz. This is to compress it.





After which, you can now do an SCP to the machine and download the file.


Friday, September 29, 2017

Disk Management Error 0 during update of Mac OS High Sierra

When updating MacOS High Sierra, you may experience this issue, where a couple of hours, you will be presented with an error Disk Management Error 0.

This was what I did :

  1. Make sure you are connected to wifi or network.
  2. I restarted in Internet Recovery Mode by holding down Command+Option+R. On windows keyboard this is Windows Key+Alt+R
  3. This will take sometime so wait for it
  4. Once done it will take you back to normal recovery mode.
  5. Run First aid on the disk you want to install to.
  6. Click on your Main Disk where you want to install High Sierra then convert it to APFS (Edit -> Convert to APFS)
  7. Once converted, click on Reinstall MacOS.  It will prompt you to install High Sierra. Then proceed to install MacOS High Sierra.

All my files and applications are still there. And it worked. Well, do make sure you have a backup before attempting to install High Sierra.

Tuesday, September 26, 2017

Debugging crashed applications on .NET

My current work nowadays involves a lot of multi-threading application. And also a lot of simultaneous users. We need to serve them fast (as in milliseconds fast), that's why some of our apps and services uses threads to provide the data very fast and also do most of the things in parallel.

We had issues before where an application keeps on dying without any logs. This would be because of the threads dying even if we have exception handling. We can't seem to understand and the only clue we have is the event viewer saying something died.

So I kept on searching a solution and found it here : http://blog.functionalfun.net/2013/05/how-to-debug-silent-crashes-in-net.html. This is applicable from windows vista and up.


Just to recap what it says in this linked, we followed the procedure as shown below :

1. Create a key at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\[Your Application Exe Name]. In that key, create a string value called DumpFolder, and set it to the folder where you want dumps to be written. Then create a DWORD value called DumpType with a value of 2. Example shown below :

image



2. Once done, and your app crashes, it will create a *.dmp file onto the folder you specified. Get that file and open it on your visual studio. I find that you need to put the DMP file onto the folder where your application, DLL and PDB files are located.

3. You will see the screen below. Click on the Debug with Mixed and it will go to the line where the offending application stopped. Voila!, you know now which portion of the app made your application crash.

image