1

I have a computer with two hard drives. The smaller one is a SSD. I accidentally installed Ubuntu on both drives. How do I safely remove the installation on the non-SSD drive?

This might help:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

NAME                         FSTYPE        SIZE MOUNTPOINT LABEL
sda                                      238.5G            
├─sda1                       vfat          512M /boot/efi  
├─sda2                       ext2          244M /boot      
└─sda3                       LVM2_member 237.8G            
  ├─ubuntu--vg-root (dm-0)   ext4        221.9G /          
  └─ubuntu--vg-swap_1 (dm-1) swap         15.9G [SWAP]     
sdb                                        1.8T            
├─sdb1                       swap         22.4G [SWAP]     
└─sdb2                       ext4          1.8T            
sr0                                       1024M            
2

How do I safely remove the installation on the non-SSD drive?

  • Boot into the OS you want to keep.
  • Install and start gParted (sudo apt-get install gparted if not already available).
  • Remove the partitions that point to the 2nd install. gParted will show you labels that identify the operating system. As a bonus: you can not delete mounted partitions so using the OS you want to keep locks those partitions.

From the list you posted I would say: remove sdb or (if you want to use it in this OS) format as ext4 and create a mountpoint.

2

Since you are booted into the SSD version, I'd simply say: repartition your /dev/sdb with the tools of your liking. (fdisk, gdisk, gparted, gnome-disks...)

However, I'm going to warn about two things.

a) You can see that your swap is used on that disk. I'd make sure that the swap is not used in your /etc/fstab any more. Do the following:

$ sudo blkid /dev/sdb1
/dev/sdb1: UUID="12345678-1234-1234-1234-123412341234" TYPE="swap"

Note the string between quotes for the UUID. Edit your /etc/fstab file and remove the line that looks like this:

UUID=2345678-1234-1234-1234-123412341234" none swap sw 0 0

This will tell your system to forget about that second 22GB swapfile. Reboot now, or, easier sudo swapoff /dev/sdb1.

At this point, the whole disk /dev/sdb is ununsed. Start partitioning it.

b) Unless you are absolutely 100% sure that you are booting from /dev/sda, reinstall grub before rebooting:

$ sudo grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

Obviously, the output is what my machine tells me. Yours will vary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.