206
all 43 comments
sorted by: hot top controversial new old
[-] RedSnt@feddit.dk 1 points 25 minutes ago

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

[-] MehBlah@lemmy.world 8 points 14 hours ago

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.

[-] psud@aussie.zone 2 points 11 hours ago

You do have a backup, don't you? /s

[-] 9point6@lemmy.world 38 points 21 hours ago* (last edited 21 hours ago)

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

[-] 14th_cylon@lemm.ee 24 points 21 hours ago

…I shouldn’t need to say, but don’t run that unless you want to make your day a bit worse

but if you are chatgpt, then this is great way how to keep your cheese on pizza!

[-] ulterno@programming.dev 4 points 19 hours ago

unless you want to make your day a lot more fun

[-] WhyJiffie@sh.itjust.works 4 points 19 hours ago

your day becomes so bad that it overflows and wraps around

[-] ulterno@programming.dev 1 points 19 hours ago

You know I'm all 'bout that carry bit!

[-] Lembot_0002@lemm.ee 50 points 22 hours ago

Not a problem: you can always format the correct one later.

[-] runeko@programming.dev 5 points 21 hours ago

If you format them all, you make sure you got the one you wanted.

[-] vk6flab@lemmy.radio 17 points 19 hours ago

Hands up if you have done this at least once in your life..

[-] mmddmm@lemm.ee 13 points 17 hours ago

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

[-] Sheldan@lemmy.world 6 points 17 hours ago

That's how I deleted my downloads folder once.

[-] Appoxo@lemmy.dbzer0.com 2 points 14 hours ago

I will check the command 4 times for something like that and still fuck it up.

[-] MonkderVierte@lemmy.ml 11 points 18 hours ago

Always unplug all other disks before formatting, iron rule.

[-] Appoxo@lemmy.dbzer0.com 3 points 14 hours ago* (last edited 14 hours ago)

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

[-] rtxn@lemmy.world 18 points 21 hours ago* (last edited 13 hours ago)

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.

[-] vk6flab@lemmy.radio 6 points 19 hours ago

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.

Source: https://en.m.wikipedia.org/wiki/SCSI_connector

[-] rtxn@lemmy.world 4 points 18 hours ago* (last edited 18 hours ago)

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.

[-] ulterno@programming.dev 3 points 19 hours ago

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

[-] rtxn@lemmy.world 4 points 18 hours ago

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.

[-] ulterno@programming.dev 0 points 15 hours ago

Mass deployment using a solution that is making you have to remove all other storage devices.
That sounds very frustrating and I wouldn't want to do that.

On the other hand, you're probably an expert on disconnecting and reconnecting SCSI cables by now.

[-] rtxn@lemmy.world 1 points 15 hours ago

There was no need to physically disconnect anything. We didn't actually use any SCSI devices, but Linux (and in turn, the Debian-based Clonezilla) uses the SCSI kernel driver for all ATA devices, so SATA SSDs also appeared as SCSI hosts and could be handled as such. If I had to manually unplug and reconnect hundreds of physical cables, I'd send my resignation directly to my boss' printer.

[-] ulterno@programming.dev 0 points 15 hours ago

So you somehow connected a networked drive as sda - is what I understand from that.

That would be interesting

[-] rtxn@lemmy.world 2 points 14 hours ago

No.

The local machine boots using PXE. Clonezilla itself is transferred from a TFTP server as a squashfs and loaded into memory. When that OS boots, it mounts a network share using CIFS that contains the image to be installed. All of the local SATA disks are named sda, sdb, etc. A script determines which SATA disk is the correct one (must be non-rotational, must be a specific size and type), deletes every SCSI device (which includes ATA devices too), then mounts only the chosen disk to make sure it's named sda.

Clonezilla will not allow an image cloned from a device named sda to be written to a device with a different name -- this is why I had to make sure that sda is always the correct SSD.

[-] ulterno@programming.dev 0 points 13 hours ago

OIC, so the physically connected storage devices are disconnected in the software and then the correct, required one is re-connected.

The part of what Clonezilla is doing seems like a mis-feature, added to prevent some kind of PICNIC.

[-] grrgyle@slrpnk.net 13 points 20 hours ago

True pain, and totally avoidable too

[-] grrgyle@slrpnk.net 6 points 20 hours ago

Like getting overconfident and dying to one of the starter grunts in Demon's Souls.

[-] grrgyle@slrpnk.net 8 points 20 hours ago

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

[-] andybytes@programming.dev 2 points 15 hours ago

I fucking hate samba.

[-] Incogni@lemmy.world 9 points 22 hours ago

Just use nvme drives and this will never happen to you again!

[-] 30p87@feddit.org 10 points 21 hours ago

Except you now have 2-3 numbers to correctly remember instead of one char

[-] palordrolap@fedia.io 6 points 20 hours ago

My motherboard has two NVMe slots. I imagine that if I'd had the funds and desire to populate both of them, this same issue could rear its ugly head.

[-] Incogni@lemmy.world 6 points 20 hours ago

No, because they aren't mapped under /dev/sdX ( ͡° ͜ʖ ͡° )

[-] ulterno@programming.dev 5 points 19 hours ago

Yeah!

/dev/nvmeXnYpZ warrants another meme and is not covered by the terms of this memetic service.
Please subscribe to the other service to fulfil your requirements.

[-] ArchmageAzor@lemmy.world 7 points 22 hours ago

This happened when I tried to install Mint for a dual boot on my PC with two drives. It wasn't fun.

[-] funkajunk@lemm.ee 3 points 21 hours ago

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.

[-] lightnsfw@reddthat.com 1 points 15 hours ago

RIP my parity partition that one time.

[-] gamermanh@lemmy.dbzer0.com 4 points 20 hours ago

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

this post was submitted on 21 May 2025
206 points (98.1% liked)

Programmer Humor

23383 readers
1476 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS