Shrinking EBS Volume

It took me a while to shrink my EBS volume, but this post helped quite a lot.
For further reference, this are the exact steps i’ve performed:

  1. Created a snapshot of the EBS volume, for backup reasons.
  2. Added a new volume, based on the snapshot.
  3. Added another volume with the desired size.
  4. Attached both, the Normal and Shrunken volumes.
  5. Check the big volume, and resize it:
    e2fsck -f /dev/bigvolume
    resize2fs -M -p /dev/bigvolume
  6. Note that ‘resize2fs’ will say something like:
    Resizing the filesystem on /dev/xvdg to 1035624 (4k) blocks.
  7. Let’s calculate how many 16MB blocks we’ll need:
    x = 1035624 * 4 / 1024 / 16 = 253
  8. Proceed copy’ing blocks to the small volume:
    dd bs=16M if=/dev/bigvolume of=/dev/smallvolume count=253
  9. Resize + Check the small volume:
    resize2fs -p /dev/smallvolume
    e2fsck -f /dev/smallvolume
  10. Stop the instance.
  11. Detach the 3 volumes: Root, Big and Small.
  12. Attach the Small volume at the same location as the previous root volume was. In my case, /dev/sda1.
  13. Ready!

Nuke GIT Repository History

Suppose you’ve just commited a private API key that should not be public. Or maybe you just wanna restart your repository, because you’ve just finished major surgery and wanna start fresh.

If you’d like to delete all GIT history, you’d need to:

1. Remove all history

rm -rf .git

2. Reconstruct the Git repo with only the current content

git init
git add .
git commit -m "Initial commit"

3. Push to GitHub.

git remote add origin <github-uri>
git push -u --force origin master

Source here.

Fixing ‘”A newer version of this app is already installed on this computer” Alert

I’ve just got a nice alert, while trying to install a Mac App from the AppStore, saying the following:

"A newer version of this app is already installed on this computer."


  1. Nuke the app’s Xcode build folder.
    Location: ~/Library/Developer/Xcode/DerivedData/
  2. Execute the following command:
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Now you should be good to go!