Deleting an unwanted distribution and partition

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Deleting an unwanted distribution and partition

Post by James Gribble »

Having used the LMDE 2 Betsy distribution for 6 years I have now installed Tricia and its home directory on two separate partitions (sda7 & sda8), and then transferred everything in the Betsy home directory to the new home directory. I’m glad to report that Tricia is working very well and I have not lost any significant data.

However, Betsy still resides on a separate large partition (sda5). I wish to delete this and the partition to free this disk space for the future. But how? Using gparted I am told that a partition cannot be deleted unless partitions with higher numbers are first unmounted or swapped off. When I attempt this I am told that I cannot unmount a partition that is in use. Any suggestions as to how I could proceed? For instance, is it possible to renumber a partition, say give sda5 the number 9?
User avatar
Pjotr
Level 22
Level 22
Posts: 15503
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Deleting an unwanted distribution and partition

Post by Pjotr »

How about a clean slate with the latest and greatest: backup your documents etc. on an external medium, boot from the Mint 20 DVD / USB thumb drive, launch GParted, wipe all existing partitions on the hard drive, launch the installer and give it the entire disk.
Tip: 10 things to do after installing Linux Mint 20 Ulyana
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Petermint
Level 6
Level 6
Posts: 1130
Joined: Tue Feb 16, 2016 3:12 am

Re: Deleting an unwanted distribution and partition

Post by Petermint »

The clean install option is a good recommendation. The other thing you can do with a download of LM 20 to a USB stick is to use the LM20 live boot to run Gparted. You can make your partition changes because everything on your hard disk can be unmounted.

Backup. Backup. Backup your backup. Make the change.
User avatar
dm999
Level 3
Level 3
Posts: 117
Joined: Sun Dec 01, 2019 1:04 pm

Re: Deleting an unwanted distribution and partition

Post by dm999 »

I'd go for the slash and burn option too, however...

If you go for the Gparted option then run the Boot Repair tool on the live USB afterwards to fix your Grub menu entries.
LM 20 Xfce / Lenovo ideapad 500 15ISK / i5-6200U CPU @ 2.30GHz × 2 / 12GB RAM /
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

James Gribble wrote:
Tue Aug 04, 2020 4:56 am
... I am told that a partition cannot be deleted unless partitions with higher numbers are first unmounted or swapped off.
I take it swap is sda6? In any event, part of the problem is that a live session utilizes a swap partition if available, so it's in use for GParted purposes even though you booted from "outside." You can solve that particular problem by right-clicking and selecting swapoff.

That said, redoing the partition table by deleting sda5, moving sda7, and expanding sda8 will take a very long time, hours and hours. It will be much faster and more reliable to do as other have suggested. Copy out the home partition (GParted can do that), then reinstall and copy it back in.

Note that, when you go to redo the partition table for the reinstall, you'll probably have to swapoff sda6.
acerimusdux
Level 4
Level 4
Posts: 343
Joined: Sat Dec 26, 2009 3:36 pm

Re: Deleting an unwanted distribution and partition

Post by acerimusdux »

Why not just leave /sda5 there, but reformat it so that you have all that drive space for future use?

You can either back everything up to recreate your partitions. Or, maybe just use that space from within Tricia by keeping /sda5 and mounting it somewhere at boot, depending on what you want to use it for. You could store all of your videos there, for example, and mount it as /media/Videos.
Petermint
Level 6
Level 6
Posts: 1130
Joined: Tue Feb 16, 2016 3:12 am

Re: Deleting an unwanted distribution and partition

Post by Petermint »

Lots of guesses about the other partitions. sudo fdisk -l or equivalent.
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

I’m very grateful for the responses received from forum members. The consensus suggests the way forward should be a radical sweeping of everything now on the hard drive, prior to the installation of Mint 20 with new partitions as required. I have in mind a boot partition of 4 GB (as at present), a root partition (of, say, 100 GB – is this too large?), a Home partition of approx 300 GB (or more? - my hard drive is 465 GB), and a swap partition of 4 GB (as now in sda6). Does this sound right? (There are also four untidy small fragments of unallocated space on the hard drive – I look forward to seeing the end of these in due course.)

