Creating LVM partitions.
Fri, 03/23/2007 - 10:34 — sandipAfter creating a new partition (/dev/hda5) with fdisk run the below commands:
# partprobe
# pvcreate /dev/hda5
# vgcreate vg0 /dev/hda5
# lvcreate -L 1G -n lv0 vg0
# mke2fs -j /dev/vg0/lv0
- sandip's blog
- Login or register to post comments
Extending LVM
Fri, 03/23/2007 - 09:19 — sandipExtend partition by 1Gb.
# lvresize -L +1G /dev/vg00/lvol0
# e2fsck -f /dev/vg00/lvol0
# resize2fs -pf /dev/vg00/lvol0
Notes:
-
resize2fs has replaced ext2online in FC6.
need to unmount volume prior to doing resize2fs.
Restoring corrupt rpm database
Fri, 03/23/2007 - 08:09 — sandipIf you have a corrupt rpm database, simply delete the db files and rebuild it again.
# rm -rf /var/lib/rpm/*db.*
# rpm --rebuilddb
Serving files from a folder outside the web root with mod_rewrite
Thu, 01/25/2007 - 15:29 — sandipI was serving static content within a drupal installation, which became a huge nightmare when doing upgrades. So, I decided, I should just create a symbolic link to a folder outside the installation and route the traffic via mod_rewrite rules.
I first created a folder called "/var/www/site_files" and then symlinked to it from "/var/www/html/site_files". This way, I just have to recreate one single symbolic link after doing the upgrades.
With the below rules, I was able to maintain the links to the existing pages.
## BEGIN: site_files ##
# Redirect to the homepage if site_files is being called
RewriteRule ^site_files/?$ http://%{HTTP_HOST}/ [L,R=301]
# Apped / at the end of url, if directory is being called without /
RewriteCond %{REQUEST_URI} !^/?$
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -d
RewriteRule ^(.+[^/])$ /$1/ [R=301,L]
# Get directory or file if exists in site_files directory
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -f
RewriteRule ^(.*)$ site_files/$1 [L]
## END: site_files ##
- sandip's blog
- Login or register to post comments
- Read more
New Server CentOS 4.4 at LT Grid with ISPConfig Installed
Tue, 01/23/2007 - 23:52 — sandipThese are notes, I had taken down while setting up ISPConfig Hosting Control Panel on LayeredTechs Grid. Most of the steps were referenced via howtoforge and ispconfig installation notes. There were some gotchas to look out for and has bee noted below:
Search Engine Friendly Redirects
Mon, 01/15/2007 - 01:06 — sandip301 redirect is the most efficient and Search Engine friendly method for webpage redirection. If you have to change file names or move pages around, it's the safest option and preserves your search engine rankings. The code "301" is interpreted as "moved permanently".
With php:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://host.domain.tld" );
?>
With mod_rewrite:
RewriteEngine on
#Redirect Old domain to New domain
RewriteRule (.*) http://host.domain.tld/$1 [R=301,L]
# Redirect a particular domain
RewriteCond %{http_host} ^domain\.tld$ [NC]
RewriteRule ^(.*)$ http://host.newdomain.tld/$1 [R=301,L]
# Redirect a particular file
RewriteRule ^old_file.html$ http://host.domain.tld/new_fil e.html [R=301,L]
- sandip's blog
- Login or register to post comments
- Read more
Block IP addresses from accessing your site via .htaccess
Sun, 01/14/2007 - 00:47 — sandipThere are couple ways to block an IP, the one general way is to use htaccess deny feature.
SetEnvIf REMOTE_ADDR "^xxx.xxx.xxx.xxx$" badip
SetEnvIf REMOTE_ADDR "^xxx.xxx.xxx.xxx$" badip
<Limit GET POST>
order deny,allow
deny from env=badip
</Limit>
- sandip's blog
- Login or register to post comments
Extract individual files from an RPM
Mon, 01/01/2007 - 17:39 — sandipTo extract an individual file from an rpm package without installing the rpm:
-
Use rpm2cpio or rpm -qpl to list files and full paths in the package:
$ rpm2cpio <package_name> | cpio -t
Use rpm2cpio to extract a file. Run this command from /tmp or elsewhere in order to avoid overwriting any current system files.
This creates the full path in the current directory and extracts the file specified.
$ rpm2cpio <package_name> | cpio -iv --make-directories <full-file-path>
To extract everything to the current directory:
$ rpm2cpio <package_name> | cpio -ivd
- sandip's blog
- Login or register to post comments
extracting initrd.img file on Fedora Core 6
Sat, 11/25/2006 - 02:22 — sandipinitrd in Fedora Core 6 is a gzipped cpio archive which can be extracted using:
$ cd /tmp
$ gunzip < /boot/initrd.img |cpio -i --make-directories
- sandip's blog
- Login or register to post comments
Firefox2.0 Tips...
Mon, 11/06/2006 - 09:07 — sandipThis is going to consist of tips on Firefox2.0 usage. If you have any good tips please leave it in the comments.
Hide Go Button
Type in "about:config" in the address bar, then do a search for "hideGoButton" and toggle the value to "true".
- sandip's blog
- Login or register to post comments