0

I'm new on the Linux field. I have a real big problem.
I have installed several times Linux Mint 21 on an old - but very nice computer - without any issues. I'm not at all a beginner in the field of computers, the opposite, I m not completely ignorant about Linux but I don't know much for the moment. I know very well the Windows world.

I won't tell you the a whole long story, but I wanted to get rid of a ZFS format that I accidentally did previously on the SSD. I also wanted to definitely erase some personal files. So, following what is told on some forums I experimented a command that fills the whole disk with zeros. This one : sudo dd if=/dev/zero of=/dev/sdx bs=1M

Sadly there was also an accidentally stop of the system and now the SSD has no partition table and it's not anymore recognized by gparted :( Wow. Amazing :(
The Linux installator doesn't either recognize the disk.
If you know well all this, please tell me what I can do. If I can!
I'm now on the USB live Key

Did I lose the SSD or what? (35€ guys!)
can I do something to recreate the structure of the disk? Is there a Linux command that will recreate the structure of the disk?

Otherwise do I have to search for a low level formatting program from Crucial? (It's a Crucial BX 240 SSD) No need to say that I never had that kind of experience under Windows, of course.
Thanks a lot for your help, if you know a solution, please, tell me. SOS :)

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • Does `lsblk` still show the SSD? – Hermann Oct 21 '22 at 18:24
  • 2
    Your dd erased all partitions. And any sort of interruption to a process like that can cause issues. Is drive shown? Does this make drive as gpt? `sudo parted /dev/sdX mklabel gpt` where sdX is sda, sdb or whatever drive is seen as? Then can you create partitions? – oldfred Oct 21 '22 at 18:38
  • Had to search for what the command does never dd'ed a whole disk (shred is better IMO), a good thread here: https://unix.stackexchange.com/questions/275243/what-does-dd-if-dev-zero-of-dev-sda-do . AFAIK, dd'ing a disk should not kill it (other than from wear out), since firmware hopefully will not be part of usable space. I've seen installers giving less options than GParted on a live system does, luckily you are on one. Try creating a new partition table in GParted. lsblk query of Hermann is quite on point, if you can see /dev/sdx, there is hope. But worshiped GParted as a noob and still do. – cbugk Oct 21 '22 at 18:41
  • 3
    Your data is gone, your SSD is intact, using dd to wipe SSDs is a very bad idea in general. Use `blkdiscard` instead - it's near instant and doesn't cause tear and wear. – Artem S. Tashkinov Oct 21 '22 at 19:21

1 Answers1

2

The disk is fine. All you did was to overwrite its partition table with zeros.

You can create a new partition table with (e.g.) parted:

# parted -a optimal /dev/sdX
mklabel gpt
unit MiB
mkpart primary 1 -1
print
quit

That's just an example that would create one partition with (almost) all the space. Afterwards you could create a filesystem on this partition with # mkfs.ext4 /dev/sdX1 (for example).

EDIT: As Artem S. Tashkinov said, you should use blkdiscard (or hdparm) to send a bulk ATA Trim (or ATA Secure Erase) command to the disk before partitioning it. This is necessary to inform the disk's controller of which flash cells the OS deems logically empty.

anick
  • 440
  • 1
  • 13
  • 1
    Thank you I restarted with the live Linux Mint USB key twice, and the second time GPARTED saw the two partitions! I then deleted the partitions and restarted the installation. Everything went well. I reinstalled Mint several times to test the various ways of doing it. Personally, I dropped the idea of ​​moving "Home" to a second partition, after a standard installation. I also tried to partition directly from the install. Honestly, I didn't succeed either. I must not be gifted. Maybe I got old too :) – gottogetout Oct 23 '22 at 16:40