At what stage should the present swap partition be unmounted - and when remounted again? What will be the effect of unmounting it when further operations are still to be carried out? Is there a potential problem here? Also, I have Timeshifts of Tricia available. But would these disappear with the sweeping of the hard drive, leaving me high and dry and unable to retrieve Tricia in the event of a major disaster?

It was suggested that Gparted could be used to copy out the Home directory before deleting sda8. My choice would be, if possible, to send Home temporarily to an external hard drive (WD Elements). What commands are to be used for copying out and copying back in? I have not used this before. Is it a better way than backing up all my data etc to WD Elements and later restoring from there?

At the back of these many questions is hesitation – I want to be sure of what I’m about before plunging into what look like deep waters. I’m generally ready to run, Mint 20 has been downloaded and is available on a DVD (works better with my computer than a USB stick counterpart). Your further advice would be appreciated.
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

Bear in mind, there's no need to do any of this. You could simply reformat the old Betsy partition and leave right where it is. No law says the OS has to be first partition on the hard drive. You could use the new partition for data files, or save it for installing another OS some day in the future.

If you want to go forward, Petermint made a good point. This is difficult to do in a vacuum. Please post a screenshot of how the drive looks in GParted. Or, if it's easier, run this command in Terminal and report the output using code tags:

Code: Select all

lsblk --output name,size,fstype,label,mountpoint
As for your questions, copying the home partition with GParted is relatively easy. Attach your USB hard drive; if it doesn't already have blank space (unallocated) at least as large as the partition you want to copy, clear the space. Right-click the current home partition, select Copy; switch back to the USB drive (there's a drop-down menu at upper right), then Paste in the partition. Almost identical to copy-and-paste with File Manager, except you need blank space on the target, not just available space. Only use this trick for ext4 partitions, by the way. GParted is very slow copying NTFS partitions.

Regarding Timeshift, sure, you can cover that base. Use the same USB hard drive. Create a 30 GB partition, format ext4 and label Timeshift-Backup. Boot Tricia; open Timeshift, select Settings > Location, and choose the partition you just set up on the USB drive. Create a manual (on demand) snapshot. Go back into Settings; restore original location for snapshots (on internal drive). Voila! Your new Timeshift snapshot (on the USB drive) is freestanding and can be used to restore the system. Notice I'm NOT copying any of the current snapshots. This way is easier, faster and more reliable.

Feel free to ask more questions, but we need the partition information before giving concrete advice.
Last edited by linux-rox on Fri Aug 07, 2020 12:09 am, edited 1 time in total.
Petermint
Level 6
Level 6
Posts: 1130
Joined: Tue Feb 16, 2016 3:12 am

Re: Deleting an unwanted distribution and partition

Post by Petermint »

As an example, my complicated notebook config :shock:

Code: Select all

lsblk --output name,size,fstype,label,mountpoint
NAME     SIZE FSTYPE LABEL MOUNTPOINT
sda    931.5G              
└─sda1 931.5G ext4         /
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

james@StudyPC:~$ lsblk --output name,size,fstype,label,mountpoint
NAME SIZE FSTYPE LABEL MOUNTPOINT
sda 465.8G
├─sda1 1.9G ext4
├─sda5 241.2G ext4
├─sda6 4G swap [SWAP]
├─sda7 139.8G ext4 /home
└─sda8 79G ext4 /
sr0 1024M
james@StudyPC:~$
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

What is sda1? Do you need it if you reinstall? If not, you can simplify the partition scheme considerably. Only need two partitions, system/root and home. Don't even need swap. Ubuntu/Mint uses a swap file now (was different a few years ago). For that matter, you don't need a home partition, as Petermint's partition table shows, but has advantages and easy enough to retain.

The point being, if you reinstall, don't duplicate this partition table. Instead, create system/root as a primary partition, ext4, 30 GB and label System. Copy in the home partition from the USB drive; label Home; resize, extending to the right to use all the available space (GParted can do this easily). Now, install Tricia, using the Something Else method, which will let you assign the Home partition (sda2) to mount at /home.* Reboot, open Timeshift and restore the snapshot on the USB drive, which will bring the new system up to where you are today. Done.**

