Saturday, April 9, 2016

Forcing a factory reset on a Dell computer - Performing the factory reset

If you still have the recovery partition intact on your disk, this will allow you (if it works), to force restore it to your had drive. You do not need this hack if you have a working Windows with a factory reset option that shows up, or if when you hit F8, either upon first or second reboot, you get the option to do a factory reset.

I am going to assume that you are reading this because all the easy ways to do the factory reset have failed.

To be safe, first back up your recovery partition, and anything else you want to keep. Doing a factory reset will delete your files on the hard drive.

You will need a Windows PE bootable flash drive. Instructions on how to make one here.

Once you have a bootable flash drive, it's pretty easy, if things work correctly.

Plug your Windows PE flash drive into a USB port and restart the computer. When the Dell logo appears, press F12 repeatedly until a boot menu appears. If you do not have a LEGACY BOOT menu, try to enable legacy boot options (see "Boot from recovery USB - take 3" on this post). If your USB Storage Device is not listed on the LEGACY BOOT menu, it means there is a problem with your Windows PE bootable flash drive (it is not bootable).


Use the arrow keys to select USB storage Device then hit [Enter].

Windows PE will start. At first it looks just like a Windows 7 installation (with the Windows is loading files bar, then the Windows is starting screen), but eventually, it opens to a grey background and a big command prompt window. Wait until the initialization command finishes and you have a blinking cursor at the prompt.

We are going to use a single imagex command to start the factory reset. Dell made what is called an image of the system. The original OS, all the settings, drivers, programs etc... that came with the computer are all packaged into a file called factory.wim. For newer systems, the image is so large that it gets split up. You may have a factory.wim, factory2.wim, factory3.wim. The first file, factory.wim is the one we need to launch. That file resides in the recovery partition, in the folder \dell\image. The rest of the recovery partition contains supporting scripts and files. The picture below is just to show you what is in the \dell\image folder (if you really want to know).


You need to know two things: 1) where you want to restore the OS and 2) where the factory.wim file is.

In a previous post, I covered how to backup the partition to an external storage device. If you have destroyed all the data on your hard drive and no longer have the recovery partition (but do have the backup), then you will need to transfer these files back to the hard drive first. This will be covered in subsequent posts.

To check whether you have a recovery partition on your drive and to assign a letter to it (if needed), see this post.

Now I am assuming your hard drive is properly formatted and has a partition ready to receive the OS. If it does not, you will have to prepare your hard drive first (again to be covered in subsequent posts).

You can use DiskPart (see this post) to find out what letter was assigned to the partition where the OS goes. If you have not messed with your hard drive too much yet, the partition labeled "OS" and with "boot" under Info is the one you want to restore the image to. Usually, that will be the C partition. But do make sure before proceeding.

I am going to assume you have your recovery files in the volume labeled as R. Exit DiskPart before proceeding.

To summarize: recovery files in R, OS goes on C. Insert your own letters and edit the imaging command below accordingly.

You may have read elsewhere that imagex is in the tools folder and that it needs to be ran from there. With the flash drive we created, that is not true and not necessary.

Give it a shot. type:
imagex

That will bring up a list of instructions on how to use imagex (but won't actually perform any task).


Ready? run the command (Remember to substitute the proper letters):
imagex /apply r:\dell\image\factory.wim 1 c:\

The process should start. I have a bunch of crap on the screenshot below because I ran the command wrong at first. If you get a bunch of output telling you how to use imagex instead of an "Applying progress" status, it means you typed the command wrong. Double check it. In my case, I forgot to type the "1". After I fixed that mistake, the process ran. A tip from Linux: if you do type the command wrong at first, hit the up arrow. It will bring back the command you typed originally and you can edit it, instead of retyping the whole thing.


Aaaand in my case it failed. I hope you have better luck, or that this at least got you closer to where you needed to be.

Hmm and it failed with Office15, which I don't even want. Bummer.

Forcing a factory reset on a Dell computer - Backing up the recovery partition

I am assuming you have your Linux live USB flash drive and your Windows PE bootable thumb drive. You will also need a thumb drive large enough to accommodate your Dell Recovery Partition (see this post to check its size). You will need a thumb drive with twice that size. My 12 GB somehow turned into 20 GB on my thumb drive. I am not sure if that is by design and part of the problem I encountered when trying to hack my factory reset (remember that I was not successful and that you are only trying this because you yourself have reached the bitter bottom of despair).

The idea is to backup the recovery partition to the external drive, format the hard drive, put the files back on it, and use Windows PE to restore the Dell Recovery image.

The instructions, for expert Linux users are all here. They are for expert Linux users, so I will fill in the details.

We are going to do a lot of boot-up from usb drives and some from hard drive, so review how to do that (scroll down to Boot from recovery USB - take 2)

First, boot into the Linux environment. To do that, insert the Linux Live USB into a USB port, and only that one (otherwise, things can get complicated) and boot from USB.

You should see a friendly, green desktop appear, kind of Windowsy.

The first program you want to find and launch is the file explorer (called Nemo, if you must know).

You can launch the file explorer by clicking on its icon. It is the right-most green icon in the picture above, taken of the bottom left corner of the screen (the icon to the right of the black square icon). There is a way to make these icons bigger, but we are not going to use Mint for long so we'll live with it.

If you want more windows of the file explorer, just click on that icon again. Use the file explorer to navigate to your hard drive if you still have files on it that you want to save. Linux defines file systems a little differently, so it may take a bit of poking around before you see familiar files and folders.

Open a window for your back up media and drag anything you want to save over before proceeding. That takes place of step 00 in the instructions for experts.

Since you are in file explorer, navigate to the external storage device that is big enough to put the contents of the recovery partition and create a folder called "dellrecovery". Next navigate to the root of the hard drive and create a folder there called "recoverypartition".

The next step is to backup the contents of the recovery partition on your hard drive to the folder you just created. We have to be careful with this step and it involves some hacking. The reason you can't just drag files from the recovery partition to your dellrecovery folder using the file manager is because 1) the recovery partition, being unnamed (unless you mucked around with it) does not show up and 2) we want to ensure that we copy everything and preserve their nature. That includes hidden files. There are Linux copy command flags that will catch all the hidden files and that will ensure that files permissions are preserved.

You need to open a command prompt, called "terminal" in Linux. Because it is used a lot by Linux users, there is a clickable icon for it. It is the black square right to the left of the file explorer. You get a new window every time you click on it.

For now open one terminal window. First, we need to mount the recovery partition. In order to be able to copy the files over, Linux is going to kind of copy the files that are in the recovery partition ot the recoverypartition folder you just created. Linux does not really copy anything over, but it will look like that to you. The contents of the recovery partition will show up in the recoverypartition folder once you type the command we are going to put together next.

Before you can put together the command, you need some info. We are going to get it from the Linux equivalent of Disk Management. In Linux, we use the program called "GParted". Click on the menu button and search for gparted. That part of the OS works a lot like Windows 7. GParted will show up among the programs. Click to open it and let it do its scanning.


GParted looks like this

What we are particularly interested in is the left most column that has items that read like "/dev/sda1". "dev" stands for device. "sda" refers to a hard drive. "sdb" (if present) often refers to an external storage device (or it may be a second hard drive). If you have lots of stuff plugged in, you could also see an "sdc".

Compare this output to the outputs you had from Disk Manager in Windows. If you do not have that, the size of each drive is a clue. Your goal is to find the device number for the partition on your hard drive where you created the recoverypartiton folder (i.e. "sda1").

Next, you need to determine the path to the folder on your external storage where you created your dellrecovery folder. You can read off that path from the file manager. Using the file manager, navigate to the recoverypartition folder. Go as far as to open that folder. Here is an example:

Find the button on the right I have highlighted and click on it. An address bar magically appears with something like:
/media/axk55/52987BC4987BA55F/Recovery
in it (yours will be different and will end with /recoverypartition if you faithfully followed the instructions up 'till now).

This is what you will need for the next step.

Now go to your terminal window and type
sudo mount /dev/sda1 /media/axk55/52987BC4987BA55F/Recovery

Except you need to customize it. Instead of "sda1", put the device number you noted earlier. And instead of the /media/axk55/.... path, use the one from the file manager. You can copy and paste, using the right button of the mouse (ctrl V does not work in the terminal window).

Hit enter. It may prompt you for a password, if you set one up (sudo gives you administrator rights on the command). Look on your desktop, a new drive should appear, called "recoverypartition" (I named mine Recovery instead). You can click on it to view the contents (empty at the moment).

Now we are ready to copy the files from the recovery partition into the Dellrecovery folder on the external storage device. My preferred method is to navigate to the destination folder (Dellrecovery) and then copy things over.

Open a new file manager window and use it to navigate to your Dellrecovery folder. Again, click on the magic button to get the patch to that folder. For instance, say it is:
/media/axk55/myflashdrive/Dellrecovery

In the terminal window, type:
cd /media/axk55/myflashdrive/Dellrecovery

Now you are in the Dellrecovery folder. You can check that by typing
pwd
The output should be the path to your current folder (/media/axk55/myflashdrive/Dellrecovery).

Now we do the copying. You should still have that path to the recoverypartition folder, the one we used in the mounting process. Type the command
sudo cp -Rfpv /media/axk55/52987BC4987BA55F/Recovery/ .

Notice I added a / at the end of the path. It's safer to do that, though in most cases, not absolutely necessary. Make sure to type the "." at the end of the command (with a space between the / and the .). The dot tells Linux to copy the contents of /media/axk55/52987BC4987BA55F/Recovery to your current location (in other words, "." stands for "here").

If you must know: sudo puts you again in administrator mode, cp means "copy", and -Rfpv are flags that tell Linux to copy absolutely everything without messing with any file settings and also to let you know what is going on. Then you have the path to what you want to copy and with ".", you are telling where to put that (in your current folder).

There will be output to the terminal so you know that stuff is getting copied over. Large files will take longer so at times, it will appear to pause. Give it a few minutes to finish. When it is done, the command prompt will reappear with a blinking cursor. And we have backed up the recovery partition.

Friday, April 8, 2016

How to create a bootable Windows PE flash drive

I learned about Windows PE just today, after I fought so hard with my Windows 7 installation thumb drive. Windows PE is so sweet. It stands for "Windows Preinstallation Environment". It is essentially a short cut to the command window tool that one can open with the regular Windows 7 installation drive, but also comes packed with extra utilities not available on the regular installation disk, such as imagex. Imagex is what we will be using at the very end to force the factory reset.

In order to create a Windows PE bootable flash drive, first you need to install WAIK on your healthy Windows 7 computer. WAIK stands for "Windows Automated Installation Kit" and it packs tools that IT personnel use to install Windows quickly on multiple computers. We only need it because it contains imagex and because it will allow us to create our Windows PE thumb drive.

Get it here, and make sure to get the one for Windows 7.

This is another iso file. You can burn it to a DVD and install off the DVD drive, or use a USB drive to install it.

If you got the USB thumbdrive route, you will need to use the Windows USB/DVD Download tool. There are other options, but this one is from Microsoft and is best for their product. I have personally tried Rufus and that failed, when the Windows USB/DVD Download tool worked.

The tool is pretty simple to use. Essentially. download it, install it, launch it and follow the instructions on the screens.

Once you have prepared your USB flash drive, you are not done. Remember that we wanted to install WAIK. Well now you have an installation disk for WAIK. WAIK is not an OS and does not require a reboot, nor is the USB bootable. If nothing launches, try to eject it and put it back into the drive. Or look for the setup.exe file or equivalent on the thumbdrive. Unfortunately, I did not document that part of the process, but I remember it being standard Windows.

Now launch WAIK. WAIK is always ran as an administrator and it is just a special version of the command prompt window. In your programs, look for "Deployment Tools Command Prompt" and right-click on it. Select "Run as administrator".

I have introduced the command prompt window in previous posts, the first one here. We are going to be using diskpart again, so that post is a good primer.

To create the bootable Windows PE disk, follow the instructions on this page. The are nice and clear (for once). I am reproducing them below only in case the page gets taken down.

Essentially, you want to copy and paste the following lines (commands) in the command prompt window, hitting [Enter] after each. Use the right button of your mouse to copy and paste. Each of these commands must be entered exactly as shown (aside from font). Every little symbol, every space or lack thereof. Welcome to computer hacking.

CopyPE.cmd amd64 C:\WinPE_amd64

DISM /Mount-WIM /WimFile:c:\WinPE_amd64\WinPE.wim /Index:1 MountDir:c:\WinPE_amd64\Mount

Copy “C:\Program Files\Windows AIK\Tools\amd64\ImageX.exe” C:\WinPE_amd64\Mount\Windows\System32\

DISM /Unmount-WIM /MountDir:C:\WinPE_amd64\Mount /Commit

The last command in the post produced an error message for me, because Windows randomly added quotation marks when I pasted the command. Watch for that:

Copy C:\WinPE_amd64\WinPE.wim C:\WinPE_amd64\ISO\Sources\boot.wim

Next you want to prepare your USB flash drive. It must be formatted a certain way. In particular, it needs to be formatted as FAT32. You may be able to use file explorer to do that, I have not tried. I used diskpart, as recommended in the original instructions.

You can use the same command prompt to run diskpart.
Launch the program and look at your disks by running the two commands
diskpart
list disk

Carefully identify which disk is your thumb drive. The best way to do that is by size.

Now select your thumb drive, partition and format it

select disk 2 (if the thumb drive is disk 2)
clean
create partition primary
list partitition (to double check)
select partition 1
active
format quick fs=fat32
assign

For me, I got some error messages after clean. If you do, try to proceed with the commands. It may do what you want it to do in the end. If all goes well, when you hit [Enter] after "assign", a window should pop up asking you what you want to do with your thumb drive. Click on "View folders".

Use file explorer the way you are accustomed to to copy files from the folder c:\winpe_amd64\iso to the usb drive. You will not be needing the rest. Your Windows PE flash drive is ready to go.


Forcing a factory reset on a Dell computer - gathering the essentials

I should say as a disclaimer that this did not work for me. I suspect because I had a bigger problem (still unsolved): Windows 7 can't find my SSD drive.

But if your computer came with a regular hard drive and the Dell Recovery partition is on that drive, you may be in luck.

First of all, if you deleted the Dell Recovery partition without further ado, you may despair now. This will not help you. You are left with a fresh install of whatever OS will work.

This how-to applies if
1) You still have the Dell recovery partition on your drive and
2) You have tried absolutely every mean under the Sun to do a factory reset (except this one).

To hack a factory reset, you will need
1) The Dell recovery partition intact on your hard drive
2) A spare computer running Windows 7 if yours, like mine, has been hijacked and destroyed by Windows 10
3) A Linux Live USB drive
4) A Windows PE USB drive
5) A third USB thumbdrive

There is a way to do it with fewer thumb drives, but it will be even more complicated.

First, let's gather the pieces.

To verify whether you have the original Dell partition on your hard drive, see this post. Take a picture of the disk manager window, the same way I did in my post. You will need to know what is what. Also, because it shows more details, use diskpart to list your partitions and take a picture of the output (see this post). For good measure, in addition to list disk and list vol, do a list partition. Record everything.

If your OS is broken and you can't boot into it, we will see other ways that you can check whether you have your recovery partition. You will definitely want to create a Linux Live USB drive. It will allow you to access the files on your computer and create a friendly environment where you can easily back them up - covered here.

If you do not have anything on your computer that is worth saving and you are a maverick, you can skip the whole Linux thing, it's for backup purposes. But if you do have a recovery partition on your disk, I highly recommend you back it up. Even if like me, you end up not being able to do the factory reset, it's always good to have it. And to properly back up the recovery partition, Linux is good.

So let's create a Linux Live USB. Here you have a choice between Ubuntu and Mint. Mint is my favorite at the moment, so I will use that, but Ubuntu (more popular) would work just as well and would be very similar on how you create and use the USB.

