Clone and Copy a full laptop hard-drive for upgradation

My latest purchased laptop “Asus K53Sc” wasn’t doing good to me from quite a few months. The problem was with power socket on motherboard. The laptop was still under warranty and I requested a product replacement from Asus. The machine was my mainstream laptop and had all my data, very customized settings, customized softwares and more which I did not afford to loose.

That made me look for options to clone my existing hard drive in the current machine to my Western Digital external USB hard drive, so that I can reload the entire system as it is to my replacement laptop.

For me the best option is to use “Acronis True Image WD Edition Software” which is provided free of cost by WD since I already have a WD 1TB hard disk. In addition to that, I would also recommend backup from Windows built-in “System Backup and Restore“, just to be on safe side.

Another good yet free option would be to use a live cd or live drive with CloneZilla (http://clonezilla.org/) or Redo Backup and Recovery (http://redobackup.org/)

Resources:

http://clonezilla-sysresccd.hellug.gr/clonezilla.html

http://community.spiceworks.com/how_to/show/531-sbs-0702091359-clonezilla-backup-one-partition-hdd-to-external-usb-hdd

http://clonezilla.org/clonezilla-live/

How to Use Clonezilla – Tutorial

How to backup your data for long term storage

For quite some time, I have been digging to find a reliable method to store my heavy personal media files which counts in GBs yet but is growing at a faster rate and soon gonna reach to a TB. And I pre-planned to off-load this data from my system’s hard disk.

Till now, I have looked into online cloud backup services like dropbox, RAID 1 NAS type storage, external hard drives and flash drives including SD cards. I am already using dropbox to store and backup my important files after activating two-factor authentication. Now it’s time to lookup a new house for my media files.

As far as i researched, I found optical storage devices like CDs and DVDs lasts longer but not more than Magnetic Tapes, which I think isn’t a reliable solution for personal needs keeping in view the future innovations. The key to store optical media for long time is maintenance and care.

The second best method, which I’m gonna try, is external hard drive. You may want to buy two hard drives each of different manufacturer (say one of Western Digital and other of Seagate) to justify your “backup” and sync the data every month. I would also recommend storing both the drives at different places in case some mishap like fire happen to one location.

Do handle the external USB powered hard drives with care. The more bumps you give it, the more will be the chances of getting it retire early.

Make sure you make duplicate copies of your critical data in several locations. Let me know if you any better alternative to my work-around.

Right now, cloud storage or redundant local storage (RAID) on active hard drives are much better backup options. Never keep one copy, always keep at least two.

Good Reads:

  • http://wordcastnet.com/2010/how-long-should-your-digital-storage-last/
  • http://www.zdnet.com/blog/storage/long-term-personal-data-storage/376

How to login into a server with “ssh friendly_name”

After moving to an Ubuntu environment after using windows for mote than 10 years, I feel like this is it. I used to use softwares like SecureCRT and Putty in the windows time but now I want to embed deeply into the linux environment for it’s simple yet powerful infrastructure.

At first I could login into my debian based server using “ssh -p22 [email protected]” after putting my private ssh key into the .ssh folder of my current user. But writing that long string every time was hectic and I’ve to find an easier alternative to do it.

After reading some ubuntu specific forums I came to know about host based login, which is useful even if you’re using multiple servers at a time and want to login randomly into each other. It works like defining the commands you want to pass in a ssh_config file (be it a system wide or user specific) only once and then you can use some friendly name to login into your server like “ssh my-server”.

User ssh_config File Location: ~/.ssh/ssh_config

System ssh_config File Location: /etc/ssh/ssh_config

Open the desirable config file and put in the following example configuration:

Host linode
Hostname 132.32.14.23
Port 1234
User indude

You can find the list and descriptions of all parameters that can be specified in the host at http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config&sektion=5

Securing PHP 5 Configuration File (php.ini)

PHP used to be the called the vulnerable script language around version 4 but since then a lot have been improved over the period with now my linux box using PHP 5.4 with built in test server. With thousands of websites and blogs writing to aware the php techies about common attacks and how to prevent them. Actually, the most common vulnerability as per me is “bad coding” techniques which may result in sql injections and xss kinda attacks.

Suhosin, a php plugin served well for few years but now It’s development is ceased for some reason. The dotdeb.org package of php5.4 doesn’t come with suhosin anymore for the same reason.

Below are some techniques to secure or harden your php configuration from server side:

Note: A more preferred way will be to define a new ini file for every user as per the need rather then messing with the global php.ini.

short_open_tag = Off

asp_tags = Off

disable_functions = phpinfo,system,exec,shell_exec,passthru,popen,proc_open,parse_ini_file,show_source,symlink,curl_exec,curl_multi_exec

expose_php = Off

error_reporting = E_ALL

display_errors = Off

log_errors = On

ignore_repeated_errors = Off

report_memleaks = Off

open_basedir = “/home/user/websites:/tmp/”

upload_tmp_dir = /home/user/websites/.tmp

session.save_path = “/home/user/websites/.tmp”

error_log = /var/log/php-errors.log

post_max_size = 10M

default_charset = “UTF-8”

upload_max_filesize = 2M

allow_url_fopen = Off

Since this is my personal box, I restricted all eligible functions that can leak personal information or get exploited in other way.

You may also want to run a PHPSecInfo to verify the applied the missed settings.

How to easily use cron jobs in Linux

Cron Jobs in Linux

Linux Crontab Format

MIN HOUR DOM MON DOW CMD
Table: Crontab Fields and Allowed Ranges (Linux Crontab Syntax)
Field Description Allowed Value
MIN Minute field 0 to 59
HOUR Hour field 0 to 23
DOM Day of Month 1-31
MON Month field 1-12
DOW Day Of Week 0-6
CMD Command Any command to be executed.

More at www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

Daemonize a bash script

I made a daemon process that runs all the time in background in my Debian 6 powered linux box. In this tutorial, I’m taking a example of bash script that I scripted as a temporarily fix to keep my php process up.

Enter the below code at the start of your existing bash script to create a PID a file every time it executes:

echo $$ > /var/run/phprestarter.pid;

Enter the below code at the end of your existing bash script to create run the code every 2 seconds using sleep command:

sleep 2;
/home/indude/phprestarter.sh >/dev/null 2>&1 & exit 0;

In the above line, red colored code throws away any output and doesn’t output it whereas blue colored closes the script everytime it runs. The time is entered in seconds.

Now create a new script in /etc/init.d/ directory, say “phprestarter” (without any extension) and put the following content inside it.

#! /bin/sh
# /etc/init.d/phprestarter

pid_file=/var/run/phprestarter.pid;

start_phprestarter(){
/home/indude/phprestarter.sh >/dev/null 2>&1 & exit 0;
}

case “$1” in
start)
if [ -f $pid_file ]; then
echo “PHP Restarter already running.”
else
echo “Starting PHP Restarter.”
start_phprestarter
echo “PHP Restarter is started”
fi;
exit 1;
;;
status)
if [ -f $pid_file ]; then
echo “PHP Restarter is running.”
else
echo “PHP Restarter is stopped.”
fi;
;;
restart)
echo “Restarting”
$0 stop
$0 start
echo “Restarted”
;;
stop)
echo “Stopping PHP Restarter.”
if [ -f $pid_file ]; then
kill -KILL $(cat $pid_file);
rm -f $pid_file;
fi;
exit 0;
echo “PHP Restarter Stopped.”
;;
*)
echo “Usage: /etc/init.d/phprestarter {start|stop}”
exit 1;
;;
esac