* There's an annoying quirk in the installer, where it's not obvious how you assign mount points. First, you have to click "Use As" and pick ext4 journaling file system from a dropdown list. Now the mount point option will pop up. Assign sda1 to / (root) and sda2 to /home.

** Almost. Open Timeshift and change the location for saving snapshots to the home partition, sda2. Standard procedure when using separate root and home partitions.


Hope that helps. Or are you finding this kinda overwhelming? Honest, nowhere near as difficult as what you've accomplished already. You can do this.
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

You are being most patient and encouraging, thank you. sda1 is a boot partition which currently gives access to both Betsy (now no longer wanted) and Tricia. Do I understand you correctly that with a single distribution such as Tricia (now installed and in use) or Ulyana (which is where, I think, I want to go) a boot partition is no longer necessary? (Which raises another question: is Ulyana to be preferred to Tricia? My reading suggests that people have been having problems with Ulyana.) Furthermore, do I understand you correctly that a Swap partition is no longer a necessity?

I have turned to the Forum because my local Linux guru died a month ago. He it was who first installed Betsy on my computer (alongside Windows XP that I had been using) and has guided me over the past 6 years. Before his death we were exchanging many emails as he helped me to install Tricia. We were about to take on some further steps to tidy up my computer. I think some of the untidiness stems from the Windows partitions that were deleted to create sda7 and sda8 for the installation of Tricia. My friend taught me to look at the hard drive using sudo fdisk -l. Here is the result this morning:

james@StudyPC:~$ sudo fdisk -l
[sudo] password for james:
Disk /dev/sda: 465.8 GiB, 500106780160 bytes, 976771055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xe822e822

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 3905535 3903488 1.9G 83 Linux
/dev/sda2 3909630 976768064 972858435 463.9G f W95 Ext'd (LBA)
/dev/sda5 462575673 968376376 505800704 241.2G 83 Linux
/dev/sda6 968382198 976768064 8385867 4G 82 Linux swap / Solaris
/dev/sda7 169531392 462575615 293044224 139.8G 83 Linux
/dev/sda8 3909632 169528772 165619141 79G 83 Linux

Partition 2 does not start on physical sector boundary.
Partition 5 does not start on physical sector boundary.
Partition 6 does not start on physical sector boundary.
Partition table entries are not in disk order.

And this tabulation does not show the 4 small fragments of disk space scattered about between these partitions.
I see two possible routes ahead: (1) to do what Pjotr suggested, wipe all existing partitions on the hard drive, launch the Ulyana installer and give it the entire disk, or (2) your earlier suggestion to delete reformat sda5 (Betsy) and leave the partition there and available. (Reformatting as what? And will this delete Betsy?) Presumably I would then have to use Boot Repair to sort out GRUB?
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

You left out the middle option, where you reinstall with Tricia and restore with Timeshift. That's what I recommend, but the other two options also would be fine. Happy to answer questions about any of the three. As regards your latest questions.

1. Boot partition. Used to be recommended, but no longer needed (except if using encryption and/or LVM, logical volume management). If you reinstall, don't bother. Instead, /boot will be placed on the root/system partition.

2. Swap partition. Not needed. Ubuntu and Mint use a swap file now. This also will be placed on the root/system partition.

3. If you do Option 2 (retain current partition scheme and merely reformat sda5), you would use ext4. Same as now, but reformat is much quicker than trying to clear a partition by deleting files and directories. And, no, there will be no need to repair Grub. sudo update-grub will do it.

4. Ulyana vs Tricia. I take the view the first release of any operating system is an advanced beta. Problems always are found in the first few months because developers can't test everything or all hardware. Obviously you're not a cutting-edge user (were content with Betsy and only replaced because no longer supported), so Tricia will be fine. Only reason to install Ulyana I can think of is that it will be supported longer (until Apr 2025), so an extra two years before you need to think about the next reinstall. Also, should be easy to upgrade to 20.1 when it's released (reinstall not needed).

5. Before settling on Ulyana, if you're inclined that way, be sure to download the ISO and make sure it works on your computer. You mentioned XP. Is this a 32 bit or 64 bit computer? (If you're not sure, open Terminal and run inxi -SM.) If 32 bit, Ulyana isn't an option, as it only works on 64 bit.

