Friday, June 27, 2008

Yahoo ...blok ip telkomspeedy ...

Test email dari server testing Centos 5.1, saya pakai cyrus-imapd versi 2.3.7 dan postfix 2.3.3. Server kirim dan terima dari server gmail bisa, namun begitu saya coba email ke yahoo ternyata di blok.


: host mx1.mail.sg1.yahoo.com[124.108.116.72]
said: 553 Mail from wahyu@xxxxx.org not allowed - 5.7.1
[BL21] Connections not accepted from IP addresses on Spamhaus PBL; see
http://postmaster.yahoo.com/550-bl21.html [550] (in reply to MAIL FROM
command)

Ternyata yahoo blok dari spamhaus PBL. Saya menggunjungi website spamhaus.


IP Address Lookup

125.164.xx.xxx is not listed in the SBL

125.164.xx.xxx is listed in the PBL, in the following records:

* PBL171259

125.164.xx.xxx is not listed in the XBL


Berdasarkan di bawah, blok ip dari Telkomspeedy di blok
Ref: PBL171259

125.164.72.0/23 is listed on the Policy Block List (PBL)

Berarti ada 510 IP yang di blok. Karena hanya untuk testing, saya tidak remove IP address statik saya.

Wednesday, June 25, 2008

Setting PPPoE di Centos 5.1 menggunakan telkomspeedy

Catatan untuk membuat PPPoE di Centos 5.1 menggunakan telkomnetspeedy.
Karena Up Link dan Down Link Telkomspeedy sudah lumayan kenceng, walaupun kalau lagi lemot juga sangat lemot.

Gambar di bawah capture konfigurasi modem am300 gratis dari telkomspeedy :)




Setting modem di setting seperti diatas.

Kemudian setting Centos 5.1 dengan 2 ethernet, 1 ethernet untuk jaringan lokal, dan 1 ethernet untuk koneksi ke modem.

Internet <--> Modem(bridge) <--> Server gateway(eth1,eth0)

[root@wahyucentos ssh]# cat /etc/redhat-release
CentOS release 5 (Final)
[root@wahyu ssh]#

[root@wahyucentos ssh]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:8D:C3:39:7D
inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:8dff:fec3:397d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5990 errors:0 dropped:0 overruns:0 frame:0
TX packets:2161 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:825820 (806.4 KiB) TX bytes:1069634 (1.0 MiB)
Interrupt:217 Base address:0xa800

eth1 Link encap:Ethernet HWaddr 00:1E:58:31:B3:EB
inet addr:192.168.100.96 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::21e:58ff:fe31:b3eb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2847 errors:0 dropped:0 overruns:0 frame:0
TX packets:2878 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1084873 (1.0 MiB) TX bytes:539141 (526.5 KiB)
Interrupt:209 Base address:0x2000
[root@wahyucentos ssh]#
[root@wahyucentos ssh]#system-config-network




Klik New, dan pilih xDSL connections, pilih ethernet 1(eth1)masukan username dan
password telkom.

Setelah itu, active kan ppp
Sehingga dapat di lihat seperti dibawah ini. Dapat di lihat bahwa, pppC dengan nama koneksi test sudah aktif.



Di atas, saya juga mengaktifkan eth1 dengan ip address lokal.

[root@wahyucentos ssh]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:8D:C3:39:7D
inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:8dff:fec3:397d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5990 errors:0 dropped:0 overruns:0 frame:0
TX packets:2161 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:825820 (806.4 KiB) TX bytes:1069634 (1.0 MiB)
Interrupt:217 Base address:0xa800

