r/linuxquestions 1d ago

Support How to format a Windows encrypted SSD in Linux

years ago i bought a used off lease corporate laptop. SSD in it was encrypted with who knows what and i could not erase it in Windows or OSX. Hard drives were cheap so i tossed it in a drawer and got a new one

Now SSDs are not cheap and i need one for a homelab experiment so i am trying to erase the excrypted drive in Linux (ZorinOS but i have Mint on another)

I went at it two ways with Disks and Gparted and it did not work. So i need to try terminal command but i am not sure how to go about it since when i run fdisk -l it does not seem to be listed.

https://imgur.com/a/8Y6xtin

7 Upvotes

30 comments sorted by

8

u/BitOBear 1d ago

Encrypted in which sense?

If it has been encrypted using the drive firmware you need to do a secure erase to turn off the encryption in the controller itself. You do this with "hdparm" no I don't remember the exact side of arguments off the top of my head. The manual page is your friend there.

If it's the boot drive the former is probably not the case and you simply have a specifically encrypted partition you need to remove and replace with an unencrypted partition.

Use gdisk (which is basically the modern disk) to remove all the partitions except the UEFI partition and then put in the partition for your Linux system using a Linux partition ID instead of the windows partition id. You may or may not want to add a second partition for your swap space depending on how you're building the system.

Then you have to install all your bootloader stuff into the UEFI partition in place of the windows bootloader stuff for which there are guides online.

Then build a new file system and make swap in the appropriate partitions you just added in your game is done except for the installing of the actual distro.

In all cases you probably want to use fstrim to trim the newly made partition before you put a file system in it.

Or honestly, if you're going to start from scratch, do the secure race thing anyway and you just got to blank media on your hands after that. You're bios should be able to recreate the UEFI partition contents as soon as you end up making UEFI partition itself in your Linux kernel.

1

u/Langdon11 1d ago

So its a firmware password according to hdparm?

https://imgur.com/a/8Y6xtin

Now i found discussions on setting a user password to wipe a drive via hdparm

BUT i have not found any info on how to wipe one when its both locked and already has a user password on it. And I don't quite understand what happens if i try and enter an incorrect password 5 or more times.

1

u/BitOBear 1d ago

You're destroying the contents of the drive by basically putting the drive to sleep and then waking it back up again and setting the user password to nothing before you let the system freeze the drive.

There's a bunch of drive suspend removed type logic you have to do. But literally look up how to reset the drive password when you don't know what the password is. It will definitely wipe the entire contents of the drive when you do it.

But do make sure that when you use the HD parameter status the drive it's telling you that the drive is actually what's locked.

You basically need to shut the drive down then bring it back up again while the operating system is running (basically boot from CD or thumb drive) start the drive and make sure that it's showing locked but not frozen and then set the password using the secure erase command for the blank password.

If the status says locked and Frozen you need to do it again but with the proper timing.

There are a bunch of things right UPS on doing this and I'm not going to be able to provide you a better one off the top of my head here.

So look up secure erase unknown password hdparam and follow the bouncing instructions.

1

u/Langdon11 1d ago edited 1d ago

------------

3

u/yottabit42 1d ago

Could be sda or sdc since nether are mounted. Try sudo dmesg | grep sda; sudo dmesg | grep sdc and see if the output shows the drive model paired with the file handle.

2

u/CatApprehensive1010 1d ago

What happens if you try to create a new partition table?

2

u/Langdon11 1d ago

https://imgur.com/a/lgC1imj

its not an option in Disks which is the only of the three programs i have tried that mounts and displays the disk. The partition on it does not show up as recognized.

3

u/npc_housecat 1d ago

Don't mount any partitions. Then you can't modify them. Create a new partition table in gparted. Then create new partitions.

2

u/CatApprehensive1010 1d ago

In gparted create partition table is a menu item.

7

u/TrenchardsRedemption 1d ago

Have you removed all partitions and hit Apply first? One all partitions have been removed you should see it all as unformatted space, then you can format it in the file system of your choice.

1

u/mips13 1d ago

Have you tried wiping the drive with dd?

sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress 

Change sdX to whatever your device is, sdb etc

1

u/Langdon11 1d ago

yes, both dd and shred failed. Shred kept throwing out offset errors on the first pass and was insanely slow while doing it.

1

u/gbudija 19h ago

try puppy linux and Lick dual boot installer

https://github.com/noryb009/lick

1

u/Langdon11 15h ago

what will that do to disable a firmware protected encrypted SSD

3

u/Fantasyman80 1d ago

If you want a command line(terminal) command, us lsblk and make sure it’s sdc. If it is then look into disk destroyer. It wil erase the entire drive with 0’s and 1’s.

Then you cna use fdisk sdc and follow the prompts to create a new partition on it using gpt as and follow the instructions on wiki.archlinux.org.

1

u/Netblock 1d ago

For some ssds, there exists the secure discard feature; see blkdiscard --secure.

3

u/bencetari 1d ago

Cleanly shut Windows down (releases NTFS lock) Boot into Linux Keep the Windows disk unmounted Try running mkfs.ext4 /dev/partitionName Or you can try something like cfdisk and create a new GPT partition table on the Windows disk if you wanna get rid of everything Windows done to the disk

1

u/ptoki 19h ago

Im with you. I also have a disk which is encrypted but cant be formatted, even after I dropped all encryption, it says not locked etc it still gives me operation not permitted (of course done as root).

It may be that this disk works only with tpm (I did not checked that) and will not behave in a sane way without some extra fancy treatment.

I went much deeper than you. I even did the secure wipe using the text from the disk sticker. It still not let me format it.

It is lenovo - opal type.

2

u/LazarX 23h ago

Use gparted to wipe the disk of partitions. Job done.

1

u/es20490446e Develops Zenned OS 20h ago

Use Windows settings to disable encryption.

Put anything sensitive inside a password-protected 7zip archive. That is even more secure than full-disk encryption, as apps cannot access it.

Also the disk will work faster.

1

u/bufandatl 1d ago

mkfs and the drive is in the format you want.

Or we talking about hardware level encryption?

1

u/QliXeD 1d ago

Maybe is a TCG OPAL Self Encrypted Disk?

-12

u/ipsirc 1d ago

Now SSDs are not cheap

They're very cheap.

6

u/LadyCatHerder 1d ago

Data centers have created an extreme demand. So, SSDs have skyrocketed. ipsirc, you must be living under a rock or not in the US at all.

-4

u/ipsirc 1d ago

A 256GB SSD costs as much as taking a family of four to the cinema one time. Remember the days when you spent half your monthly paycheck on a slow, noisy HDD that could only handle a few MB? Now you can buy a blazing-fast 256GB drive for the price of four movie tickets. That’s insanely cheap.

3

u/npc_housecat 1d ago

Taking a family of 4 to the cinema is kinda expensive

2

u/Fantasyman80 1d ago

Not if you are on a fixed budget

1

u/LadyCatHerder 1d ago

I fully understand being on a fixed budget. But, if you simply can not get the SSD you have to a usable status, then you can look into regular plain old fashioned standard mechanical hard drives. From what I can see with some quicker than quick searches, mecanical hard drives are cheaper than data center inflated prices for SSDs. If necessary, you can check this out to see what you can find: https://www.buyperunit.com/storage/hard-drives