How you can take database backups on linux

Written by AlanV on September 20, 2008 – 11:27 am -

MySQL is most popular and common database used in linux, unix and all
cPanel, Plesk servers ,
PostgreSQL is also used but it is not as widely use as MySQL

A. MySQL database backup

mysqldump is used to take the backup of MySQL databases

# mysqldump database_name > backupfile.sql
This will generate the backup of MySQL databases in .sql file

To restore dumps you can use mysql command

# mysql database_name < backupfile.sql

B. PostgreSQLdatabase backup

It is easy method to take PostgreSQL database backup

# pg_dump databaseame > databasename.pgdump

Restore the database from the dump

# cat databasename.pgdump | psql databasename

If database is large then you can use gzip to redeuce size if backup file

# pg_dump databasename | gzip > databasename.dump.gz

Then restore the dunp into database

gunzip -c databasename.dump.gz | psql databasename

Tags: , , , , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | No Comments »

Premature End of Script headers in Apache

Written by Nancy on September 20, 2008 – 5:23 am -

There are two main reasons for the error “Premature End of Scripts headers”. This is an attempt to elaborate more on those reasons.

When running a Perl CGI script, you may see the “Internal Server Error” message in your browser. When you come across this, you should check the server logs to get the exact reason for this error. A good place to look for is in the Apache error log, which is generally located at /usr/local/apache/logs/error_log or /usr/local/apache/logs/suexec_log

The other interesting cause of this error is suEXEC problems.

Assuming that your server is configured properly for running CGI scripts, your problem may be one of these common causes for the Internal Server Error:

Problems outside the script:

1. Directory permissions: your cgi-bin directory should be chmod’ed as 0755, not 0777. Similarly if your script is at …/cgi-bin/foo/bar.cgi, the foo directory must not be world-writable (0777). This is because many servers will refuse to execute CGI scripts within world-writable directories, as a security precaution.

2. File permissions: your CGI script itself must also be 0755 and not 0777, for the same reasons.

3. Transfer modes: if you are using FTP to transfer the CGI script to your server, then your FTP client is probably set to AUTO transfer mode; that is, it will try to figure out whether to use BINARY or ASCII mode without asking you. But depending on whether your CGI script came from a Windows or UNIX system, and whether it’s going to a Windows or UNIX system, you may need to manually set your FTP client to use either ASCII or BINARY mode before transferring your CGI script. Try one and then the other.

4. Line endings: the cause of the transfer-mode problem is actually another problem in itself: different types of Operating Systems (namely, Windows vs. UNIX/Linux/everything) use different character codes to represent line-endings. If your server is a UNIX server, but you’re editing your CGI script on a Windows computer with a text-editor that doesn’t use UNIX-style line-endings, it’ll cause problems. Applications like GoLive and Dreamweaver sometimes get this wrong. Even built-in editors can’t agree: WordPad (not Word) seems to get it right while Notepad messes it up. So try opening & saving your CGI script in a different text editor and uploading it to the server again.

5. htaccess File : Incase of Linux Systems you need to check the .htaccess file also, for the deny IP statements. Due to this line in the htaccess file the error is premature end of script headers .

Problems within the script:

1. The shebang line: The first line of a CGI script must contain the path to the Perl binary on the server. On most UNIX servers this is just #!/usr/bin/perl or sometimes #!/usr/local/bin/perl and you can always run the command “which perl” to find out for sure. On Windows servers, you can sometimes get away with just using #!perl but you may need to specify the full path like #!c:\path\to\perl.exe.

2. Actual script errors: it’s always possible that there’s simply an error in the Perl code itself. If you’re having trouble with a script you purchased from Encodable Industries, this is unlikely since many other people have bought the same exact script and are running it just fine.

Related Problems

1. Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmq.cgi: Please check /usr/local/cpanel/logs/error_log for the exact error.