exit 0;

Change the above code with your correct paths, script names etc.

Resource: teclogs.org/how-to-running-bash-shellscripts-as-daemons-on-linux/

PHP-FPM Error Solved: Failed to ptrace(PEEKDATA) pid: Input/output error

I got rid of the below error messages in my php5-fpm.log just after commenting out the below two lines in my pool.d/www.conf file.

Lines to comment

;slowlog = /var/log/php5-fpm/$pool.log.slow

;request_slowlog_timeout = 20s

Error Log:

[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 32076: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 32076
[01-Sep-2012 22:03:37] NOTICE: child 5377 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 5377
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 5377: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 5377
[01-Sep-2012 22:03:37] NOTICE: child 8990 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 8990
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 8990: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 8990
[01-Sep-2012 22:03:37] NOTICE: child 12402 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12402
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12402: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12402
[01-Sep-2012 22:03:37] NOTICE: child 12403 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12403
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12403: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12403
[01-Sep-2012 22:03:37] NOTICE: child 12570 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12570
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12570: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12570

The stack trace (to determine what the script is doing) is failing. If you’re running out of processes, it is because either:

  1. After php-fpm stops the process to trace it, the process fails to resume because of the error tracing it
  2. The process is resuming but continues to run forever.

If this doesn’t fix the issue of running out of processes, then set the php.ini max_execution_time to something that will kill the script for sure.

Free SMS Sites for Text Messages to India

Everybody likes sending and receiving SMS, as it is the easiest and shortest way of communication. It tells you that you are cared and helps you in being touch with your buddies and close circle of people. In general the SMS costs less, compared to calling the people. Who will not be excited in knowing about the feature of sending the SMS at free of cost from the computer? What you need is a computer and an internet connection; now you will be connected to your friends and closed ones across the world. It has both advantages and disadvantages. It entirely depends upon you to check for the best websites in terms of usages and features. There are numerous websites offering free SMS services; no wonder, every day one such site is taking birth.

At this point of time, their objectives are questionable! What would they get in return, by offering such free SMS services? What is the use for them providing this service? If we pay close attention, then we can infer that they might get paid, via advertising other company’s products, and other information in their sites. There are numerous sites in this category and no doubts, regarding the fact that these sites would be search engine optimized sites; as a result, more and more advertisers would be willing to promote their products, via such sites. Such sites would be the cheapest medium for them to promote their advertisements. Some sites doesn’t stop by allowing these advertisers to use their site, rather, they allow these advertisers to send their advertisements and their promotional activities, via the SMS, which are being sent through parent SMS sites. Such advertisements would be attached at the end of the SMS.
If a person is registering in these sites for business activities, their contacts are used without their knowledge to send advertisements, other promotional activities and sometimes, even a message regarding a public happenings, or events. This would in turn irritate the person’s clients, customers and other users. Such SMS websites are also creating public nuisance. Recently, even the Indian government has announced such websites to hold the services, during the ‘Ayodhya verdict’ in order to avoid the swirling of unnecessary speculations in the country and to cease the problems that might otherwise raise form these SMS services, i.e. by sending bulk SMS in favor to a group of a religion might harm the other group.

Some sites are also promoting illegal ‘Multimedia Messaging Services’ via their services. All these are done to attract enormous number of customers to use their site. If their site is listed first in the search engines, such as ‘Google’, ‘Yahoo’,… then the advertisers who have promoted their products and services through these websites would also be listed in the first place, for which they would be charged accordingly. This has not only granted an easy means to communication and ecommerce activities, but has also invited problems and controversies at an easy means! If you enjoy the former event, then it is mandatory to enjoy the latter consequences too!

Rupee Symbol

Indian Rupee Symbol

Rupee symbol: A makeover

The rupee symbol that has been defining the currency of India for years is now on a verge of a makeover. Now the question arises will the new symbol that resembles a Hindi word ‘RA’ blended with a roman character ‘R’ will also give a new identity to the Indian currency. Will the new symbol, designed by Bombay IIT post-graduate D Udaya Kumar, appeal to the Indian only or will it have a charming effect internationally too still remains a question?

It might be considered that on one side this symbol will give a distinctive and unique identity to the currency from the Rupee or the Rupya of the countries like Sri Lanka and Pakistan and on other hand it will show the strong bonding of the country towards the language as well as its amalgamation with roman English. It shows a global combination of modernity and tradition. This will provide the country with a global face and highlight its strengths. If the symbol needs to be explain it might be predicted as ‘Ra’ to be the currency and the two lines in the symbol shows a balance of economy within the country and with other countries

This makeover will help India join the group of countries and make it the 5th country which has a unique and distinctive currency symbol which will denote the robustness of the Indian economy.

The IIT graduate considers the currency to be containing the integrity of the country as it explains it to have based on the Tricolour with two lines at the top and white space in between representing the Indian flag with the Ashoka chakra.

Though the rupee symbol will not be used on the currency notes or coins for some time it will form a part in the ‘Unicode Standard’ and major scripts of the world .This will make sure that it gets its recognition worldwide

Hair Removal For Men

The hair removal process is not a new one, but the consequences and the effects of the hair removal processes have changed, during the recent years, especially for men. Earlier, the hair removal process is implemented to the men in removing the hair from head, due to religious causes, and for other specific reasons, but during the recent years, the men have started shedding their hairs from other parts of their body due to many reasons, like,fashion, to attract partners, to portray themselves as a style icon, etc… some men are removing the hairs from the body in order to portray that they have a gymnastics body. There are many causes, which have made the men to remove their hair, such as, nowadays, most of the girls like men with no hairs on their chest. These are some of the major causes that have made the men to remove their hair, not only from the chest, but also frombackbottomlegs, etc… There are several methods available for men to remove their hairs and the methods are in general specific to the body parts.

Hair Removal Methods:

Specific to chest and back

Electrolysis

This involves inserting a metal probe into the affected area and delivers an electric shock. Thereby, it damages the base of the hair follicle, which makes it very easy to remove the hair from the area. This method is reallyexpensive and time consuming. That too, if the hair has to be removed from a large area like, chest, it requires extreme patience.

Flash lamp

It is in general recommended for larger areas like, back and chest. It is also called as Intense Pulsed Light, as it emits the light through a small hand-held flash lamp device into the affected area. This light heats up the hair, which then get transmitted to the roots of the hair, resulting in the hair removal from the specific areas.

Laser

This treatment involves emitting the laser beam into the affected areas, thereby heating the hair follicles and removing it. It is majorly done for the permanent removal of the hair from the body. The laser light is absorbed by the melanin and not by the skin directly, hence proper method of emitting the laser light into the area would result in perfect hair removal procedures.

Sugaring/Waxing

The sugaring and the waxing methods are more, or less the same in procedures, except for the ingredients, as the sugaring method involve applying the sugar coating to the skin, whereas the waxing method involves applying hot wax to the skin. But, the method of implementation is the same in both the methods, as both methods involve applying the ingredients to the skin and then removing the hair by a reusable strip of cloth!

Specific to Moustache and Beard

The most common method used to remove the hair from the face is shaving, which is done using the electric razor, or normal razor blade. The laser treatment could also be undertaken, but care should be taken, as laser light when emitted with more than the specific wavelength, might cause damages to the skin.