eth1 Link encap:Ethernet HWaddr 00:1E:58:31:B3:EB
inet addr:192.168.100.96 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::21e:58ff:fe31:b3eb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2847 errors:0 dropped:0 overruns:0 frame:0
TX packets:2878 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1084873 (1.0 MiB) TX bytes:539141 (526.5 KiB)
Interrupt:209 Base address:0x2000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1296 errors:0 dropped:0 overruns:0 frame:0
TX packets:1296 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2913220 (2.7 MiB) TX bytes:2913220 (2.7 MiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:125.xxx.xx.xxx P-t-P:125.xxx.xx.x Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:2629 errors:0 dropped:0 overruns:0 frame:0
TX packets:2617 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1013596 (989.8 KiB) TX bytes:460371 (449.5 KiB)

[root@wahyucentos ssh]#

Jangan lupa untuk setting iptables, dan forwarding agar, bisa di gunakan sebagai gateway. Atau kalau ingin menggunakan squid, bisa di installkan juga.

Tuesday, June 24, 2008

Delete mailbox on cyrus-imap

To delete mailbox on cyrus-imap you have to give permission. By default admin doesn't have permission deleting mailbox.


moonlight# cyradm -u cyrus localhost
Password:
localhost> lm
user.bafrin (\HasChildren) user.john.Sent (\HasNoChildren)
user.bafrin.Drafts (\HasNoChildren) user.john.Trash (\HasNoChildren)
user.bafrin.Sent (\HasNoChildren) user.wahyu (\HasChildren)
user.bafrin.Trash (\HasNoChildren) user.wahyu.Drafts (\HasNoChildren)
user.john (\HasChildren) user.wahyu.Sent (\HasNoChildren)
user.john.Drafts (\HasNoChildren) user.wahyu.Trash (\HasNoChildren)
localhost> dm user.john
deletemailbox: Permission denied
localhost>
localhost> lam user.john
john lrswipkxtecda
localhost> dm user.john
deletemailbox: Permission denied
localhost> sam user.john cyrus c
localhost> lam user.john
john lrswipkxtecda
cyrus kxc
localhost> dm user.test
deletemailbox: Mailbox does not exist
localhost> dm user.john
localhost> lm
user.bafrin (\HasChildren) user.wahyu (\HasChildren)
user.bafrin.Drafts (\HasNoChildren) user.wahyu.Drafts (\HasNoChildren)
user.bafrin.Sent (\HasNoChildren) user.wahyu.Sent (\HasNoChildren)
user.bafrin.Trash (\HasNoChildren) user.wahyu.Trash (\HasNoChildren)
localhost>

Friday, June 6, 2008

General IO error in openoffice using NFS

http://ubuntuforums.org/showthread.php?t=332043

Thursday, June 5, 2008

Buat jasperserver di satu server

Idenya sih, karena kita memakai jasperserver 2.1, dan ada beberapa aplikasi yang berjalan menggunakan DB postgresql 8.2 yang berbeda. Agar aplikasi report yang di pakai, bisa menggunakan satu server report(jasperserver).

Saya menggunakan jasperserver versi di bawah, karena untuk mempermudah saja, installnya.
Karena sudah bundle dengan MySql, dan tomcat.

jasperserver-2.1-linux-installer.bin


Installasi saya taruh di /home/jasperserver-2.1

[root@temo jasperserver-2.1]# ls
ant jasperctl.sh license.txt scripts
apache-tomcat java mysql uninstall
docs js-installer-version.txt releaseNotes.txt
ireport licenses samples
[root@temo jasperserver-2.1]#
/home/jasperserver-2.1/apache-tomcat/webapps

copy folder jasperserver ke jasperprc, jaspershp, jaspervr di sesuaikan dgn namanya.

Edit file2 berikut, di sesuaikan dgn kebutuhan.

[root@temo WEB-INF]#
hibernate.properties jboss-web.xml web.xml
[root@temo WEB-INF]#

Edit web.xml, edit bagian ini ...

JasperSHP UI application


webAppRootKey
jaspershp.root


Di samakan dgn DBnya mysql.

Untuk hibernate.properties
# Properties file with JDBC-related settings.
# Applied by PropertyPlaceholderConfigurer from "applicationContext-*.xml".
# Targeted at system administrators, to avoid touching the context XML files.

# Property that determines the Hibernate dialect
metadata.hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

metadata.hibernate.dataSource.jndiName=jdbc/jaspershp

Dan seterusnya.

Buat database di mysql.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| foodmart |
| jasperprc |
| jaspershp |
| jaspervr |
| mysql |
| sugarcrm |
| test |
+--------------------+
8 rows in set (0.03 sec)

mysql>

Edit file di :
/home/jasperserver-2.1/apache-tomcat/webapps/jaspershp/META-INF
nama file context.xml

auth="Container"
name="jdbc/jaspershp"
type="javax.sql.DataSource"
password="passwordnya"
driverClassName="com.mysql.jdbc.Driver"
maxIdle="30"
maxWait="1000"
username="usernya"
url="jdbc:mysql://127.0.0.1:3306/jaspershp?useUnicode=true&characterEncoding=UTF-8"
maxActive="20"/>


Restart apache tomcat, melalui manager.


note: bbrp langkah di lewati, spt, create db, import db data(import DB data dump harus di ganti sesuai dbnya [use namadbnya])

Wednesday, March 12, 2008

Install perl CPAN module

Cara install perl CPAN modul.
Masuk ke cpan shell:
[root@mis07 nightly]# perl -MCPAN -e shell
cpan> install DBD::mysql
Running install for module DBD::mysql
Running make for C/CA/CAPTTOFU/DBD-mysql-4.006.tar.gz
Is already unwrapped into directory /root/.cpan/build/DBD-mysql-4.006
Has already been processed within this session
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base..............ok
t/10connect...........ok
t/20createdrop........ok
t/25lockunlock........ok
t/30insertfetch.......ok
t/35limit.............ok
t/35prepare...........ok
t/40bindparam.........ok
t/40bindparam2........ok
t/40blobs.............ok
t/40catalog...........ok
t/40keyinfo...........ok
t/40listfields........ok
t/40nulls.............ok
t/40numrows...........ok
t/40server_prepare....ok
t/40types.............ok
t/41bindparam.........ok
t/41blobs_prepare.....ok
t/42bindparam.........ok
t/50chopblanks........ok
t/50commit............ok
t/60leaks.............skipped
all skipped: $ENV{SLOW_TESTS} is not set
t/65types.............ok
t/70takeimp...........skipped
all skipped: test feature not implemented
t/75supported_sql.....ok
t/80procs.............ok
t/insertid............ok
t/multi_statement.....ok
t/param_values........ok
t/prepare_noerror.....ok
t/texecute............ok
t/utf8................ok
t/warnings............ok
All tests successful, 2 tests skipped.
Files=34, Tests=656, 3 wallclock secs ( 2.74 cusr + 0.62 csys = 3.36 CPU)
/usr/bin/make test -- OK
Running make install
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.bs
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/INSTALL.pod
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/GetInfo.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Bundle/DBD/mysql.pm
Installing /usr/share/man/man3/Bundle::DBD::mysql.3pm
Installing /usr/share/man/man3/DBD::mysql.3pm
Installing /usr/share/man/man3/DBD::mysql::INSTALL.3pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
/usr/bin/make install -- OK

cpan>
cpan> install IO::All
IO::All is up to date.

cpan> q --> utk quit.

utk ganti mirror
cpan>o conf init

Thursday, March 6, 2008

How to install GRUB on the MBR

How to install GRUB on the MBR

GRUB (GRand Unified Bootloader)

Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software (such as Linux). The kernel, in turn, initializes the rest of the operating system (e.g. a GNU system).

GNU GRUB Homepage
http://www.gnu.org/software/grub/


Problem

"There is not a boot manager screen at all, it just boots right into windows but GRUB boot window does not appear. I cannot figure out to access fedora, I do not have a boot disk and need to know if there is someway to boot into fedora"

"I forgot to install GRUB, I didn't install GRUB in the MBR, I chose to install GRUB on the first track on the partition where I installed Fedora but that was not an active primary partition".

Solution

You have to install GRUB on the MBR (Master Boot Record). To do this just follow this steps:

(First of all, enter your BIOS setup and in BOOT Sequence window choose to boot with CDROM first.)

1) Boot with your Fedora Core Installation CD 1.

