I am want to uninstall ubuntu(16.04), from my dual boot system and probably reinstall ubuntu or install kali(dual boot it with windows). I want to allocate more space to the already existing windows. I have 10 partitions and I want to figure out if any of these partitions can be freed(not necessary for windows) so that I can increase the disk space allocated to windows as well as allocate more storage to Kali.

- 23
- 1
- 4
2 Answers
If you remove partitions /dev/sda9
and /dev/sda10
(swap and Ubuntu), which you might want to do to remove Ubuntu, then you won't be able to just boot into Windows any more because GRUB (the bootloader which should be installed in /dev/sda10
) will be gone. If you then re-install Ubuntu, or another Linux, you'll be fine. You'll also be fine (be able to boot into Windows) if you delete /dev/sda9
but leave /dev/sda10
alone.
Currently, in Windows, (C: is probably /dev/sda5
) you probably have a D: and E: drives, and that would account for the extra partitions /dev/sda6
and /dev/sda7
. You'll have to see what files are there, if you have external backups, and if you still need/want those drives in Windows.
You shouldn't touch the other partitions.
-
-
@terdon deleting swap wouldn't make any difference to Windows, but that's not what I said. I only mention swap and Ubuntu partitions so that if OP decides to go with Kali, and then deletes swap and Ubuntu, they won't be able to boot any more. – heynnema Jul 09 '19 at 18:41
-
1Deleting swap would not, but grub menu is in ext4 partition. Since UEFI, you still should be able to directly boot Windows from UEFI boot menu and should make that first or default in UEFI before removing ext4 partition and grub boot menu. – oldfred Jul 09 '19 at 18:41
-
@oldfred if Windows bcdedit showed the boot path as
\EFI\ubuntu\shimx64.efi
then it probably still won't boot Windows. – heynnema Jul 09 '19 at 18:44 -
just a tiny doubt, output of the command fdisk -l and sudo parted would be the same right? I mean in terms to the referencing sda number?I ask this because the size column shows different values. – Random user Jul 09 '19 at 18:44
-
@Randomuser use
sudo parted -l
, that's probably easiest. The numbers differ becauseparted
uses MB, GB etc., whilefdisk
will show bytes. – terdon Jul 09 '19 at 18:47 -
-
@terdon re: your edit... If you then re-install Ubuntu, or another Linux, you'll be fine. You'll also be fine (be able to boot into Windows) if you delete /dev/sda9 leave /dev/sda10... how can you install Kali if you don't delete sda9/10 first to make room? At that point, you can't boot Windows. – heynnema Jul 09 '19 at 18:54
-
@heynnema yes, sorry, that wasn't very clear. I meant the start and end positions, not the "size" column. I am guessing that's what the OP meant by "different numbers" since otherwise the numbers should be identical. But on the systems I checked,
parted
uses GB while fdisk uses G which also results in slightly different numbers. – terdon Jul 09 '19 at 18:58 -
@heynnema I first read your sentence as suggesting that deleting the swap partition will break Windows, so I edited to clarify that only removing GRUB will affect Windows. And you can install without deleting anything at all, all you need to do is format during the installation process. But feel free to revert, I was just trying to make it clearer. – terdon Jul 09 '19 at 18:59
First, you need to figure out what each partition contains. We are only interested in partitions 5, 6 and 7 since 1 is the EFI system partition, 2,3 and 4 are some sort of diagnostic tool for Windows or your laptop or something like that. Not safe to delete in any case and not relevant since they're tiny. Partition 9 in your swap for Ubuntu, 10 is your Ubuntu's root (/
) partition (where your Ubuntu is installed) and 8 is Windows' recovery partition. So let's see what the rest are.
First of all, you will need to mount them. Open a terminal and run these commands:
Make the mountpoints. This will create directories
sda5
,sda6
andsda7
.mkdir sda{5,6,7}
Mount each partition onto its corresponding directory
for d in sda{5,6,7}; do sudo mount -t ntfs /dev/"$d" $d" done
Now, check the contents of each of them to figure out what they are and which ones you can delete. Just run
ls
:ls sda5 ls sda6 ls sda7
Once you know what's what, you can choose to delete and/or resize as desired.

