Replacing A Failed Hard Drive In A Software RAID1 Array

Tuesday, June 23rd, 2009

I was checking Development MySQL server (what did you know, I am not that lazy) and I found errors at /var/log/messages, I assume the secondary HDD (/dev/hdb) failed. Fiuh, I am lucky configured this server using Software-Raid1 otherwise all data has gone.

Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Currently unreadable (pending) sectors
Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Offline uncorrectable sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Currently unreadable (pending) sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Offline uncorrectable sectors
Jun 19 16:23:47 dbdemo kernel: hdb: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest Error }

Luckily, uncle Google very nice to me and show me article on Howtoforge.com, following the article I am confident to replace failed harddisk. Below is my Raid configuration:

Array: /dev/md0; Member: /dev/hda1 /dev/hdb1; Raid: 1; Filesystem: ext3fs; mountpoint: /boot
Array: /dev/md1; Member: /dev/hda2 /dev/hdb2; Raid: 0; Filesystem: swap; mountpoint: swap
Array: /dev/md2; Member: /dev/hda3 /dev/hdb3; Raid: 1; Filesystem: ext3fs; mountpoint: /

Summary of Howtoforge’s article is below:

(more…)

SocialTwist Tell-a-Friend

Add Swap on Linux

Tuesday, June 23rd, 2009

From: FelipeCruz

To add swap partition use command

# mkswap /dev/hdb2
# swapon /dev/hdb2
# vi /etc/fstab
# /dev/hdb2   swap   swap   defaults   0 0

With assuming you already create /dev/hdb2 partition before using fdisk and chose swap filesystem.

(more…)

SocialTwist Tell-a-Friend

Read-only file system

Sunday, June 14th, 2009

Once upon a time when I tried to create a folder using ftp client on the server, I get error "cant create directory gallery: read-only filesystem".

After googling a while I found the solution on Always Hosting Forum. And the only way to resolve it permanently is by running fsck utility on linux single mode before mounting the harddrive. Yes there is a temporarily solution by restarting the server, but when the system is about to write into failed inode it will freeze, daemons stop responding, connections rejected, etc to make sure it wont cause more broken inode will lead into data corruption.
(more…)

SocialTwist Tell-a-Friend

Remove files/folders older than 7 days automatically

Sunday, March 22nd, 2009

Add this line into crontab, change /home2/backup with your own folder and 7 with numbers of days.

@weekly find /home2/backup -mtime +7 -type d -depth -exec rm -r {} \;
SocialTwist Tell-a-Friend

Check Linux Foldersize

Monday, February 9th, 2009

I don’t know if there are any utilities out there to show the sums of folder size or by using “du” option. So here I create a small script to check, with looping of “du” command. you can give a paramater like

# ./foldersize.sh /var/lib/mysql

To show how much each folder/database have. So here foldersize.sh script

(more…)

SocialTwist Tell-a-Friend