Preinstalled partitions in new Dell XPS 9343

So there a bunch of partitions preinstalled on the hard drive of my XPS 9343. From what I've gathered, this is normal for OEM PCs (this is the first pc that I haven't built).

I'm trying to install Linux alongside Windows 10 and want to get rid of those partitions if possible. I'm not entirely sure what is what, and not sure if I delete them I will unwittingly delete system32 or something.

Here is a screenshot of the partitions:

From what can see the first 4 are the Windows boot manager, an OEM.... Driver Backup? , recovery, and the system partition. The empty space is what I'm reserving for Ubuntu. I have no idea what the partitions are after that. Possibly another recovery partition or something?
Is this a normal thing Windows does? Or is this Dell's handiwork?

I'm relatively new to Linux, and have only installed distributions on fresh / wiped drives. Any explanation would be greatly appreciated.

Edit: Most of the stuff I've googled is from 5 or more years ago, and they only have 3 or so partitions.

okay
Before I explain the partitions, you're going to be EFI booting so go get an EFI boot loader for your linux distro. Ionu where you get that. It's a linux thing, ask in the linux forum. What you're trying to do is place the EFI boot loader in the first partition (marked EFI) in the drive and then mess with your boot manager (either in OS or in software) to point to both the linux boot loader/manger and the windows boot manager so you don't clobber either.
If you have no idea what I mean.
1) Go download the rEFInd boot manager
Homepage: http://www.rodsbooks.com/refind/
Download page: http://sourceforge.net/projects/refind/files/latest/download
2) Dump the rEFInd files in the EFI partition as the rEFInd documentation indicates
mountvol s: /s
in an elevated command prompt to mount the efi system partition in windows automatically
3) Dump the linux boot manger/loader whatever files into the EFI partition under \EFI\LinuxIsAwesome\Boot\boot.efi
4) Reboot and make sure rEFInd can boot windows normally and detects the linux boot manager/loader
5) Install linux and somehow get it to not clobber your boot options, ask linux people about this

As per usual when EFI booting
1) The OS architecture must match that of the UEFI architecure
so like...go check windows...if it's 32-bit only install a 32-bit linux OS, If windows is 64-bit then only install a 64-bit linux OS
2) You may have to perform a voodoo dance to get your laptop to acknowledge the rEFInd boot manager.
files named a certain way, in a certain location, or specified in the boot manger manually (As in typed in manually)
or maybe your laptop has file browser to let you select the boot.efi file manually, w/e just be prepared for said voodoo dance
The default location for the boot manager your firmware is supposed to use is: \EFI\Boot\bootx64.efi
(or bootia32.efi for 32-bit systems)
so I'd rename the rEFInd to that and place it there and then reboot and cross my fingers. Do this before installing linux. The rEFInd boot manager should just chain-load the windows boot manager (\EFI\Microsoft\Boot\bootmgfw.efi) automatically. It's pretty awesome once your firmware gods have been sufficiently pleased.

Okay so your original question:
The basic (absolutely required) EFI partions structure is: [EFI][OS]
The basic EFI partions structure for dual booting windows is: [EFI][MSR][WinOS][Linux]
The basic MS recommended/required partition structure that includes recovery options is:
[EFI][MSR][RE][OS][Recovery]
I prefer:
[EFI][MSR][OS][Data][RE+Recovery]
your OEM did:
[EFI][MSR][RE][OS][free][RE][Recovery]

RE is short for Recovery Enviornment where windows keeps a small 300mb or so recovery file (winre.wim) to boot from for recovery stuffs. It's a good idea to have 1 RE partition. It's actually possible to dump the winre.wim into the main OS drive and have only a recovery partition (for the actual restoration files) with no RE partition at all. I like to merge the two cuz they are both for "recovery stuffs" and it's all minimalistic that way. Your OEM (dell) put 2 RE partitions AND a recovery partition. Your OEM is crazy, all OEM's are crazy, I'm crazy. I strongly recommend giving up concept of a "recovery" anything on that drive for windows and just dual booting with as close to the minimum complexity boot scenario for EFI systems using a unified boot manager.
so like: [EFI (which has rEFInd)] [MSR] [WinOS] [Linux]

So time to start deleting partitions!
go from: [EFI][MSR][RE][OS][free][RE][Recovery]
to : [EFI][MSR][RE][OS][free]
and right-click shrink the Windows partition to give the linux one enough space if you plan to treat it as an equal. Then linux can format it as it wants or whatever. Just don't let it clobber the existing boot options. If it does, then clobber them back! Copy back the rEFInd boot manager to the EFI partition.

That first RE partition is kinda nice to keep actually since you can just re-register the recovery enviornment by placing Winre.wim there with reagentc. If you want details on how to rebuild the recovery options later, I can give you advice on exactly how to do that using the windows built in tools but I need to know which version (7,8.1 or 10) and edition (home/pro), and architecture would be nice too (x86 or amd64). I'll update if I think of anything~

Oh yeah, I'd be nice to list exactly how to clobber a partition.

So OEM recovery options aren't really scalable since they tend to assume you haven't modified anything which is why I recommend just re-creating them yourself after linux is working. It's pretty strait-forward actually to create recovery options but automating the recovery can be a bit too much depending upon the exact windows version and if you want push button reset (pbr) to work and how much data you have.

So anyway: to stick with the efi thing delete everything past the OS drive and shrink the os drive.
elevated cmd prompt->diskpart
list disk
//only see 1 disk in the screenshot so there should only be one listed here, so select it
sel disk 0
list part
//the fun begins
//so like, there's no guarantee that the partitions are numbered sequentially, they could be "partition 1, partition 2, 3, 5, 6, 8" so you need to determine (by staring at both diskpart and the cmd prompt) and the list which partition number listed corresponds to what part of your disk, they could be sequential, don't chance it
//be sure you have the correct partition number based upon the size (450mb and 7130mb) then
sel part 8
del part
sel part 9
del part
//select your windows partition, whatever that is, check the size (200000)
sel part 7
shrink desired=50000
//create a new partition to fill up the free space
create part pri
exit
//let linux format it later when it installs

Wow. You have answered all my questions past, future and present. Thank you so much. This is a godsend.

Its gonna take a bit to work through all that needs to be done, but I have some remarks / questions in the meantime.

Firstly: Windows 10 Pro 64 bit. (who would be using 32 bit these days anyway??) Knowing how to rebuild a RE might be nice but don't go too far out of your way to explain. I'm still kinda confused about the difference between Recovery Environment (RE) and just Recovery (one for bulk data and one for something else?) partitions.

Secondly: I read in the README for rEFInd, and it said that the easiest way to install was to run the script, if in OS X or Linux. I can just run it via a Linux boot USB, right? No voodoo required?

Thirdly: If i need to hand it back for warranty, they would want it in original configuration, right? Is it a good idea to make a disk image of the whole drive and keep it safe if the "clobbering" breaks something?

Fourthly: Can I do all that resizing and deleting of the partitions in Disk Manager, or Disk / GParted in Ubuntu? Is there an advantage to doing it in elevated command prompt?

1) The Pro 10 version makes it easier to set up recovery features later provided there's not much data on the hard drive, even vhd recovery is workable. I can send you a link to a WinRE10x64.iso or you can create one with the recovery manager.

Recovery->create boot media (for usb)-leave system files unchecked or
Windows image recovery -> create recovery media (to burn a cd with winre on it)

A recovery image is a big file that windows uses to recover from when things go south and windows isn't fixable at all. It's a huge file usually 4-10GB in size and it sits on a recovery partition. That huge file can be whatever crazy format your OEM decided to put it in or a natively supported .wim or .vhd The default name for it is install.wim

Windows Recovery Environment (winre.wim) is a small (300mb) file that you're computer can boot from in order to start the recovery process. It has tools/scripts/a command prompt/custom OEM executables required to actually do the restore process using the larger install.wim or .vhd. Microsoft suggests into putting the recovery environment (winre.wim partition) [RE] into a different partition than the install.wim [Recovery] so that users can delete the install.wim [Recovery] partition to reclaim space without affecting their ability to have winre.wim accessible. Your OEM followed that advice, but then created a second RE partition (with their own custom tools and boot environment) prolly to recover the Restore image since they put it in some weird format.

2) Booting works like this.
Firmware -- FirmwareGods --- Hard disk --- BootManager ---- Boot loader

The firmware gods are a stand-in for the firmware coders. Each firmware is coded differently and you somehow need to tell the firmware to boot to the correct boot device, in the correct mode and using the correct file. The exact procedure for doing that is different for each computer. But if you're already booting from a usb or cd then you're already past the firmware stage and no additional voodoo is required.

The issue here is that you don't want to be dealing with this every time you boot. Deal with it once. Done. Move on. You could boot rEFInd from a usb or cd but the you'd need it inserted every time just to dual boot. It makes more sense to install it onto the EFI partition directly and deal with telling your firmware once-and-only-once to boot rEFInd. After that rEFInd will always take care of the boot options through software, easily configurable. Ignore the script. That's a .sh script for bash and is a linux thing.

To install rEFInd in windows (do this before installing linux):
1) mountvol S: /s
2) download from http://sourceforge.net/projects/refind/files/latest/download
3) dump the refind-bin-0.9.0.zip\refind-bin-0.9.0\refind\ folder into the \EFI\refind folder
so it looks like this:
\bootmgr (optional)
\bootmgr.efi (optional sometimes)
\EFI\boot\bootx64.efi
\EFI\microsoft\boot\bootmgfw.efi
\EFI\refind\refind_x64.efi
\EFI\linuxdistro\boot\somethingHere.efi

\EFI\refind should have lots of subfolders including drivers_x64. The rest, including the icons folder, are optional and can be deleted.

Now you need to tell the firmware to boot from it. So boot into the firmware F2 for Dell laptops I think and go to boot options and try to specify \EFI\refind\refind_x64.efi as the default boot entry. If you can't boot into the firmware or can't specify it or the firmware ignores the boot order and boots windows anyway or don't want to deal with it. Clobber the default boot entry at \EFI\boot\bootx64.efi by deleting it, renaming refind_x64.efi to bootx64.efi and copying\moving the contents of the refind-bin-0.9.0.zip\refind-bin-0.9.0\refind\ to \EFI\boot\ Before you delete it tho, make sure \EFI\Microsoft\boot\bootmgfw.efi existsIf it doesn't exist, then move and rename the default bootx64.efi so that it does. It's the same file.

Leave a copy of the refind-bin-0.9.0.zip in the EFI partition under root \ so you can always fix it later if the linux install decides to mess with the boot options.

3) For warranties, they general attitude is that the software is not warrantied. If you mess up windows use the restore features, either the integrated ones or the oem ones, and if that doesn't work it's not really their problem. The warranty stuff is mainly for the hardware and if the hard disk or memory goes bad it's still covered regardless of the software configuration provided you didn't open up the computer and mess with stuff. I would't bother creating a disk image but then again if it would give you peace of mind, go for it. Not really useful tho.

4) No difference. Use whatever partition deletion software you're most comfortable with. I like diskpart.

Hmm this is frustrating. I can mount the ESP partition fine but windows is denying me permission to open it. I force closed explorer and launched in an elevated cmd window (giving admin privileges), but same thing. I was able to open it when I booted up Linux on a thumb drive and mount the partition that way, but the EFI folder was locked too.

How do you get in? Weird that those googled solutions didn't work for me..

Yeah it's one of those things people should't be messing with so it's locked up tight.

Windows has 3 permission system things to keep people from messing with stuff.
1) UAC -easily disabled or turned to "off but still on mode"
prolly not the issue in this case, leave it

2) file/folder inheritable permissions
This is what's happening right now.


Let me know if need more info about them~

3) file/folder attributes
attrib -h -s S:\EFI
attrib -h -s bootx64.efi

There's the concept of "honoring permissions" in operating systems. Without going into detail, linux does not "honor" windows permissions and vice-verca which is why you can mess with it from a linux thumb drive.

There is no security tab for the ESD partition properties. Apparently that is only a NTFS thing. The partition is fat32

I looked up how to remove the policy with gpedit.msc but it isn't here, probably a windows 10 thing?

I cannot get into the ESD partition at all so there is no path S:\EFI.

Here are the error messages...

Hitting continue brings up...

Thanks for all the help. Don't know if i even could do this without it.

Edit: I found the group policy but it didn't help.

Oh you were right about the Fat32 not supporting the advanced file permissions. I'd never looked into that before. ty~

So you're seeing a UAC prompt. This is why the first thing I do after I install windows is disable UAC, causes too many problems in the long run.

