Recovering Windows Bootloader

Recovering Windows Bootloader

Every now and then, after much searching, we come upon life-saving articles. I’m just trying to make them easier to find.

This article, especially the third part of it, tells how to create the masterbootrecord from scratch with the help of a terminal. Hopefully not many people should need to access this, but for those who might, it’s a life-saver.

Advertisements

Auto Mount Drive/Partition on start up (Ubuntu)

For those of you who want simply a GUI for this, we have the psydm storage manager in the Ubuntu Software Center.

However, I personally don’t like the work it does. It has been erratic for me. So here’s a very simple method to manually auto-mount drives on startup.

Please note, that the drives are mounted as a root user which implies they can’t be unmounted by the normal user. But they are otherwise accessible.

It is better practice to mount drives using UUID. This is because UUID for every disk is unique, and is a pre-existing identification. The other common method, /dev/diskname, is the name given by the operating system.

Make sure your drive is unmounted.

Open Terminal

sudo mkdir /media/<mydiskname>
sudo blkid

Copy the UUID of the disk you want to mount.
open fstab file in  an editor of your choice. I will use vi.

sudo vi /etc/fstab

We see the following columns :
file system : can be specified with UUID or /dev/
mount point : the point the disk should be mounted at. In this case, /media/<mydiskname>
type : Type of file system – ntfs, ext4, ext2, fat
options : you can either go for defaults, or if you want to know more about them, then look here
dump : Usually value 0
pass : Usually value 0 but you can read more here

Add the following entry:

UUID=<previously-copied-uuid> /media/<mydiskname> ntfs defaults 0 0

exit the file.
And then run

 sudo mount -a 

On next reboot, the filesystem would be mounted automatically.

Cheers

Keyboard Shortcut for Suspend/Sleep Laptop (Ubuntu)

To create a keyboard shortcut for putting your laptop to sleep/suspend mode with lockscreen on return: Copy the below script into a file

#!/bin/bash
gnome-screensaver-command --lock && dbus-send --system --print-reply \
--dest=&quot;org.freedesktop.UPower&quot; \
/org/freedesktop/UPower \
org.freedesktop.UPower.Suspend

exit 0

Before naming the file, check if a command of that name doesn’t already exist. you can do this by the which command

Name the file to the command you wanna use. I use compsleep.

With the terminal, reach the file, and convert it into an executable:

chmod +x compsleep

now copy this file into the bin folder, as done at the end of this post.
Check the command in the terminal by writing the filename and pressing enter. If this works, proceed to next step.

Go to
system settings >> (Keyboard Shortcuts)/(Keyboard>>shortcuts)>>+ or add new shortcut.

Enter name of file we created above in the command text box. Set a shortcut for it.

Cheers.

[Update:] custom shortcuts with Alt don’t work from 12.04 onward. It’s a bug.

[Update:2 (August 2016)] The above mentioned command doesn’t work on the newer systems. A simple replacement to that is this:

#!/bin/bash
systemctl suspend
exit 0

 

Natural/Reverse Scroll Ubuntu

For Ubuntu 12.04 : Synaptics Touchpad (Most Common)

#!/bin/bash

d1=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Synaptics Scrolling.*" | awk -F ':\t' '{print $2}' | awk -F ', ' '{print $1}')
d2=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Synaptics Scrolling.*" | awk -F ':\t' '{print $2}' | awk -F ', ' '{print $2}')

xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Scrolling Distance"  -$d1 -$d2
nautilus -q
nautilus -n &

For Ubuntu 11.04
I don’t know how many of you are using this right now. I used to love it, but it started to crash, and so I had to upgrade. Anyway, this is the script for reverse scroll that I used back then.

#xinput set-button-map "SynPS/2 Synaptics TouchPad" 1 2 3 5 4 7 6 8 9 10 11 12

Copy the code into a file. Name it . Save it.
With the terminal, browse to the file, and write the following command:

chmod +x file
sudo cp /path/to/file /bin/

Run the command in your terminal to see if it works. If it does, add it to your Startup Programs.

Cheers.
Leave a comment, if this helps you.