Hi Yustr,
First let me explain I know nothing about Ubuntu so I am at a disadvantage there.
The first thing I would do seeing as where it hangs is go to the hdd manufactures wesite and downlod their tools to run diagnostics on the drive. With these tools you can create a bootable floppy or cd to check the drive so its operating system independent.
If the drive passes the long test then you should download memtest86 to check the ram next
http://www.memtest.org/#downiso
Again use the bootable floppy or iso version for cd, let memtest run for at least 3 passes but if it shows nothing I think you should let it run for 4 hours or so to be sure.
One note though memtest should be run on each stick of ram individually meaning you are going to have to open the case and remove some ram sticks before running memtest if you have more than one stick installed.
Keep us posted on how it goes