UAC splits commands into user mode and system-wide mode and dynamically elevates stuffs. Sometimes that elevation fails like in command prompts (which don't support dynamic elevation) or in your case when accessing the system partition.

You have some choices:
1) (bad idea) disable UAC, and I mean to "off' mode, not to "off but still on" mode.
Not recommended because MS tied windows store apps to UAC and then in windows 10 tied windows store apps to the start menu. Thus, turning UAC to "off" mode instead of just "off but still on" disables the start menu. Can still log out and access settings, but the apps (that fill most of the menu) do not work.
Here's the command I don't recommend you use:
"reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system /v EnableLUA /t REG_DWORD /d 0 /f"
and then restart computer
0 means off, run the same command with a 1 to turn it back on

2) (Better idea) Start an administrative command prompt and copy the files you need to copy via commands:
mountvol D: /s //if not already mounted, you'rs is at D:
mkdir D:\EFI\rEFInd
robocopy C:\Users\User\Desktop\refind-bin-0.9.0\refind D:\EFI\rEFInd /mir
attrib -h -s D:\EFI\boot\bootx64.efi

with the command prompt at D:\ you can run "tree" or "tree /f" to look at the directory structure and check if everything is where it should be.

3) (lazy idea) boot linux and copy the files manually

So I did try (thinking I was smart) to use an administrative command prompt before, but I didn't use robocopy. Not sure if it was that that stopped me or something else. Looks fine now, according to what you mentioned the directory should look like. Except for the Linux boot manger/loader, that goes like this...

I tried to clumsily install Ubuntu before all this, to see how far I could get I guess. This left an empty Ubuntu directory (D:\EFI\ubuntu...) ready for me to put it in.

Time for me to sort out the boot manager then. After that, is that it for the EFI set up? Just install Linux now? Is there something special I have to do when installing Linux? Point the EFI in the right direction or something? Or is this a question for the help desk?

Assuming you have rEFInd working and managing the windows boot manager it's time to install linux~. Installing the right boot loader/manager for linux is done during the install itself. Make sure rEFInd is working before continuing.

Created a slideshow with pretty pictures~

https://picasaweb.google.com/108161123577323514694/EFIWindowsLinux_DualBootwith_rEFInd

When you get to the partition screen for the linux installer, select a more complicated layout "Something else" and create a ext4 partition mounted at root / and small swap space at the end (2-4gb). Specify to install the bootloader (it was grub in my case) at the EFI partition (/dev/sda1 for me).

In my case the linux installer reset the default boot manager from rEFInd to it's own personal boot manager, that showed both windows/linux so I had to go into the firmware and change the default back to rEFInd. My Windows install is not going to be dependent on the whims of some linux boot manager for booting. ewww

remember to update the config file for rEFInd:
admin command prompt and:
copy D:\EFI\rEFInd\refind.conf-sample D:\EFI\rEFInd\refind.conf
notepad D:\EFI\rEFInd\refind.conf
set the timeout to something reasonable, like 4 seconds

So now the problem has come up about the BIOS skipping the refind all together. I'm going to fiddle with it to get it right. Thanks for all the help. I'll post whether or not it was a success.

And the voodoo begins. Good luck! Remember exactly what you did to get it working since it might need to be redone post linux install.

Well, when I tried booting with the only boot option being refind, (windows and all that removed) the error message said something about not being able to secure boot. I turned it of and now its getting to refind.

Is this a safe thing to do? Will turning secure boot off hurt something?

EDIT: Secure boot is for preventing root kits and such from taking hold right? Should I be worried about disabling it?

Yeah secure boot is nice to have but not really appropriate for a dual-booting environment. Leave it disabled.

It just warns you if some of the early level OS stuff has been modified actually, not prevent rootkits from taking hold. The idea is to let you know something modified the OS so you can choose whether a reinstall is warranted or not. It's a red flag to get that warning randomly, since that could indicate a rootkit but since you know you are installing other boot managers and operating systems, the warning means nothing. It's purely optional to have, doesn't break anything to disable and not compatible with non-ms OS's unless you install a signed Linux kernel and the associated certificate into the EFI's nvram.

I've just installed Ubuntu and its working well. Just one weird error. At the end of the install, an error came up that said GNU or GRUB or something couldn't be installed (pretty sure it was GRUB), and that this would mean that Linux can not be booted. However, rEFInd found it ok, and it booted fine. Also it created 2 more random partitions, but that's meant for the Linux Help Desk. I'll probably not bother it with this without some solid research.

Thanks for all the help @Peanut253. You made it easy and I learnt a lot. Not just about windows, but UEFI, BIOS, and Linux also. Hopefully this thread can help others trying to duel boot on their OEM PC, with their abominable partition tables.