[SOLVED] Formatting an Internal HDD

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
adam_gungie
Level 1
Level 1
Posts: 4
Joined: Sat Mar 16, 2024 11:58 pm

[SOLVED] Formatting an Internal HDD

Post by adam_gungie »

Hello everyone! I recently just switched over to Linux Mint 21.3 Cinnamon from Windows 10 and I want to switch to Linux Mint for good on my device. Therefore I want to completely format an existing internal HDD to the Linux file system so I can store my Timeshift system snapshots. When I run

Code: Select all

lsblk
I get the following:

Code: Select all

NAME   MAJ:MIN 		RM   	SIZE 	RO 	TYPE 	MOUNTPOINTS
sda      8:0    	0 	931.5G  0 	disk 
├─sda1   8:1    	0   	529M  	0 	part 
├─sda2   8:2    	0   	100M  	0 	part 	/boot/efi
├─sda3   8:3    	0    	16M  	0 	part 
└─sda4   8:4    	0 	930.9G  0 	part 
sdb      8:16   	0 	238.5G  0 	disk 
├─sdb1   8:17   	0   	512M  	0 	part 
└─sdb2   8:18   	0   	238G  	0 	part 	/
The sda drive is what I want to format. I want to remove all four partitions and make it so that the whole disk just uses the Linux file system. I have tried using

Code: Select all

sudo -fdisk /dev/sda
but I get a scary message saying:

Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.


From what I understand I have to unmount the HDD? But I never mounted it to begin with? Could someone please advise? Thank you!
Last edited by adam_gungie on Mon Mar 18, 2024 11:26 am, edited 2 times in total.
1000
Level 6
Level 6
Posts: 1040
Joined: Wed Jul 29, 2020 2:14 am

Re: Formatting an Internal HDD

Post by 1000 »

1. You need to reinstall the system.
2. Prepare the image for installation - For example live-USB Linux Mint 21.3
3. Run system in live-USB
4. Install GParted if not exist.
Then you can remove from GParted what you want.

Warning:
- Best when " /boot/efi " and system " / " are in the same one hard drive.
- I don't know how is now, but the previous version of Mint only wanted a GPT formatted disk.
- Creating a new table ( msdos/GPT ) wipes the entire disk. After this, you need to create new partitions.

Check what you have
https://i.stack.imgur.com/gSqMt.png

You have two options to use or to create new table of hard drive: msdos or GPT.
4.1If you choose msdos , then system will installed, but without grub it will not run and system also.
( This is just a theory, I don't know if Linux Mint need GPT only )
You can get around this by installing a second Linux distribution which will detect both systems.
4.2 If you choose GPT then Linux Mint should work without problems.
5. You create descriptions for partitions, name and label.
This will make it easier for you to quickly recognize the partition in the future.
6. After creating the partition you exit from GParted.
7. You run the installer and use manual mode.
8. Select the partition where the system is to be installed and where EFI.
9. You check whether the system is working and whether the installer has not removed the labels and names.
You can use GParted again if you need change name of partition.

If you feel unsure, there are guides on YouTube.
Good luck.
Hawaiihemd
Level 4
Level 4
Posts: 409
Joined: Fri Sep 25, 2020 12:42 pm

Re: Formatting an Internal HDD

Post by Hawaiihemd »

To add to @1000's post:

The problem here is that your system as it it currently set up needs that sda2 partition. So you can not simply format that partition or the whole sda disk.

Probably fastest and easiest - while avoiding any confusion - would be to:
0) get your Linux Mint install media and boot it to the live session
1) backup your data
2) wipe both disks like this: sudo dd if=/dev/zero of=/dev/sdX bs=1M count=10 with x once being "a" and then "b".
3) start gparted and create a new partition table and ext4 partition on sda
4) shutdown, disconnect the "sda" disk, reboot to live session
5) reinstall mint on the remaining disk. Just go with the standard installation and not the "something else" option. Note that the system will now call this disk sda as it is the only one connected.
6) shutdown, reconnect the other disk
7) DONE
1000
Level 6
Level 6
Posts: 1040
Joined: Wed Jul 29, 2020 2:14 am

Re: Formatting an Internal HDD

Post by 1000 »

Yes, it's true, the system currently needs it to work
/ on sd (b) 2
/boot/efi on sd (a) 2
and these are two different drives.

I don't think he need to format both drives,
but of course there may be a problem in one case.

/boot/efi is on /sda
so the conclusion is that it is selected as the first hard drive in Bios / UEFI

---------{
If he install the entire system on the second disk (sdb)
The system will not wake up because sda is still set in Bios/UEFI.
Of course in Bios/UEFI disks have the manufacturer's name and model instead sd ... .
Changing the priority settings in Bios/UEFI will help

If he install the entire system on the first disk (sda)
Changes in Bios / UEFI will not be necessary because the system will work from sda
---------}

After installing the system, the user can remove the remnants of the old system.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Formatting an Internal HDD

Post by AndyMH »

The simple solution here is to just copy your EFI partition to your mint drive. Boot your install stick and run gparted:
  • check sdb1, from the size it looks like an EFI partition, if formatted fat32 it probably is. If so then delete it.
  • then copy/paste sda2 into the space created. It may appear as sdb1.
  • now goto sda2 on your old win drive and disable the boot and esp flags (in gparted right click, manage flags).
Reboot, does it work? Check mint is using the copied EFI partition, open a terminal and run df. You are looking for the partition mounted at /boot/efi.

If not, boot your install stick run gparted again and re-enable the esp and boot flags on sda2.

Assuming it all works and mint is booting from sdb, you are now safe to reformat sda.

If in doubt post a screenshot of sdb from gparted.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
adam_gungie
Level 1
Level 1
Posts: 4
Joined: Sat Mar 16, 2024 11:58 pm

Re: Formatting an Internal HDD

Post by adam_gungie »

Alright so I feel like I am being told three different ways for going about this.

While Hawaiihemd's suggestion seems like the most simple to me, I am not really willing to remove sda from my device since it is the one and only laptop I have right now and for the foreseeable future so I don't want to risk screwing something up in terms of hardware.

I want to try what AndyMH is suggesting but a lot of the information you said just sort of just flew past me. So let me try to understand what you had said. You want me to basically boot into a live environment using my install stick, run gparted and delete sdb1 (which actually holds another EFI partition). Then copy and paste the stuff from sda2 into sdb1. Then go to sda2 disable it by doing something. Then everything should be fine and dandy and I can safely format sda. Is that correct?
adam_gungie
Level 1
Level 1
Posts: 4
Joined: Sat Mar 16, 2024 11:58 pm

Re: Formatting an Internal HDD

Post by adam_gungie »

Never mind everyone. I got it working using AndyMH's suggestion and I must say it was actually much easier than expected. Thank you everyone for helping me.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: [SOLVED] Formatting an Internal HDD

Post by AndyMH »

Glad it worked, I'm not sure I could have provided a much simpler explanation.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Post Reply

Return to “Hardware Support”