Linux is an alternate operating system, preferred by a small niche of computer geeks and astronomers. It has its kinks, but overall it works. It allows full control over the computer and new editions are relatively easy to use. I would say Linux has surpassed Windows in terms of being user friendly, because of nice improvements in the desktop environments of Linux and because Windows went downhill in that category. It is a light weight OS that comes in many flavors. The underlying OS is all the same, it's just the desktop environments that get slapped on top that differ. Mac users will adapt to Ubuntu more easily, while Mint has a desktop that looks more familiar to PC users.

Enough history. Let's make our Mint USB.

You will need to download an image of the OS and install a USB creator. This can all be done on your spare Windows 7 computer (or any PC really). But I will assume a Windows environment.

Download Linux Mint here. Unless you have an old computer, you will want to download the 64 bit version. Like they recommend, download Cinnamon. MATE is for Mac users. Once you get to the download page, pick a download mirror near you and click on its name. This will initiate the download of an iso file.

iso files are image files that traditionally were burned to DVDs by software like Nero. As a matter of fact, if you have a blank DVD and a DVD drive in your sick laptop, you can use that as an alternative to USB. But Linux runs beautifully off USB (not as fussy as Windows) and I will discuss the USB route.

Once you have downloaded the iso file, use a program to create a bootable Live USB drive of Mint. There are options, but one I like to use is unetbootin. It's a simple, compact program.

When you use unetbootin, you will want to click on the radio button next to "Diskimage" then click on the ... button and navigate to where you downloaded your iso file. You also need to select the USB Drive where you put your flash drive and then you click OK and watch the magic unfold. You will need a USB with a capacity of at least 4 GB.

The last piece we need is a bootable Windows PE flash drive. That's a little complicated, so it is worthy of a new post.





Thursday, April 7, 2016

Overcoming problems encountered when installing Windows 7 from a USB key

USB installations of Windows have been, in my experience, fussy. They rarely work out of the box.

If you have a DVD drive, it is best to make an installation DVD and use that.

But what if you do not have a DVD drive? Here are some problems I have ran into.

I should note that I am assuming that there is nothing left on your hard drive that you want to save (it will all get erased).

Problem: when you click on "Install now", you get an error message about missing drivers.
Solution (tried and true): see a previous post.

Problem: at least you get to this screen

but when you click "Next", it's a no go. You get the message "Setup was unable to create a new system partition or locate an existing system partition. See the Setup log files for more information".


Solution (work in progress): Copy the installation files to the hard drive, then reboot and run the installation off the hard drive.