I think that's everything. Your turn.
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

Your very prompt response today has cleared up a number of things that have been troubling me. I will leave Ulyana out of the picture for now and, taking the ‘third option’, will re-install Tricia (I have been happy with it) – but not before:
• copying Home to my external hard drive (WD Elements)
• creating a 30 GB ext4 partition on Elements called TimeShift-Backup
• taking a fresh manual TimeShift and locating it in TimeShift-Backup
• restoring the original location for snapshots on the internal drive.

Then, working from the Tricia download DVD:
• calling up Gparted
• unmounting/swapping off and deleting ALL existing partitions (including Boot and Swap)
• creating two new partitions System/root and Home (or does this come when re-installing Tricia at the point of the Something Else option?)
• exiting Gparted, and then proceeding with the fresh installation of Tricia from the DVD (I've done this before!)

Then: reboot - open TimeShift in Elements – restore the snapshot taken earlier – copy Home from Elements to the new large Home partition.
Presumably, GRUB will disappear and there be no need for a Boot Repair?

Your comment, please. Have I got it straight? Have I missed something? I'm about to step into water and needing to be sure that there are secure stepping stones just below the mysterious surface. Hence the need for a step-by-step recipe or road-map.
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

Your action plan looks good. Just a couple of tweaks.

1. Rather than delete the current partitions, create a new partition table (from Device menu at top of screen). You want msdos type, = MBR (as opposed to GPT). Then, yes, create the new partitions at this point.

2. Something Else is the option you choose for installation type. Remember the quirk about needing to select Use As before you'll see the mount option. You set the mount point for each partition separately.

3. Grub will be installed new, as part of the OS installation. With Something Else, you can specify exactly where. In this case, you want the default (sda).

Bear in mind, so long as your data files are backed up, there's not much that can go seriously wrong. Worst case, you do it again.
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

I'm happy to report that Mafeking has been relieved! My grateful thanks to those who responded to my question offering helpful suggestions. Linux-rox, in particular, has been most patient, affirming and encouraging, despite the many questions I kept coming up with. The final result is that the Betsy partition no longer exists, and the last vestiges of my earlier Windows XP installation have also gone with the wind. I re-installed Mint 19.3 Tricia, having decided to wait for a while before possibly updating to 20 Ulyana. In the process I have lost none of my files, not even the Thunderbird address book. If, beforehand, my hard drive looked like a dog's breakfast, now it is beautifully tidy and ordered with just the two necessary partitions. What's more, the computer is now far more responsive and nimble. I'm pleased, pleased with myself, and indebted to the generous wisdom of others
User avatar
Pjotr
Level 22
Level 22
Posts: 15503
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Deleting an unwanted distribution and partition

Post by Pjotr »

James Gribble wrote:
Wed Aug 12, 2020 5:45 am
I'm happy to report that Mafeking has been relieved!
Meh. I'm with the Boere, the cousins of the Dutch: :P
https://www.youtube.com/watch?v=nlHqKJyo3GQ

But I'm glad you're all set now. When you want to upgrade to Mint 20, I recommend to do a clean fresh installation, not an in-place upgrade of 19.3: the "jump" in codebase is so big that an in-place upgrade regularly leads to problems.
Tip: 10 things to do after installing Linux Mint 20 Ulyana
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
James Gribble
Level 1
Level 1
Posts: 11
Joined: Mon Apr 27, 2020 5:12 am

Re: Deleting an unwanted distribution and partition

Post by James Gribble »

With my mixed SA ancestry I am partly for the Boere and partly for the English. Thanks for your suggestion of a clean installation should I choose to go for Ulyana. I have a raw DVD image available.
linux-rox
Level 4
Level 4
Posts: 395
Joined: Sun Jul 19, 2020 9:17 pm

Re: Deleting an unwanted distribution and partition

Post by linux-rox »

James Gribble wrote:
Wed Aug 12, 2020 5:45 am
I'm happy to report that Mafeking has been relieved!
Excellent, well done, and you're welcome.
Post Reply

Return to “Newbie Questions”