Install Lion Through Mavericks from Scratch
Be sure you backup your files.
- Restart the computer and after the chime press and hold down the COMMAND and R keys until the Apple logo appears. Wait for the Utility Menu to appear.
- Select Disk Utility from the main menu and click on the Continue button.
- After Disk Utility loads select the volume (this is the indented entry, usually Macintosh HD) from the side list. Click on the Erase tab in Disk Utility's main window.
- Set the Format type to Mac OS Extended (Journaled.) Click on the Apply button
- When the process has completed quit Disk Utility and return to the Utility Menu.
- SelectReinstall OS X and click on the Continue button.
This will install the version of OS X you had installed.
The Recovery HD should be locked but still bootable. If it is not bootable then the problem is with the drive, but you have not provided sufficient information such as what the exact iMac model you have and what you have tried to do and how you did it. You need to provide the exact wording of any error dialogs you have received. You can try the following if the disk is locked due to permissions being set incorrectly;
Fix Permissions of a Locked Drive
Enter the following commands at the prompt. Press RETURN after each.
chflags 0 /Volumes/*
chmod a+rx /Volumes/*
You will need to boot from the Recovery HD to perform the above since you cannot start OS X.
Boot to the Recovery HD::
1. Restart the computer.
2. Immediately after the chime press and hold down the
"Command" and "R" keys together.
3. Release the keys when the Utilities Menu appears.
4. From the Utilities menu in the menubar select Terminal.
5. Enter the above lines in Terminal.