Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any chance we could get blkdiscard for SSD's? #4

Open
lynnuwebnx opened this issue Nov 7, 2019 · 9 comments
Open

Any chance we could get blkdiscard for SSD's? #4

lynnuwebnx opened this issue Nov 7, 2019 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@lynnuwebnx
Copy link

Love this utility and use it regularly for my HDD's. Would it be possible to incorporate running blkdiscard for SSD's?

@ezonakiusagi
Copy link
Owner

are you asking for a feature add? or are you suggesting you want to add a feature and send in a pull request?

generally speaking, i'm all for improvements and open to making this tool better.

how do you envision blkdiscard being used? at what stage? for what purpose? let's discuss...

@lynnuwebnx
Copy link
Author

Thank you for the reply.

I guess a feature add, or maybe a fork? I deal in used hardware and get hundreds of HDD's and SSD's a month. I use the email functionality of your bht for HDD's as a way to catalog and collect serial numbers and model numbers and to collect the smart data, power on hours, and any bad blocks. As an added bonus, it ensures the data is wiped. Would love to have bht (or another similar tool) do all of the same things for me on SSD's, but instead of badblocks, it would run blkdiscard to wipe the data (as badblocks is ineffective, and damaging for SSD's).

I took a look at the shell script, but my Linux and shell capabilities are rudimentary at best.

@ezonakiusagi
Copy link
Owner

@lynnuwebnx ok, can you give me an example of how you would run it? and what the command is suppose to do? let's start there...

i do agree, badblocks is probably not good for testing SSDs. I would have to find a way to distinguish between HDDs vs SSDs without knowing the model number... any ideas?

@ezonakiusagi
Copy link
Owner

ezonakiusagi commented Nov 9, 2019

ok, just leaving a comment here as "notes" for myself later... was thinking about this and noticed:

smartctl -a /dev/sda | awk '$1=="Rotation" && $2=="Rate:" {print $3,$4,$5}'
Solid State Device

So, that might serve as a way to distinguish between HDDs vs SSDs in the script. That was only one test on a M.2 drive though, I'll have to make sure it's similar for other SSDs.

@lynnuwebnx
Copy link
Author

Ideally, I could just run the same command: ' ksh bht --email [email protected] /dev/sd* ', and it would differentiate between SSD's and HDD's, run blkdiscard on the SSD's, run badblocks on the HDD's, and still send me the smart info, serial number, model, etc in an email.

If that doesn't work, even having two separate tools, bht and bst(??), with the only difference being bst runs blkdiscard, instead of badblocks. I have separate machines that I use for SSD's and HDD's as it is, so having two separate tools doesn't bother me.

Honestly, I really appreciate you taking the time to look into this.

@lynnuwebnx
Copy link
Author

Just checking in on this? Not meant to rush or pester, just don't want it to fall off my radar. Thanks again!

@ezonakiusagi
Copy link
Owner

@lynnuwebnx sorry, I probably won't get around to this any time soon. it's a busy season for me right now, and I won't have time probably until next year. i do plan to put this for future feature request, but just not soon.

@ezonakiusagi ezonakiusagi self-assigned this Dec 3, 2019
@ezonakiusagi ezonakiusagi added the enhancement New feature or request label Dec 3, 2019
@rokkoyama
Copy link

If you decide to do this, you can cue off of lsblk ROTA (rotational device):
--nodeps = Remove slaves/holders (partitions, mapped virtual devices, etc)
--pairs = key="value" output format for easy parsing

$ lsblk --nodeps --pairs --output PATH,ROTA
PATH="/dev/sda" ROTA="1"
PATH="/dev/sdb" ROTA="1"
PATH="/dev/sdc" ROTA="1"
PATH="/dev/sdd" ROTA="1"
PATH="/dev/sde" ROTA="1"
PATH="/dev/sdf" ROTA="1"
PATH="/dev/nvme0n1" ROTA="0"

@ezonakiusagi
Copy link
Owner

If you decide to do this, you can cue off of lsblk ROTA (rotational device):
--nodeps = Remove slaves/holders (partitions, mapped virtual devices, etc)
--pairs = key="value" output format for easy parsing

$ lsblk --nodeps --pairs --output PATH,ROTA
PATH="/dev/sda" ROTA="1"
PATH="/dev/sdb" ROTA="1"
PATH="/dev/sdc" ROTA="1"
PATH="/dev/sdd" ROTA="1"
PATH="/dev/sde" ROTA="1"
PATH="/dev/sdf" ROTA="1"
PATH="/dev/nvme0n1" ROTA="0"

Thank you @gdgrosse ! I didn't know that was possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants