When you accidental format the wrong /dev/sdX
When you accidental format the wrong /dev/sdX
When you accidental format the wrong /dev/sdX
The problem you have is you care which disk gets wiped, russian roulette is the best design pattern!
sudo dd if=/dev/zero of=$(ls /dev/sd* | shuf | head -n1)
......I shouldn't need to say, but don't run that unless you want to make your day a bit worse
Broke: /dev/sd*
Woke: /dev/disk/by-id/*
Bespoke: finding the correct device's SCSI host, detaching everything, then reattaching only the one host to make sure it's always /dev/sda
. (edit) In software. SATA devices also show up as SCSI hosts because they use the same kernel driver.
I've had to use all three methods. Fucking around in /sys
feels like I'm wielding a power stolen from the gods.
The SCSI solution requires making sure that you have the right terminator connector because of course there's more than one standard .. ask me how I know .. I think the Wikipedia article on SCSI says it best:
As with everything SCSI, there are exceptions.
Only if you're working with SCSI hardware. On Linux, SATA (and probably PATA) devices use the same kernel driver as SCSI, and appear on the system as SCSI hosts. You can find them in /sys/class/scsi_disk
or by running lsblk -o NAME,HCTL
.
I actually have multiple HDDs of the same model with only their serial numbers different.
I usually just open partitionmanager, visually identify my required device, then go by disk/by-uuid
or by disk/by-partuuid
in case it doesn't have a file system.
Then I copy-paste the UUID from partitionmanager into whatever I am doing.
Fucking around in
/sys
feels like I'm wielding a power stolen from the gods
I presume you have had to run on RAM, considering you removed all drives
I presume you have had to run on RAM, considering you removed all drives
Yes. Mass deployment using Clonezilla in an extremely heterogenous environment. I had to make sure the OS got installed on the correct SSD, and that it was always named sda
, otherwise Clonezilla would shit itself. The solution is a hack held together by spit and my own stubbornness, but it works.
Hands up if you have done this at least once in your life..
I'm so terrified about it that I check dozens of times before running it. So, no.
But I'm a repeat offender with rm -rf * .o
That's how I deleted my downloads folder once.
I will check the command 4 times for something like that and still fuck it up.
True pain, and totally avoidable too
Like getting overconfident and dying to one of the starter grunts in Demon's Souls.
Like walking to the table with a plate full of steaming chive dumplings only to catch the corner of the plate on a wall and watch your dumps go tumblo all over and dog eats them and is definitely going to have the shits in the middle of the night
Always unplug all other disks before formatting, iron rule.
Let's unplug the system drive while formatting the intended drive.
You have three options:
O1: Your OS lives basically in the RAM anyway.
O2: Get rekt
O3: You can't formart your system drive because it's mounted from /dev/nvme0p
Just use nvme drives and this will never happen to you again!
Except you now have 2-3 numbers to correctly remember instead of one char
Somehow in thirty years I have never done that. I did however one time pull a drive that wasn't done with its cached writes.
This happened when I tried to install Mint for a dual boot on my PC with two drives. It wasn't fun.
This is why I always unplug the other drive before I install Linux, because the one time I didn't I couldn't boot the other OS anymore.
I didn't format the wrong drive, but the Linux installer automatically detected the existing EFI partition and just overwrote it. Luckily, that was the only issue and I was able to recreate the EFI partition, and it taught me a lesson that I will never forget.
Edit mount options to refer to drives by their label or their user-friendly name and never worry about this again
For example: /mnt/Speedy, /mnt/Game-SSD, etc
You do have a backup, don't you? /s
And you still got it wrong?
Don't know about op but me? Yes
I fucking hate samba.
Being a noob helps me there. I'll boot into a live environment off a usb stick and use gparted if it's local. But obviously that's a lot harder via SSH
RIP my parity partition that one time.
If you format them all, you make sure you got the one you wanted.