2) Type "linux rescue" at the prompt.

3) Answer the questions about keyboard and language.

4) Tell the rescue mode to use your proper partition to mount (the one that you want to get booted into)

5) When you come to the console prompt type: chroot /mnt/sysimage

6) Type grub

7) Set the GRUB's root device to the partition containing the boot directory like this:

grub> root (hd0,0)

Filesystem type is ext2fs, partition type 0x83

I have Windows 98 in hd0,0 ; Windows XP in hd0,1, Fedora Core /boot partition in hd0,2 and Mandrake /boot partition in hd0,6. So in my case the command should be: > root (hd0,2)

If you are not sure which partition actually holds this directory, use the command 'find' like this:

grub> find /boot/grub/stage1

This will search for the file name '/boot/grub/stage1' and show the devices which contain the file.
Once you've set the root device correctly, run the command 'setup'.

8) Then, run the command setup

grub> setup (hd0)

Checking if "/boot/grub/stage1" exists....... no
Checking if "/grub/stage1" exists....... yes
Checking if "/grub/stage2" exists....... yes
Checking if "/grub/e2fs_stage1_5" exists....... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"....... 15 sectors are embedded
succeded
Running "install /grub/stage1 (hd0) (hd0) 1+15 p (hd0,2)/grub/stage2 /grub/grub.conf....... succeded
Done


This command will install GRUB boot loader on the Master Boot Record (MBR) of the first drive.

9) Type quit

grub> quit

GRUB is now in the MBR.

10) Finally, you'll have to edit your /boot/grub/grub.conf, for example whith nano:

> nano /boot/grub/grub.conf

(/etc/grub.conf or /boot/grub/grub.conf or /boot/grub/menu.lst, they are the same file) This file has the boot partitions of the disk/s.

11) Restart your PC without the Fedora Core CD 1 Installation.


My grub.conf

default=0
timeout=30
splashimage=(hd0,2)/grub/splash.xpm.gz

title GNU/Linux Fedora Core 1 (2.4.22-1.2188.nptl)
root (hd0,2)
kernel /vmlinuz-2.4.22-1.2188.nptl ro root=LABEL=/ hdc=ide-scsi hdd=ide-scsi apm=off acpi=on vga=788
initrd /initrd-2.4.22-1.2188.nptl.img

#title GNU/Linux Fedora Core 1 (2.4.22-1.2174.nptl)
#root (hd0,2)
#kernel /vmlinuz-2.4.22-1.2174.nptl ro root=LABEL=/ hdc=ide-scsi apm=off acpi=on rhgb
#initrd /initrd-2.4.22-1.2174.nptl.img

title GNU/Linux Mandrake 9.2
kernel (hd0,6)/vmlinuz root=/dev/hda8 devfs=mount hdc=ide-scsi resume=/dev/hda9
initrd (hd0,6)/initrd.img

title Microsoft Windows 98 SE & XP Pro
rootnoverify (hd0,0)
chainloader +1




List of commands,

default=0
My default boot system is, of course, Fedora.

timeout=30
Fedora will boot in 30 seconds if you don't touch anything.

splashimage=(hd0,2)/grub/splash.xpm.gz
Generally the splash image is in your /boot partition. In my case, hd0,2 is where I have the image.

title GNU/Linux Fedora Core 1 (2.4.22-1.2174.nptl)
The name of your OS that will appear in your menu at starup, you can write anything you want.

root (hd0,2)
This is your /boot partition specifies which partition contains your Linux kernel image. So "root (hd0,2) tells GRUB that the kernel is on the 3rd primary partition of my first hard disk (I have two), in my case (hd0,2).

kernel /vmlinuz-2.4.22-1.2174.nptl ro root=LABEL=/ hdc=ide-scsi apm=off acpi=on rhgb
Tells GRUB where to find your kernel, my kernel version is 2.4.22-1.2174, you have to type your kernel version.

rhgb
Red Hat Graphical Boot

apm=off acpi=on
I had to add 'apm=off acpi=on' to my kernel parameters to get power-off to work properly.

initrd /initrd-2.4.22-1.2174.nptl.img
Tells where your init ramdisk image is located.

title Microsoft Windows 98 SE & XP Pro
As I said, I have Windows 98 in hd0,0 and Windows XP in (hd0,1).

rootnoverify (hd0,0)
rootnoverify tells GRUB to boot from the Windows partition, but not to attempt to mount it.
(hd0,0) is where Windows XP puts the boot.ini to boot into Windows 98 and XP.

chainloader +1
chain-load is the mechanism for loading unsupported operating systems by loading another boot loader. It is typically used for loading DOS or Windows.
chainloader tells GRUB to chain to Windows' boot loader which will start Windows.

Other options you can use:

map
If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one.

Map the drive from_drive to the drive to_drive. This is necessary when you chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. Here is an example:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

This performs a virtual swap between your first and second hard drive.

Caution: This is effective only if DOS (or Windows) uses BIOS to access the swapped disks. If that OS uses a special driver for the disks, this probably won't work.