Details:

First, we need to go to command prompt. Close the installation window, and say "yes" to canceling the installation. It's not going well anyway. This will kick you back to the "Install now" window. Find the small print "Repair your computer" at the bottom left and click that.


Select the first option on the screen (Use recovery tools...), then click next.


Select "Command Prompt"

You should now have a black command prompt window, in which you must enter some commands.

The following are instructions I found here and here, with some detailed filled in and explained.

First you need to prepare your hard drive for the files.

1) Type
diskpart

This launches a utility that allows to format disks and make partitions (more on this post).

2) Check that your hard drive is not gpt (not good for Windows 7). Type
list disk


If you have a * in the Gpt column, your drive is gpt and it needs to be changed to mbr for Windows 7 to work.

If there is a * in the Gpt column, then type
convert mbr

If you do a new list disk, the * should be gone.

3) Next type
list vol

This will show you the partitions on all the disks in your system (though your solid state hard drive may be missing - a battle for another day)

In particular, in the "Ltr" column, you may recognize drive letters that appear when you use file explorer in Windows. This is a good opportunity to note what letter is assigned to your thumb drive. You will need to know that.

If your c drive appears on the list and is already formatted properly (NTFS), you can skip the formatting and partitioning (steps 4 - 9) and exit diskpart.

4) Make 100% sure that you have identified the hard drive where you want windows and note its number (e.g. is it Disk 0 or Disk 1,...?). Type
select disk=0
if Disk 0 is your hard drive.

5) Now format that disk by typing
create partition primary

6) Look at your partitions now by typing
list vol

7) Note the number of your new partition (or volume) then type
select vol=1
if your new partition is under volume 1.

8) Now we are going to format that volume. Type
format fs=ntfs quick

9) Next type
assign

10) Now exit diskpart by typing
exit

Next you want to make your hard drive bootable.

11) Get on your thumbdrive by typing
d:
If your thumdrive was under letter D.

12) Now we are going to copy the contents of the thumb drive to the hard drive. Type
xcopy d: c: /e /h /k

13) Navigate to the boot folder on the thumb drive by typing
cd boot

14) To make your hard drive bootable, type
 bootsect /nt60 c:

We are done with that part. Close the command line window and click "Restart". When the Dell logo appears, hit F12 for boot options. Choose your hard drive and hit [Enter].

If the computer does not restart, boot with the USB thumb drive again and repeat the procedure above from the beginning until you get back to the command prompt window. You can skip the whole partitioning and formatting business. Go to step 14 and add the /force option to the command we typed. That is, type
 bootsect /nt60 c: /force

Note that the command will fail if you type the "/force" before the "c:". /force must go on the end of the command.

Reboot, see if you have better luck this time booting from the hard drive.

Wednesday, April 6, 2016

How to get a Windows 7 installation USB to work on a state of the art laptop

If you bought a laptop recently, it will come with nice, fast USB ports, called USB 3.0. Those are wonderful because they allow to transfer files to and from thumb drives and external hard drives fast. Installation USB thumb drives will also run faster.

Now say you love your new laptop but hate Windows 10 or 8. You have an installation USB drive for Windows 7. When you run the installation, you get the friendly "install now" button, but when you run the installation, you get the error message "A required CD/DVD drive device driver is missing".

The issue is that Windows 7 installation files do not include drivers for USB 3.0. Transitional laptops used to have an option in the BIOS for momentarily disabling USB 3.0 and reverting to USB 2.0. The newest laptops do not. What to do?

Here is the tip I got from Dell tech support. There is an Intel utility that modifies Windows installation images to make them able to run on USB 3.0 ports. It is not terribly difficult to use. You will need a computer running Windows and the installation thumb drive you want to modify. Insert the installation thumb drive in a port on that computer.

1) Go to https://downloadcenter.intel.com/download/25476/Windows-7-USB-3-0-Creator-Utility and download the zip file.

2) Right click on the downloaded file and select "extract" (or try double clicking it). This will extract 3 files to a folder. You need to run the executable as an administrator. Right-click on Installer_Creator(.exe) and select "run as administrator" in the pull down menu.

3) Click on the button with the ... on the right of the USB path box.

4) Expand My Computer by clicking the little arrow than click on the mount point corresponding to the USB drive

5) Click on "Create Image" and wait for it to finish. It tells you what it is doing in cryptic language and each step takes a long time, so give it time (something like 15 minutes overall).

When it is done, the installation thumb drive has been patched and is ready to use on a USB 3.0 port.

Monday, April 4, 2016

How to boot Windows 10 into a command window

Should you ever need it...

The F8 upon reboot may not work with Windows 10. Here is what you may have to do.

Start from within Windows. Right click on the power button to get options other than shutting down. Hold it, think, read to the end of this paragraph before proceeding. Now click on the restart option, while holding down the shift key (at the same time, scratch behind your right ear with your left pinkie toe while chanting Buddhist exorcism prayers - just kidding but it might help). Do NOT let go of that shift key, until the blue screen of life appears.


Click on the Troubleshoot tile. On the next blue screen, click on "Startup Settings". The next step is to click Restart, but don't do that just yet. First read to the end of this post to see what's coming. There are time critical steps.

Your computer will reboot, give you the friendly Dell logo, then may swing you into 2 seconds of terrifying despair by going blank. Then a new blue Startup Settings screen will appear. Now don't dawdle, otherwise Windows 10 will restart itself normally and as usual, ignore what you wanted. Then you get to do the whole restart dance all over again.


You have a few seconds to read down the menu and find "Enable Safe Mode with Command Prompt". Then press the number key corresponding to that option.

It will look like all is lost, as the regular Windows 10 login screen will appear. Do not let Windows 10 beat you into submission. Log in and have heart. If all goes well you will have one large command window on your screen.

If you don't know what to do with that command window, get rid of it by typing "exit" then hitting [Enter]. You will be back into familiar Windows. Windows will be happy too.

How to view what is on unnamed partitions

In a previous post I showed how to tell whether one had a Dell recovery partition on one's PC. This post is on how to view what is in that partition. This is the basis of more serious hacks. The partition is initially unnamed and hidden from view from the lay person for very good reasons so be very careful with the hacks on this page. We are getting into some advanced, dangerous stuff.

To view the contents of a hidden partition with a simple tool such as file explorer, it must be given a name. When you stick a thumb drive into a USB port, Windows immediately assigns a letter to that drive. This allows you to see it in file explorers. Then you can view the contents.

We are going to manually make Windows assign a letter to the recovery partition. This requires the use of the command prompt window and a neat, simple command line utility called DiskPart. For a complete reference, see here. It is a simple and intuitive utility. It can also allow you to fix broken thumb drives, see exactly what is on your hard disk and more.

While DiskPart is easy to use, it is perfectly possible to completely erase an entire drive by mistake by typing two words and hitting Enter. So be very alert. Pretend you are flying a fighter plane, or operating machinery that can chop off your arms in a jiffy... You get the point. Always read the commands you typed. Check and recheck where you are before hitting "Enter". And better yet, have a backup of your data on a spare hard drive not plugged into your computer when playing with DiskPart. And an OS recovery medium on hand. Scared yet? Let's proceed.

First we need to launch the command prompt window in administrator mode so we have full control (again, also full power to wipe out a drive). Go to the search box and type "command". Do not click on Command Prompt, but right-click and in the pull-down menu that appears, select "Run as administrator".


Windows will complain. Click "Yes". Now you have a friendly terminal window. The blinking horizontal cursor is inviting you to type a command.



After each command below, hit enter to execute. In what follows, type what is italicized then hit enter.

First we launch the utility. Type
diskpart
(and hit enter)

You need to wait a few seconds until DiskPart has started and is ready for your commands. You should see: "DISKPART>" with a blinking cursor in front of it. "DISKPART>" is called a "command prompt" (because it prompts you for a command).

Now we are going to list the hard drives installed in your computer. That's harmless. Type
list disk

You will see a list of your hard disks. You may have only one (but should have at least one).


With DiskPart, it is important to make sure one is on the correct disk and correct volume before running anything else than list commands.

Next we need to select the disk where the recovery partition is. If you have only one hard drive, this part is simple but still necessary. If you have more than one disk and you don't now which one to pick, go to Disk Management and look at the size and number of the disk that has the recovery partition (see my previous post).

Type
sel disk=1
if the disk you want to select is disk number 1. Otherwise, you would type "sel disk=0" if the disk with the recovery partition is disk 0. You get the idea.

DiskPart should tell you "Disk 1 is now the selected disk". If doing anything more advanced with DsikPart (such as formatting disks), make sure that it does. Then you can proceed. The next step is to list the partitions on that disk. DiskPart calls them "volumes".

Type
list vol

You now have a table that lists the partitions you can also see in Disk Management. But there is more details and it's more clear. Also, you can use DiskPart to manipulate partitions. We won't, other than assigning a letter.


Look for the volume that has for label "RECOVERY". I already named mine so in the column called "Ltr", it has an R. "Ltr" stands for letter. Yours should not have a letter assigned yet. We are going to give it a letter.

Before we assign a letter to volume 3 (in my case), we must select that volume. If your recovery partition is on a different volume, use the number of that volume instead in the following command.

Type
sel volume=3