- 100,812
-
Why not just boot into Windows and see what the NTFS partitions show? sda6/7 are probably drives D: and E: – heynnema Jul 09 '19 at 18:48
-
@heynnema dunno, because that's what the OP asked for. Presumably because if you've booted into Windows you won't be able to delete the mounted partitions. – terdon Jul 09 '19 at 18:50
-
So basically I want to replace the already installed ubuntu with Kali. So in order to do a dual boot and install it in the right partition I wanted to clearly understand what each partition contains. What @terdon says is logical. I'll mount and check. But does sudo parted give any clear indication as to which partition I should boot kali into to replace ubuntu? – Random user Jul 09 '19 at 18:56
-
@Randomuser if you're going to REPLACE Ubuntu with Kali, ultimately you'll need to remove sda9/10... but at that point, Windows won't boot until you install Kali and re-setup dual booting. – heynnema Jul 09 '19 at 18:58
-
@Randomuser if you just want to replace, don't delete anything at all. Just choose those partitions when installing Kali and tell the installer to format them. However, if you don't know this sort of basic commands like mount, do not under any circumstances install Kali! Kali is a tool for experts and many things are much harder there. If you just want to play around with security tools, just install the Kali tools on Ubuntu. – terdon Jul 09 '19 at 19:02
-
@terdon when I try to mount /dev/sda5, I face an error which states: The disk contains an unclean file system. Metadata kept in Windows cache refused to mount. Operation not permitted. The NTFS partition is in an unsafe state. Please refuse and shutdown Windows completely, or mount the volume with -ro read only mount option. – Random user Jul 09 '19 at 19:03
-
@Randomuser that's because Windows was not shutdown cleanly. Again... easier just to boot Windows and see what's mounted in D: and E: – heynnema Jul 09 '19 at 19:04
-
@Randomuser OK, then do what it tells you. This is because you haven't shut Windows down properly, but told it to hibernate instead. But anyway, that means that sda5 is your
C:/
. So now you know :) – terdon Jul 09 '19 at 19:04 -
-
-
@Randomuser then you will need to reboot into Windows and close it down cleanly. Just do as the error message tells you to. And really, really think about not installing Kali. You will have a lot of trouble with Kali. – terdon Jul 09 '19 at 19:07
-
@terdon so then sda6 and sda7 might be D and E. So to replace the current installation of ubuntu I'll have to choose sda9 or sda10? – Random user Jul 09 '19 at 19:09
-
@Randomuser a REINSTALL of Ubuntu would go into sda10. Keep in mind that swap can be a partition, like sda9, or a /swapfile. – heynnema Jul 09 '19 at 19:12
-
and @terdon, I'll go with your suggestion of not installing kali, instead I'll install the kali tools and get myself used to the kinda of env first. – Random user Jul 09 '19 at 19:13
-
-
@Randomuser good on you! Believe me, you will save yourself a lot of pain that way! And yes, to replace the current installation, choose sda10. You don't need to touch sda9 at all, any new Linux you install will also be able to use it as swap. You can also keep
sda10
, just make sure to format it when reinstalling. – terdon Jul 09 '19 at 19:15 -
The procedure would be to download the iso file, make the pendrive bootable and install it in the right partition. Right? Any blog posts that I can refer to? – Random user Jul 09 '19 at 19:18
-
@Randomuser thousands. Just search. Although if you don't want to switch to another OS, I don't see why you'd reinstall. You don't need to reinstall just to resize the existing partitions. Search for "resize partitions linux" or something. Anyway, please remember to mark one of these answers as accepted by clicking on the tickmark to the left of the answer. Preferably heynnema's, since he came first. That way, the question will be marked as answered and he'll get a little reputation boost as a thank you. – terdon Jul 09 '19 at 19:20
-
Actually my ubuntu got messed up a bit. And by messed up I mean ya i'll have to reinstall. And yeah sure I'll mark the answer as accepted. Thankyou both for the help:) – Random user Jul 09 '19 at 19:22
C:/
drive, but we can't tell which from this output. The other two will probably be your data partitions but, again, that depends on what you have stored on them. – terdon Jul 09 '19 at 17:12