13

When I was basically new to Linux (and I still quite am), I got a nice computer from my university, featuring a SSD (250 Gb) and a 2Tb hard disk.

I decided to use only Ubuntu, but I made the installation being distracted and I did it on the 2Tb hard disk, while I wanted it on the SSD. So now I have two partitions, one on the SSD and the other one on this 2Tb hard disk.

I need to free the 2Tb hard disk; I tried with GParted, but I don't get how to use it, plus it seems like this partition is locked.

How do I get rid of this useless partition? Do I just need to delete the linux-swap in order to be able to use the hard disk?

here what I see in Gparted

here what I see in Gparted

Anwar
  • 76,649
  • Your Ubuntu is on 2Tb disk. Freeing means deleting it. So, you're asking how do I clean the 2TB disk and install Ubuntu on 250GB SSD? Edit question to clear these – Anwar Sep 14 '16 at 16:06
  • 1
    @Anwar Looking at the mount point of /dev/sdb1 (/media/elisa/...), this is not Ubuntu's root partition. It only contains around 30GB of data (which might be worth to get backed up). – Byte Commander Sep 14 '16 at 16:14

6 Answers6

10

You can try to use fdisk from the command line. In your case, if you want to delete partition on /dev/sdb just type:

fdisk /dev/sdb

Then once fdisk is opened you can type "d" to delete and then select the partition(s) you want to delete. After you removed the partition(s) don't forget to write the changes (type "w").

One advice, do not do that if you didn't reinstalled your OS on /dev/sda (your SSD) or you won't be able to boot the computer then.

Ionut
  • 103
2

You must unmount a partition before you can delete it.

Currently /dev/sdb1 is mounted at /media/elisa/d91c....

If you right-click on the partition's entry in GParted, there should be an option "Unmount" in the context menu. Click it.

After that, you can modify or delete the partition as you wish.

Byte Commander
  • 107,489
2

First Let's remove some confusions

Every hard drive needs one or more partitions to be useful. Partitions are created when you create a filesystem on it. Most used partitions scheme is MBR. In MBR, you can have only 4 partitions in a disk. These are called Primary partition. If you need more than 4 partitions, You can make one of the 4 as Extended partition. This extended partition works as a container and it turn can hold more than 1 partitions. These partitions are called Logical partitions

In your GParted image, the first partition (bigger one) is a primary partition. And the Swap partition is a logical partition inside an Extended partition


Answer

If I understood your question correctly, You later installed Ubuntu on SSD, but you still have that 2TB disk with two partitions. 1 with 30 GB of Data and another is a swap (inside an Extended partition).

If you're trying to free the space of linux-swap thinking It's useless, Then I'd say not to delete that partition. Because Linux Swap is helpful for hibernating and 31 GB won't hurt much considering your disk size.

If you really want to remove the swap

If you really want to remove this swap, click on the swap partition, right click, select Swapoff. Then again select it, right click and use Delete to remove the partition.

You can then see that there is still a partition (extended partition) with empty space. Select that space, right click and select Delete again. This will clear the Extended partition

Now, select the partition with Data (bigger one), right click -> Resize/Move and in the new Resize Window, move the right slider to far right to fill the partition. Finally click Resize/Move button.

This will give you 2TB disk with only the single partition with Data.

Anwar
  • 76,649
1

First of all, a hard drive is useless unless its been partitioned, so I would recommend just keeping that partition unless you're never going to use that 2TB drive.

If it has nothing important to you and you really want it gone, however, then you can just reformat it with no partitions. I've never used GParted, but you can do this with the command line. Sorry if I underestimate your knowledge of a command line, but these instructions are about as cookie cutter as I can get:

  1. Fire up the terminal (Ctrl+Alt+T)

  2. Type or copy & paste the following commands. Hit Enter after every line to run them. Enter your super-user password when asked for it.

    sudo umount /dev/sdb1
    sudo dd if=/dev/zero of=/dev/sdb1 bs=512 count=1
    
  3. Close the terminal window.

This will unmount the partition and completely erase the part of the drive that knows its been partitioned. Hope this helps!

EDIT: Two other popular command line utilities for formatting disk drives are parted (GParted without the pretty interface) and fdisk, so @sebastienvg's answer would also work.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

Simply Run the following command

dd if=/dev/zero of=/dev/sda bs=512 count=1 conv=notrunc

and check it by lsblk command

0
  1. Install Ubuntu a second time on the SSD. Now you have two Ubuntu OSs, one OS on the SSD and the other OS on the HDD.

  2. Boot into the Ubuntu that you installed on the SSD.

  3. Install GParted application in Ubuntu.

  4. Open GParted and reformat the 2TB hard drive.

  5. Now you have only one remaining Ubuntu OS which is installed on the SSD.

  6. Open the terminal and update the GRUB 2 configuration file. The update-grub command is a script which runs the grub-mkconfig tool to generate a grub.cfg file.

    sudo update-grub 
    
karel
  • 114,770