Exact Error –
Can’t locate loadable object for module Template: Stash::XS in @INC (@INC contains: /usr/local/cpanel /usr/lib/perl5/5.8.8/x86_64-linux /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl . /usr/local/cpanel/whostmgr/docroot/cgi) at /usr/lib/perl5/site_perl/5.8.8/Template/Stash/ line 31

BEGIN failed–compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Template/Stash/ line 31.
Compilation failed in require at /usr/local/cpanel/Cpanel/ line 14.

In this case just reinstall the perl module Template::Stash::XS . This will fix this issue
- Re-upgrade perl
- Re-run the CSF installation script
- Change the cPanel update settings

If reinstalling perl fixes it, then it’s a cPanel problem and you will need to reinstall it on your servers.

Posted in Linux VPS Hosting | 1 Comment »


Written by Nancy on September 20, 2008 – 4:21 am -

Do you want to know the exact reason as why it’s denying your script from executing properly? Check the Logs at /usr/local/apache/logs/suexec_log OR /usr/local/apache/logs/error_logs

  1. try adding a “-w” to the end of the first line of your Perl script ie  change the First Line  From “#!/usr/bin/perl”  TO   “#!/usr/bin/perl –w
  2. make sure that your CGI script has the same user/group ownership as your cgi-bin folder.

Posted in Linux VPS Hosting | 1 Comment »

How to restore database backup of MSSQL

Written by Mangesh on September 20, 2008 – 3:10 am -

1. Open MSSQL Server Management Studio. (Start >>> programs >>> Microsoft SQL server 2005 >>>
SQL server Management studio Express)

2. Connect to MS SQL Server database
(Connect to server window)
Server name: 192.168.XX.XX\SQLEXPRESS
Authentication: SQL server Authentication OR Windows Authentication
Login: sa
Password: xxxxxx

Then press connect

3. After login to SQL server

1. Expand the Databases
2. Select the database test_db
3. Right click on database
4. Select Tasks >>> then select restore
5. Open restore database window
6. Under the source for restore >>> select from device
7. Then select square box in front of from device
8. Specify backup window open
9. Select add button
10. C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\test_db.bak ( Backup location path ) >>> press ok
11. Select the check box (Restore) under the select the backup sets to restore
12. After this select the “Option” Icon >>> under the restore options >>> select Overwrite the
existing database >>> press ok
13. Restore DB successfully massage window comes >>> press ok


Tags: , , , , , ,
Posted in Dedicated Server Hosting | No Comments »

Introduction to FileSystem

Written by Mike on September 18, 2008 – 8:54 pm -

Dumping a cupboard-full of documents, audio cassettes, video tapes and even photo albums on a hard drive or DVD might sound easy, but is actually a complex process. Operating systems use logical data structures for storing, organizing and keeping track of files on a partition or on an optical disc, called a Filesystem. The basic function of a FileSystem is to make efficient use of disk space for data storage, ease basic file operations (read, write, copy and delete) and catalogue files for faster retrieval.

A disk partition is like a compartment in a train, while the Filesystem is the seating arrangement fixed within the compartments. Before using any partition on a disk, a logical Filesystem needs to be initialized on it. Let’s have a look at how a typical Filesystem works.

How Filesystems Work?

The space in a hard drive is divided into units called sectors, usually of 512 bytes. The Filesystem groups the sectors together after creating a sector index; the group is called a cluster or an allocation unit. It’s difficult for the Filesystem to deal with data on a sector-by-sector basis, so when the Filesystem needs to access a sector for a read-write operation, it will first define the cluster number of that sector. Then from that cluster, it will use the sector index to access that particular sector. Each logical volume (hard drive) has a table—called the File Allocation Table (FAT)—that carries all the information about the sectors and the files stored on those sectors.

Types of Filesystems

Disk-based Filesystems
These would be found on hard disks, CD-ROMs and DVDs. Files are stored in a sequence of bytes on fixed-sized blocks called sectors; these Filesystems feature random-access file reads and writes, and also file fragmentation across the disk. Some disk-based Filesystems also have journaling and versioning. In a Journaling Filesystem like XFS on the Silicon Graphics platform, changes in files are logged first in a specially allocated area called a Journal before they’re actually written on the main Filesystem. Versioning Filesystems like OpenVMS allow for the existence of several versions of the same file, and take periodic backups. Popular disk-based Filesystems include:

Windows: New Technology File System (NTFS), File Allocation Table (FAT, FAT16, FAT32), and many more;
Linux: ext, ext2, ext2fs, NSS, ReiserFS and several others based on Linux and UNIX variants
Mac OS X: Hierarchical Filesystem (HFS+), HFS, Macintosh Filesystem (MFS), Xsan

Disk-based Filesystems can be further classified into:

Solid-state media Filesystems: These are designed for storing files on devices that rely on Flash memory as their storage. Such Filesystems require special handling, because data blocks wear out if information is repetitively written and rewritten on the drive. Besides, the blocks have to be erased explicitly before any data is written on them. The Journaling Flash Filesystem (JFFS) and Yet Another Flash Filesystem (YAFFS) are popular solid-state Filesystems.

Record-oriented Filesystems: The basic purpose of such Filesystems is to store files in the form of records to be compatible with older operating systems that are used exclusively on mainframes and minicomputers.

Shared-disk Filesystem: These are also known as SAN (Storage Area Network) Filesystems or Cluster Filesystem. As the name suggests, they are used on huge blocks of storage which are directly accessible to computers via a network connection.

Network Filesystems
Network Filesystems (or distributed Filesystems) support the sharing of files, printers and other computing resources over a network. The performance of such Filesystems is measured by the time it requires to satisfy the service requests by different computers connected on the network. Such Filesystems are found on file-servers and provide access to files by acting as clients for remote access protocols like NFS (Network Filesystem) or SMB (Server Message). NFS and SMB are popular examples of network Filesystems. Several network Filesystems prevail today: 9P, Apple Filing Protocol (AFP), NetWare Core Protocol (NCP), Coda, Distributed File System (DFS) and Google File System (GFS), to name a few.

Filesystems are critical for storage media to run properly with the operating system. Regular maintenance and protection from malware is not only advisable, it’s necessary.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , ,
Posted in Dedicated Server Hosting | No Comments »

Performance Tips for Your Windows VPS

Written by Swapnil on September 18, 2008 – 8:14 am -

Here is the top 10 tips and tricks to help optimize your Windows VPS server running on Virtuozzo.

1. Disable Indexing Service.
Unless you’re using the FrontPage search bot you generally don’t need indexing service running and you should disable it.

2. Defrag your drives.
Disk I/O is king, especially in a VPS and you should be regularly defragging your drives in your VPS just as you would in a physical server.

3. Don’t run antivirus in the VPS.
Antivirus should always be run from the host node and on our servers it is. We use either AVG or McAfee on our hardware nodes. This doesn’t mean you have to accept virus infected emails. Configure your mail client to allow a suitable delay in email delivery (I recommend 60 seconds if you can, otherwise 30 should be sufficient) and the hostnode antivirus will take care of the rest.

Smartermail installs clamd these days and we recommend you disable it and not use it. It’s proven to be quite the resource hog.

4. Don’t run spamassassin.
Disable spamassassin checks in your VPS Hosting when running Smartermail. If you absolutely have to have spamassassin running with your VPS Hosting you should run spamassassin on a Linux dedicated server or VPS Hosting and remotely connect to it in smartermail, this works great and allows you to make use of threading.

5. Enable Windows Firewall and secure your VPS Hosting.
This is a must. Although the kernel is protected in your VPS Hosting, you’re still responsible for security in your virtual private server. Enable Windows Firewall and configure it.

While on the topic of security you do not have to install OS updates, these are managed at the host-level. However you do need to remain aware of new updates and install them for any other server software you may have installed on your windows VPS Hosting server such as SQLexpress updates, Smartermail updates, etc. If you’re using Plesk you can request support to update Plesk for you as it’s installed through an application template. Verify things like open-relay mail servers are not enabled, anonymous FTP uploads are disabled, etc.

