I have 2 PCI-E 2.0 x16 slots in my motherboard. One works with x16, the other one with x4 only.
The x16 one is taken (Graphic card). I have a hardware-based raid-5 card, but that card's work slot is x8.
My question is, if I put that x8 raid card into my x4 slot, will it work?
But will it handle, let's say 6 drives? I'm afraid of data loss.
Doesn't matter how many drives there are. The PCIe interface width only changes the amount of bandwidth available for IO. This does not affect reliability or the number of drives that can be used.
An x4 interface is good enough for 20Gbps. If you use 6x 7200RPM HDDs, you might barely scratch 10Gbps if you use RAID0. Since you said you were worried about data loss, you will be using either RAID5 or RAID6 which means your array likely won't be pushing more than ~6Gbps, about a third the x4 slot's bandwidth.
So unless your controller has a quirk that makes it require a x8 slot for operation, there should be no problem with using x4.