Can i take an external USB drive with me on an international flight? Do they open or scan it, or go through its contents at an airport or during a customs security check? If it is allowed, do I have to carry it in my hand luggage or should I put it in my suit case?
Yes, you can. Pretty much every time I travel by plane I carry one or more external hard disks in my hand luggage. This has never been an issue, to the extent that, on occasion, my luggage does get searched by hand, as opposed to just by machine.
I very much advise against putting a hard disk, or any sensitive electronics for that matter, in checked-in luggage. The risk of it getting damaged is too high. And, airlines don't take responsibility for damaging such things when in checked-in luggage.
There are no restrictions on portable hard drives. You can carry as many as you like in your carry-on luggage.
All luggage is subject to search and inspection. Your hard drives are not physically opened and searched; however customs officials have the right to plug your drive in and search its contents for illegal material.
If they do this, depends entirely on the border you are crossing. I have been stopped at the Saudi border while they plugged in my hard disks (and, oddly, my xbox) to verify its contents.
I have traveled multiple times to Europe and South Asia without anyone blinking an eye.
Yet, my brother returning to the US after summer break for college had his laptop, external drives and phone checked.
With some "minor" exceptions, this is trouble-free. You are perfectly allowed to take a harddisk, however there is of course a but (that had to come!).
First, what you can take aboard is defined by the IATA guidelines (which are pretty liberal, you could even carry a knife if you have a justifiable reason (tool) as well as other pretty dangerous things)
.. and now it comes...
any local laws (which are pretty restrictive after 2001, and getting worse)
any arbitrary, haphazard change-without-notice rules set up by the respective airport
the controlling officer's discretionary power.
The officer does not have the right to confiscate your possessions or look what's on your harddisk (though of course it will be x-rayed, which is harmless) or anything of that kind but in an increasing number of rogue nations they do that anyway, and you are wise if you do not oppose to that.
Also note that "officer's discretionary power" means as much as: "fuck you, fuck your rights, and fuck the rights you think you have". Officer says you don't pass -- you don't pass. So, if being stranded is not a viable option, well... you know.
Second, there is customs/immigration. They are the much more serious threat.
Customs may want money for goods that you import, but more importantly they also check that you do not have anything illegal on you. Now that is not a problem because you aren't a smuggler or a criminal, right? You can be very wrong about that. Very innocent things can cause great grief (try your luck with a harmless salami in your bag in Singapore, or rather... if you are wise, you don't try).
You definitively want to read up-front if some kind of material ("porno" as well as anything related to sexuality (condoms, lingerie, dildos) comes to mind, but even things like "music", "political texts" or "CDs" or "chewing gum" can be illegal!) is forbidden in your destination.
Be positively sure that no similar material is on that harddisk, or check the destination country's import restrictions that it's allowed.
At immigration, you may very well have some guy copy the contents of your harddisk under some premise (terror, espionage, ... pick one). That shouldn't be legal, but it certainly is. And you bet that you don't want to know what happens if you refuse.
What's probably worst, you cannot back off. If the security guy doesn't like you, then in the very worst case you walk away. Fly another day.
The moment the customs officer says "let me see that bag" or the spy guy wants the data on your disk, you already have entered the territory and now it's too late. You are now subject to their legislation, there is no going back. Now you can only hope you did your homework right, and they're not finding anything illegal.
Customs do not normally (in some places they do, but usually not) search everybody. Checked-in luggage is in most places routinely x-rayed and searched with drug hounds (especially thoroughly on flights from particular origins) without you knowing, and before you even get to pick it up again. Getting your hand luggage searched, however, is rather unusual unless, I guess, you look like a criminal (I remember having that happen once in 30 years).
Depending on the location, you are either waved through right away (or officers are sleeping) unless you look suspicious, or being questioned in a standardized manner, and if the answer to every question was "No", you get an "OK, welcome Sir" (that's my experience anyway, your mileage may vary).
In any case, you definitely want to be truthful in your answers, for the odd chance that they do want to see.
If you are caught lying, the consequences are... well, let's say you don't want that to happen. Lying to the security guy and being caught is mildly embarrassing and means you miss your plane. Lying to a customs/immigration officer means you pay a 4-digit fine in the best case, or, in the worst case, spend 6 weeks awaiting your trial in a prison cell with 15 inmates and 10 rats (depending on where you are).