6. Whenever possible use an application template.
Application templates save memory and diskspace on your VPS Hosting. An example of this is the OS install on your VPS Hosting. With just Windows your VPS Hosting uses about 150MB of diskspace, yet a full install of the OS uses about 4GB of diskspace. In fact an install of Windows Server 2003 on almost every other virtualization platform will use 4GB of diskspace. This is a huge savings.

7. Close your Terminal Services sessions and logout, do not just disconnect.
Each active Terminal Services session uses about 20MB of memory. When you consider each VPS Hosting has generally 2 TS sessions (3 if you include the fact you’re able to TS into the console by using the command mstsc /console /v:YOUR_SERVERNAME ) and figure about 30 active VPS Hostings on a machine that adds up to close to 2GB of memory that would be wasted memory on a server.

8. Some applications when installing may require you to connect to console port.
One such application is Windows Sharepoint Services 3.0. To connect to the console port use the command from dos: mstsc /console /v:YOUR_SERVERNAME where YOUR_SERVERNAME is your VPS Hosting host name.

9. Don’t forget that you can manage your VPS Hosting through the Virtuozzo Power Panels,
This includes tasks such as stop, start, reboot, backup, restore and even mount the filesystem without turning on the VPS Hosting. To access the management port go to: https://YOUR_SERVERNAME:4643/ where YOUR_SERVERNAME is your VPS Hosting host name. Remember when connecting to a port you have to explicitly type http://YOUR_SERVERNAME:PORT/ and not just type YOUR_SERVERNAME:PORT.

There is a bug in the virtuozzo power panels that it may throw errors and say contact your web hosting provider. If you get these errors the first thing you should do is go to preferences and set the timezone to your local time zone and not leave it to server default. This generally fixes that error and a bugfix is due out shortly from SWsoft to fix this known issue.

10. Configure your SQL Server services or better yet use shared SQL.

These days any web application is going to require a SQL Server database be it MSSQL or MySQL. Our recommendation is use a shared SQL Server database on a shared database server. Today SQL Server hosting is pretty cheap and networks like ours use a dedicated gigabit network for internal traffic so any latency connecting to the SQL Server would be offset quickly by the amount of memory and Disk I/O you’d save by not running SQL Server on your VPS Hosting. If you must run SQL Server on your VPS Hosting though then make sure you set a memory cap on the SQL Server service or you’ll find before long it’s using all your memory on your VPS Hosting and your applications will be starving for memory.

VPS Hosting’s have two types of resources they need to manage the most, that’s memory and disk I/O. Everything you can do to minimize or optimize your usage of these two resources will improve your VPS Hosting performance. We would love to hear from anyone else that has any recommendations on how to improve the performance/security of a VPS Hosting/VE running on Virtuozzo for Windows.

Thanks to David Marshall.

Tags: , , , , , , , , , , , , , ,
Posted in Windows VPS | 1 Comment »

How to check the filesystem for a Windows VPS Hosting if it has ntfs errors?

Written by Swapnil on September 18, 2008 – 8:09 am -

The following error appears on the node in Event Viewer:

