Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 924  / 2 Years ago, sun, june 19, 2022, 5:56:08

I have a computer with two internal hard disks. Initially, Ubuntu 16.04 was installed. I installed Ubuntu 20.04 on the other hard disk so I could gradually migrate everything. I have finished the migration and and happy with 20.04 and am ready to delete the partitions used for 16.04. But I am very inexperienced and nervous about doing this, so am asking here for the precise steps to take so that I don't screw up my 20.04 installation.
Here are the current partitions:


/dev/sdb - where 16.04 was initially installed
/dev/sdb1 - EFI System; 537 MB; FAT32
/dev/sdb2 - Ext4; 991 GB (encrypted)
/dev/sdb3 - Swap
/dev/sda - where 20.04 was installed
/dev/sda1 - EFI System; 537 MB; FAT32
/dev/sda2 - Ext4; 991 GB (not encrypted)

I obviously want to keep /dev/sda2 and want to replace the encrypted /dev/sdb2 with some other partition. I have no idea what to do about the two EFI partitions. I presume, but am not entirely sure, that the Swap partition is being used by both 16.04 and 20.04, so it should be left alone.
So, any help in the precise applications and steps to use to achieve my goal, which is to completely remove 16.04 and boot directly to 20.04, would be very much appreciated.
Additional diagnostic info:


    free -h
total used free shared buff/cache available
Mem: 15Gi 2.3Gi 4.1Gi 878Mi 9.1Gi 12Gi
Swap: 2.0Gi 0B 2.0Gi

swapon -s
Filename Type Size Used Priority
/swapfile file 2097148 0 -2

grep -i swap /etc/fstab
/swapfile none swap sw 0 0

df | grep -v loop
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8092712 0 8092712 0% /dev
tmpfs 1627296 1944 1625352 1% /run
/dev/sda2 959863856 375460708 535574940 42% /
tmpfs 8136472 641684 7494788 8% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 8136472 0 8136472 0% /sys/fs/cgroup
/dev/sda1 523248 7944 515304 2% /boot/efi
tmpfs 1627292 64 1627228 1% /run/user/1000

More From » 16.04

 Answers
5

The goal: remove 16.04 and unneeded partitions.


Note: Have good backups before changing anything.


Note: Answer based on given data. If incorrect data, then this answer would be incorrect.


Since:



  • /dev/sda is your current running 20.04 system



  • the swap on /dev/sdb3 is not being used by 20.04



  • the /swapfile on /dev/sda2 is being used by 20.04



  • /dev/sda1 is the EFI partition used by 20.04



  • /dev/sdb1 - /dev/sdb3 were being used by 16.04




You can:


Just wipe /dev/sdb by using gparted and laying down a fresh GPT partition table on /dev/sdb. Recreate new partitions as desired.




/swapfile


I'd recommend increasing your /swapfile from 2G to 4G.


Note: Incorrect use of the dd command can cause data loss. Suggest copy/paste.


sudo swapoff -a           # turn off swap
sudo rm -i /swapfile # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile # set proper file protections
sudo mkswap /swapfile # init /swapfile
sudo swapon /swapfile # turn on swap
free -h # confirm 16G RAM and 4G swap

Confirm this line in /etc/fstab... and confirm no other “swap” lines...


/swapfile    none    swap    sw      0   0



reboot                    # reboot and verify operation

[#2694] Monday, June 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
atchcommo

Total Points: 114
Total Questions: 130
Total Answers: 101

Location: Cook Islands
Member since Sat, Oct 16, 2021
3 Years ago
atchcommo questions
Fri, May 13, 22, 08:22, 2 Years ago
Wed, Mar 9, 22, 20:14, 2 Years ago
;