My old laptop's hard disk is broken so that I can't install OS on it. They told me there is a way to make your PC recognize USB flash memory as HDD? Is it possible? how to do that? thanks
The first thing to do is ensure your system can boot off of a USB drive. Most laptops made since 2000 or so can do this without an issue.
If you want to run XP from a flash drive, it's problematic and involved, but possible. Basically, you need to install BartPE - a modified version of XP (modified from your current installation) that supports being run off of removeable media. These are pretty decent instructions and you'll also want to check out the official BartPE website. You do need to perform this from an existing Windows XP system for this to work.
Not sure of a process to get full-blown Windows 7 running from a USB drive. This is among several of the guides that shows you how to make a Windows 7 PE USB disk, but it's really only suitable for recovery purposes and not general purpose use.
Debian installs fine on a USB drive using the normal install process. Remove the hard drive in your system or disable from BIOS, boot the Debian installer CD, and the only drive selectable should be the USB drive, which you can partition like an internal HD. I haven't tried this using the Ubuntu graphical installer but if you use the "alternative" iso which uses the Debian text-mode installer it should be the same process. Of course you may run into a problem with your USB drive suddenly acting as though it is disconnected - this has happened to me on several Dell laptops. Not sure if it is a driver or hardware issue, but good luck.
There's also many "live" distributions of Linux that can run from a USB stick and that are easier than the above method, but may not let you advanced things like full disk encryption. You'll generally have to prepare the drive on another working computer first.
First you format it as NTFS.
XP will require use of something like Barts PE to create a version that can may be able to boot.
If your laptop is relatively new, you can enter BIOS and select the boot device. This will let you boot ( depending on the age/quality of the BIOS ) from the internal HDD, CDROM, external CD device, USB device, or network card. Additionally you will be able to select the preferred sequence.
Any storage media is able to be booted. The "trick" lies in properly formatting the device.
General steps starting with the machine off: - attach external USB - power on - enter BIOS - vender specific key: del? F1? F12? look for the on-screen text intructions - change default boot device to your external USB device and make DVD/CDROM second - insert Operating System install dics - save changes in BIOS and reboot - proceed normally through installation choosing the external USB device as the target to install the OS onto.
MOST OSes will allow USB installation, but some wont. If it works, it works. If not you'll need to research more advanced topics of creating "live" boot media.