Backup using dd command

To backup an entire hardisk

#dd if=/dev/sda of=/dev/sdb

sda is the source hardisk and sdb is the external hardisk to which am taking backup

“if” represents input file and “of” respresents output file….

if we give parameter “conv=noerror” then it will continue to copy if there are read errors…else command may fail due to read error

#dd if=/dev/sda of=/dev/sdb conv=noerror

To make image of a hardisk

#dd if=/dev/sda of=~/Desktop/hd_img.iso

Consider am having a bootable usb with a custom OS with some settings saved in it…To make an image of that

Make image of the bootable usb

#dd if=/dev/sdb of=~/Desktop/puppy.img

The above command will make an image of the bootable usb
Now connect the blank usb and make it bootable

dd if=~/Desktop/puppy.img of=/dev/sdb oflag=direct

Always run dd command as root user…use df command to know the drives else you may loose the data…

the same command with a view on the progress of the dd command:

# apt-get install pv
# pv -tpreb /dev/sda | dd of=/storage/disk.img

Advertisements

How to connect Micromax 3G mobile internet modem in Ubuntu 12.04

Last day i configured a Micromax 3G mobile internet modem…This is how i fixed it…The output of lsusb was like this

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 
Bus 001 Device 003: ID 03f0:5307 Hewlett-Packard 
Bus 001 Device 008: ID 1c9e:9605 OMEGA TECHNOLOGY 
Bus 001 Device 006: ID 5986:0364 Acer, Inc

Create a config file

gksudo gedit /etc/usb_modeswitch.d/1c9e:9605

Paste this code in that config file

DefaultVendor = 0x1c9e 
DefaultProduct = 0x9605 
TargetVendor = 0x1c9e 
TargetProduct = 0x9605 MessageContent="55534243123456788000000080000606f50402527000000000000000000000"

Save and exit then

sudo modprobe usbserial vendor=0x1c9e product=0x9605 
sudo usb_modeswitch -c /etc/usb_modeswitch.d/1c9e\:9605

This will fix the issue….
You need to run this code always so you can add this to /etc/rc.local…Insert the below code just before exit 0 so that it will be part of your startup programs

sleep 10
 modprobe usbserial vendor=0x1c9e product=0x9605
 usb_modeswitch -c /etc/usb_modeswitch.d/1c9e\:9605
 sleep 20
 nmcli nm wwan on
 sleep 10
 nmcli con up id "your connection name here"

After restarting connect the device and wait for 10 seconds to get the device detected…

Configure Reliance Netconnect/BSNL EVDO on Ubuntu 10.04

Firstly we need to install these packages usb-modswitch, usb-modswitch-data

Open up Terminal,and type the following

 $sudo apt-get install -yq usb-modeswitch usb-modeswitch-data wvdial

Then we need to edit wvdial.conf file,type this in the Terminal

$sudo gedit /etc/wvdial.conf

Type the following in the file opened,be sure to add your phone number

[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer netconnect]
Username = your device phone number
Password = password usually the device phone number
Phone = #777
Stupid Mode = 1
Inherits = Modem0

close the editor and reboot the system,now to connect you need to type

 $sudo wvdial netconnect
sudo modprobe usbserial vendor=0x19d2 product=0xfffd

Remove,install and reconfigure xorg without reinstalling ubuntu

After installing ATI graphics drivers on ubuntu 11.10 the system got an “ASUS unsupported hardware message” on login screen and the login got stuck.Rather an uninstalling ubuntu i tried to reinstall and reconfigure xorg.i got console by using Ctrl+Alt+F1 and from console i tried this…

Remove existing xorg

sudo apt-get remove --purge xserver-xorg

Install xorg

sudo apt-get install xserver-xorg

Reconfigure xorg

sudo dpkg-reconfigure xserver-xorg

This fixed the xorg problem and got my window back………

How to Reinstall apache2 properly in GNU/Linux

If you have issues with apache2 and you want to reinstall it but you are getting errors,then here it isthe solution for you.

i had an issue with apache, when i tried to start it i got this error message.

 /etc/init.d/apache2   start.: 45: Can't open /etc/apache2/envvars

i need to remove it completely.To do that i will use this command :

 sudo apt-get remove --purge apache2 apache2-utils
This command will completely remove all apache2 configuration files and directories.
– Reinstall again apache using the normal command
sudo apt-get install apache2

Set / Change / Reset the MySQL root password on Ubuntu/Debian Linux

Stop the MySQL Server

sudo /etc/init.d/mysql stop

Start the mysqld configuration.

sudo mysqld --skip-grant-tables &

Login to MySQL as root

mysql -u root mysql

Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; 
FLUSH PRIVILEGES; exit;

This worked for me at the last step changedthe user with root and gave the password

Installing Node.js and NPM on Ubuntu/Debian

This is the simple way to install Node.js and npm which is needed for the installation of coco2d javascript

Step 1 – Update your system

sudo apt-get update
sudo apt-get install git-core curl build-essential openssl libssl-dev

Step 2 – Install Node.js

First, clone the Node.js repository:

git clone https://github.com/joyent/node.git
cd node

Now, if you require a specific version of Node:

git tag # Gives you a list of released versions
git checkout v0.4.12

Then compile and install Node like this:

./configure
make
sudo make install

Then, check if node was installed correctly:

node -v

Step 3 – Install NPM

Simply run the NPM install script:

curl http://npmjs.org/install.sh | sudo sh

And then check it works:

npm -v
 Happy Hacking