Event Type: Error
Event Source: Ntfs
Event Category: Disk
Event ID: 55
Date: 8/24/2006
Time: 8:04:16 AM
User: N/A
Computer: STARVZW01
The file system structure on the disk is corrupt and unusable. Please run the chkdsk utility on the volume \Device\VZLPBKVolumes\VZLPBKVolume{F9B7EA79-9590….

For more information, see Help and Support Center at http://
0000: 00 00 04 00 02 00 52 00 ……R.
0008: 02 00 00 00 37 00 04 c0 ….7..À
0010: 00 00 00 00 02 01 00 c0 …….À
0018: 40 00 00 00 00 00 00 00 @…….
0020: 00 00 00 00 00 00 00 00 ……..
0028: 91 03 14 00 ‘…


Virtual disk of VPS with GUID started with {F9B7EA79-9590… is corrupted.


Check VPS.conf file to get the GUID string and perform the following, e.g

vzctl stop VPSID

vzdskctl mount z:\vz\private\VPSID\root.efd {GUID }

chkdsk /f \\?\Volume{GUID }

vzdskctl umount {GUID }

vzctl start VPS

A real life example:

vzctl stop 115

vzdskctl mount c:\vz\private\115\root.efd {799251BE-720C-468E-B877-913F49476001 }

chkdsk /f \\?\Volume{799251BE-720C-468E-B877-913F49476001 }

vzdskctl umount {799251BE-720C-468E-B877-913F49476001 }

vzctl start 115
Please note: this approach works perfectly for additional drives, added via the Mount manager, ie drives D:\ or E:\

Use the additional drive’s GUID from the .conf instead of the VPS’ primary
GUID to perform the same operations, see GUID example for drive D:
DRIVE_D=”type=loopback;file=lpbk0000.efd;guid={cc4a1cb5-9f9d-47ac-a09f-0e6b87643105 };”

Posted in Windows VPS | No Comments »


Written by Mangesh on September 18, 2008 – 7:23 am -

How to backup the databases

Backup of MS SQL Server 2005 databases

This is the steps of backup:

1. Open MSSQL Server Management Studio. (Start >>> programs >>> Microsoft SQL server 2005 >>>
SQL server Management studio Express)

2. Connect to MS SQL Server database :
(Connect to server window)
Server name: 192.168.XX.XX\SQLEXPRESS
Authentication: SQL server Authentication OR Windows Authentication
Login: sa
Password: xxxxxx

Then press connect

3. after login to SQL server

1. Expand the Databases
2. select the database test_db
3. right click on database
4. select Tasks >>> select backup
5. then open backup database window
6. Under Backup type select Full
7. Under the destination
8. C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\test_db.bak
9. Enter the path and file name for the backup file
( add this default path and backup should be in .bak format )
10. Press OK
11. backup successfully windows
12. press ok

Tags: , , , , , ,
Posted in Windows VPS | 1 Comment »

ISAPI Rewrite

Written by Mangesh on September 18, 2008 – 5:58 am -

ISAPI Rewrite is a powerful URL manipulation engine based on regular expressions.
It acts mostly like Apache’s mod_Rewrite, but it is designed specifically for Microsoft Internet Information
Server (IIS).

It can be used to allow dynamic pages be indexed by search engines, stop hotlinking,
proxy another server content,manipulate incoming request headers and strengthen server security.
Develop a custom authorization scheme and manage access to the static files, using custom
scripts and database.

Functions of isapi_rewrite :

Internet server with very flexible permissions and security options.
Create dynamic host-header based sites using a single physical site, Create dynamic host-header based
sites using a single physical site.Create virtual directory structure of the site hiding physical files
and extensions.
This also helps moving from one technology to another Return browser dependent content even
for static files, and many other problems could be solved with the power of the regular expression engine
built into ISAPI Rewrite,regular expressions based URL rewriting engine.Support for global per server
configuration file, Support for per virtual site configuration files, in memory configurations cache.
Automatic deletion of rarely used configurations from memory.Monitoring of configuration files and metabase
changes and dynamic configuration reload.

Example of isapi_rewrite

Current site URL
We have these types of URL:$post2&windows=$windows1&page=$page1&

After use of isapi_rewrite :

Posted in Windows VPS | No Comments »

Migrating Cpanel Servers

Written by Swapnil on September 17, 2008 – 1:52 pm -

Moving all the accounts between two Servers that host the same control panel is usually not a very difficult process.

You need to move all domains from the present server to the new server. At the same time, you need the whole move done perfectly and with zero downtime for all domains. In addition, you need to move even your nameservers between two different datacenters. Its pretty complicated.
Read more »

Tags: , , , , , , , , , , , , , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | No Comments »

  • Subscribe Me

  • Tag Cloud

  • Archives