DiskPart tells you "Volume 3 is the selected volume". It is nice that DiskPart speaks in clear English (and also understands pretty plain English).

Now we are ready to give it a letter.

Type
assign letter=r

Or any letter you want to use, that is not already in use (should not be C for example, as you probably already have that). R is good because it is so far down the alphabet that Windows is unlikely to use it for a DVD drive, a thumb drive or an external hard drive. Plus, it stands for "recovery".

If you make a booboo on the choice of letter (or change your mind), you can type
remove letter=r. As a matter of fact, once you are done viewing what is in that partition (I wouldn't touch the contents), you should remove the letter. Leave the terminal window opened so you can come back and do that easily (otherwise you will have to repeat all the steps above).

Now open file explorer. You should see a new "drive" called R. It's not really a drive, it's a partition on your hard drive you couldn't see before.

Miscellaneous how-to's


In my valiant fight to put Windows 7 back on my computer, I have read a number of tutorials and tried many things. Many of the tutorials were leaving it up to the user to figure out the detailed steps. Not too big a problem for me, as I would consider myself an advanced user. I documented every step of the way also for myself for future reference.

So here is a grab back of tricks. The below applies to Windows 10 modern PC's. All of this is easier on older OS and computers.

How you know you have an original Dell recovery partition on your computer

In the search box at the bottom left of the screen, type "disk". Choices appear. Under "Settings", we are interested in "Create and format hard disk partitions". Click on that. The Disk Management utility appears.





My laptop has two hard drives. One 250 GB solid state hard drive with the operating systems on it and one 1000 GB regular hard drive for storing files.

The recovery partition is on the 250 GB solid state hard drive (Disk 1). If you have only one hard drive, then it will be simpler. If you have more than one hard drive, the OS hard drive is the one that is all broken up into different parts. You are looking for a partition that is about 10 GB in size and that says "Healthy (Recovery)".

You will not see "Healthy (Recovery)" because it's chopped off. What you will see is "Healthy (Rec)". If you hover over the partition block, it expands the name and you can see "Healthy (Recovery Partition).

How to create a Windows recovery USB

In the search box, type "recovery". Select "Create a recovery drive". Tell Windows that when you launch an action you mean it by clicking yes in the pop up window. For safety, in the next window, leave the "Back up system files to the recovery drive" checked.



Follow the instructions on the screen. It this fails, use the Windows recovery tool on the Microsoft website.

When it asks "What do you want to do", select "Create installation media for another PC" then follow the instructions on the screen. It will take a while, as the files get downloaded first and then the installation USB is created.

How to boot from recovery USB - take 1

This, like everything else in Windows 10 did not work for me (at first). Even though I most definitely did not want that, I got rebooted mercilessly from my hard drive into Windows over and over again. But maybe you will have more luck. It eventually worked, not sure why.

And like everything else in Windows 10, it involves a long series of steps. Click on the Start button, Settings, Update & Security, Recovery on the left menu, then Advanced startup. Do not let the "Restart now" button intimidate you. It will lead to a restart, but not right now. You will get to make a few choices first. So be brave and click the "Restart now" button.


Click on "Use a device".


Make sure your installation USB is in the USB port then click on "USB Storage Device".


If you have a solid state hard drive it registers as a USB device (leading to much grief, see my previous post). That's the first item in the picture below. My USB thumbdrive is called "Mint" and that's what I would click on to boot into my thumb drive.


Boot from recovery USB - take 2

This is the simplest way, if it works. Restart your computer and hit F12 when the Dell logo appears, until you see a message in orange letter in the upper right corner that says something about a one time boot menu.


From the boot menu, choose what you want to do (USB Storage Device).

This method may only work in legacy mode (see take 3 below).

Boot from recovery USB - take 3

This is the more advanced, risky way (it will momentarily prevent Windows from booting). But if the above methods failed, that's all you've got. Make careful note of all the settings you are changing so you can put them back if you want to boot back into Windows normally.

Reboot the computer. When the Dell logo appears, press F2 until you see "preparing to enter setup" in orange letters in the upper right corner. This will take you to the UEFI settings.


Expand the "General" settings, click on "General Boot Sequence". What we want is to select "Legacy" under "Boot List Option". You will not be able to select that option, because first we have to go to "Advanced Boot Options" and check the box "Enable Legacy Option ROMs". Click "Apply" (that's important).


Once the box is checked and you applied your changes, go back to the Boot List Option. You should now be able to select "Legacy". Do that, click "Apply", then click "Exit". The computer will reboot. Do the F2 dance again until you come back to the UEFI setup menu. This time, the boot sequence menu has more options (and some you may not have, such a diskette drive).


Click on "USB Storage Device" then on the up arrow repeatedly until the USB storage device is at the top of the list. Click "Apply". MAKE SURE YOUR USB IS INSERTED IN THE PORT then click exit.

Your computer will reboot and launch your installation USB thumb drive.

Sunday, April 3, 2016

What they don't tell you about Windows 10

Early last week, I came into possession of a Dell Precision 7510 laptop. A pure beauty that came all installed with a perfectly fine installation of Windows 7... and a Windows 10 installation DVD. Even though the laptop does not have a DVD drive, so the DVD was entirely useless, it picked my curiosity. And you know what they say about curiosity and the cat.

I am still alive, even though over the last few days I have cried, laughed, and done both at the same time. I spent one day trying out Windows 10, 2 days trying to get it to do what I wanted it to do, and 5 days trying to get rid of it, without success. As it is, it still lords over my laptop. It is a self-healing virus. Even the factory reset is not working out of the box.

My options should have been, from easiest to hardest
1) Tell Windows 10 I hate it and ask it to give me my Windows 7 back
2) Do a factory reset of my laptop from Windows 10
3) Wipe out the disk and do a fresh install of Windows 7
4) Hack a factory reset