makeactive
Set the active partition on the root disk to GRUB's root device. This command is limited to primary PC partitions on a hard disk.

Code:
title Windows 98 SE
map (hd0) (hd1)
map (hd1) (hd0)
makeactive
rootnoverify (hd1,0)
chainloader +1


hide
Hide the partition partition by setting the hidden bit in its partition type code. This is useful only when booting DOS or Windows and multiple primary FAT partitions exist in one disk.

unhide
Unhide the partition partition by clearing the hidden bit in its partition type code. This is useful only when booting DOS or Windows and multiple primary partitions exist in one disk.

Explanation and examples of the hide and unhide commands

If you installed more than one set of DOS/Windows onto one disk, they could be confused if there are more than one primary partitions for DOS/Windows. There is a solution if you do want to do so. Use the partition hiding/unhiding technique.

If GRUB hides a DOS (or Windows) partition, DOS (or Windows) will ignore the partition. If GRUB unhides a DOS (or Windows) partition, DOS (or Windows) will detect the partition. Thus, if you have installed DOS (or Windows) on the first and the second partition of the first hard disk, and you want to boot the copy on the first partition.

Here's how to create two installations of Windows, hda1 and hda2 or (hd0,0) and (hd0,1), using the commands hide and unhide.

For Windows 98 SE "My Entry":
Code:
title My Entry
unhide (hd0,0)
hide (hd0,1)
rootnoverify (hd0,0)
makeactive
chainloader +1


For Windows 98 SE "Family Entry"
Code:
title Family Entry
unhide (hd0,1)
hide (hd0,0)
rootnoverify (hd0,1)
makeactive
chainloader +1


I did not have to use the 'hide' or 'unhide' command 'cause Windows XP, 2000 or NT have a boot manager (boot.ini) included. So, I only had to point where this boot.ini is. In my case, Windows XP copies this boot.ini where Windows 98 is installed, (hd0,0)
You should definitely use the 'hide' or 'unhide' command if you have,for example, two installations of Windows 98 or ME.



If everything went just fine, voila, GRUB now becomes your main boot manager for your multi OS system.


GRUB and Linux Partitions

First of all, GRUB requires that the device name be enclosed with ( ). Please, note that the partition numbers are counted from zero, not from one.


(hd0) in GRUB = is hda in Linux
Here, 'hd' means it is a hard disk drive. The first integer '0' indicates the drive number, that is, the first hard disk.


(hd1) in GRUB = is hdb in Linux
The first integer '1' indicates the drive number, that is, the second hard disk.


(hd0,1) in GRUB = is hda2 in Linux
This expression means the second primary partition of the first hard disk drive. In this case, GRUB uses one partition of the disk, instead of the whole disk.


(hd0,4) in GRUB = hda5 in Linux
This specifies the first extended partition of the first hard disk drive. Note that the partition numbers for extended partitions are counted from '4', regardless of the actual number of primary partitions on your hard disk.


(hd0,5) in GRUB = hda6 in Linux
This is the first logical unit of the extended partition of the the first hard disk.


(hd1,0) in GRUB = is hdb1 in Linux
This is the first primary partition of the second hard disk.


Source : http://www.fedoraforum.org/forum/showthread.php?t=975
Copy Paste, without permission.

Thursday, January 24, 2008

Adding new Library PATH

I am getting error when I create postgresql database. The error is

error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory



then i just add the library of postgres to /etc/ld.so.conf


include ld.so.conf.d/*.conf
/u01/postgres/postgresql/8.2.0/lib

Then I run :
/sbin/ldconfig

Thats it.

Friday, January 11, 2008

Install Java di ubuntu

Install java di ubuntu 7.10.

Download java di, java.sun.com dalam bentuk bin.
http://java.sun.com/javase/downloads/index_jdk5.jsp

root>apt-get install fakeroot
root>apt-get install java-pakage

Kemudian "di sulap" jadi .deb dengan perintah (tidak boleh root):

userbiasa> fakeroot make-jpkg jre-1_5_0_12-linux-i586.bin

setelah semua proses selesai dengan menerima aggrementnya. maka akan di buat pakage debian. sun-j2re1.5_1.5.0+update12_i386.deb

userbiasa>su -l #untuk login ke root(install paketnya)
root>dpkg -i
sun-j2re1.5_1.5.0+update12_i386.deb
root>java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)


Selesai.

Tuesday, January 8, 2008

Recover Data From a dead hard drive using ddrescue

Recover Data From a dead hard drive using ddrescue

by @ 9:07 am. Filed under Backup

Like dd, dd_rescue does copy data from one file or block device to another.dd_rescue is a tool to help you to save data from crashed partition. It tries to read and if it fails, it will go on with the next sectors where tools like dd will fail. If the copying process is interrupted by the user it is possible to continue at any position later. It can copy backwards.


dd_rescue Advantages

Imagine, one of your partitions is crashed, and as there are some hard errors, you don’t want to write to this hard disk any more. Just getting all the data off it and retiring it seems to be suitable. However, you can’t access the files, as the file system is damaged.

Now, you want to copy the whole partition into a file. You burn it on CD-Rom, just to never lose it again. You can setup a loop device, and repair (fsck) it and hopefully are able to mount it.

Copying this partition with normal Un*x tools like cat or dd will fail, as those tools abort on error. dd_rescue instead will try to read and if it fails, it will go on with the next sectors. The output file naturally will have holes in it, of course. You can write a log file, to see, where all these errors are located.

The data rate drops very low, when errors are encountered. If you interrupt the process of copying, you don’t lose anything. You can just continue at any position later. The output file will just be filled in further and not truncated as with other Un*x tools.

If you have one spot of bad sectors within the partition, it might be a good idea, to approach this spot from both sides. Reverse direction copy is your friend.

The two block sizes are a performance optimization. Large block sizes result in superior performance, but in case of errors, you want to try to salvage every single sector. So hardbs is best be set to the hardware sector size (most often 512 bytes) and softbs to a large value, such as the default 16k.

Install dd_rescue in Debian

Install ddrescue using the following command

#apt-get install ddrescue

Install ddrescue in Ubuntu

sudo apt-get install ddrescue

This will complete the installation

ddrescue Syntax

dd_rescue [options] infile outfile

Now we will see how to use ddrescue under damaged disk

If you have a damaged hard disk /dev/sda1 and you have an empty space hard disk /dev/sda2 Now if you want to copy data from /dev/sda1 to /dev/sda2 use the following commnd

# dd_rescue /dev/sda1 /dev/sda2/backup.img

If you are using ubuntu linux use the following command

sudo dd_rescue /dev/sda1 /dev/sda2/backup.img

This copies an image of /dev/sda1 to sda2

Now you need to check the backup image consistency this will check for is there any problems with this image.

#fsck -y /dev/sda2/backup.img

If you are using ubuntu linux use the following command

sudo fsck -y /dev/sda2/backup.img

After finishing this checking you need to mount your disk image in to your other hard disk

#mount /dev/sda2/backup.img /mnt/recoverydata

If you are using ubuntu linux use the following command

sudo mount /dev/sda2/backup.img /mnt/recoverydata

This will mount all the data from the backup.img under /mnt/recoverydata now you can try to access the data it should work without any problem.

Restore image

If you want to restore this image use the following command

#dd_rescue /dev/sda2/backup.img /dev/sda1

If you are using ubuntu linux use the following command

sudo dd_rescue /dev/sda2/backup.img /dev/sda1

Copy Disk Image to remote machine using SSH

If you want to copy your disk image to remote machine over ssh you need to use the following command

#dd_rescue /dev/sda1 - | ssh username@machineip ‘cat /datarecovery/backup.img’

If you are using ubuntu linux use the following command

sudo dd_rescue /dev/sda1 - | ssh username@machineip ‘cat /datarecovery/backup.img’

This will be prompetd for password of the username you have menctioned in the above command after entering the password dd_rescue strats copying obviously it will take some time to copy over the network.

Possible Error

If you see the following error at the time of copying you can ignore this error

dd_rescue: (warning): output file is not seekable!
dd_rescue: (warning): Illegal seek

If you want to take this image in compressed format you can use the following command format

#tar zcvf - /dev/sda1 | ssh username@machineip ‘cat@@>/tmp /datarecovery/backup.tar.gz’

If you are using ubuntu linux use the following command

sudo tar zcvf - /dev/sda1 | ssh username@machineip ‘cat@@>/tmp /datarecovery/backup.tar.gz’

If you want to know more available options check dd_rescue man page