Everything failed.

1) failed because (I think), when I upgraded to Windows 10 and it asked me to pick between keeping some of my stuff and do a clean install, I did a clean install. I did not have any files at that point as my laptop was brand new and I know from experience that if possible, clean installs are better. They are... clean and less likely to cause trouble. So the option to switch back to Windows 7 did not appear on the menu

2) failed because Windows 10 destroys the ability to do Dell factory resets. So no option on the menu to do that either.

3) failed because of a more involved reason. My laptop, as I mentioned, comes without a DVD drive. While annoying, I thought that it would be a small problem. After all, most installs these day can be done off USB. Most, except Windows 7 on the latest hardware. My laptop, being state of the art, has USB 3.0 ports. Windows 7 installation thumbdrives can't run on USB 3.0. For a while, laptops came with the ability to momentarily disable USB 3.0 and run USB 2.0 instead. No longer. Not mine. So can't do a fresh install of Windows 7. One thing I haven't tried but suspect will also fail for the same reason is to use an external DVD drive. But the external DVD drive plugs into... a USB port. So that's why I don't think this will work.

[Update - indeed, no luck with external DVD drive. But I solved the issue. See this post.]

Another consequence of the USB 3.0 is the inability of the Windows 7 installation to find a solid state hard drive (which I have for the OS). From what I read, solid state hard drives are treated as external drives plugged into USB. So if the installation can't read the USB ports, it won't find the solid state drive.

The era has come where the hardware has moved beyond what is supported by Windows 7. So I think I was right in thinking that upgrading to Windows 10 would allow my laptop to run better.

The problem is, Windows 10 has gone way down the path of thinking that the user is a complete idiot. I do not envision myself fighting my OS every day. It's not good for my health and my sanity. I also suspect that Windows 10 is a half backed product. I was never able to get the secure wireless connection to my university network to work correctly (it required a re-install every time I woke my computer up). I had many other issues too numerous to count or recall, and considering that Windows 10 does what it wants and not what the user needs, it is hard to tell if I was dealing with bugs or intentional spitefulness on the part of the OS.

4) failed as well, even though I can proudly say that I put up a valiant fight (and learned a lot).

Now I am left with sending my laptop back to Dell. I have no idea how they got Windows 7 on it in the first place. But I want them to do that again. Another fight to look forward to.

[Update - I talked to Dell and they are sending me a USB installation stick for Windows 7. They assure me it will work, as they are pre-loading it for the necessary drivers to run on USB 3.0. We shall see.]

[Update - Well, they did not pre-load the proper drivers. So they are sending another one. A Dell recovery disk can't be patched for USB 3.0 after the fact.]

[Update - In the end, they had to send me a new solid state hard drive with a pre-loaded Windows 7 installation ready to run from bare metal.]

As for my next laptop, it may very well be a Mac, if Mac OS has not gone down the path of thinking the user is a complete idiot as well. Considering how many of my Astronomer friends use Macs and look happy, I am hopeful. Or I could wing it on Linux alone. Linux distros came a long way over the last 10 years. Lord knows what they can achieve over the next 5 years.

Friday, April 1, 2016

My fourre-tout blog

With 3 blogs already going and 2 of them marginally active, I really should not be starting a new blog, but I needed a place to write down random stuff. My first post is going to be a computer fix (keep fingers crossed). I haven't tried the fix yet, so I don't know that it will work.

"Fourre-tout" is from the french, literally translated "stuff everything". It refers to a duffel bag and how one packs it (stuff it).

So this is the blog where I will put whatever doesn't fit elsewhere. I foresee it as being a very sparse blog.