[Feature] Better drive names for the log
sporqist opened this issue · 10 comments
I love nwipe but one thing bugs me a little: It logs the randomly assigned drive names /dev/sdX
instead of more tangible info.
notice: Finished pass 1/7, round 1/1, on /dev/sdd
It would be great to have the drives serial number in each log line. If that's out of question, it would be nice to have it log the path used to call nwipe so that when I run it like this, it will log that path and not /dev/sdX
.
nwipe --autonuke --method dod522022m --nogui /dev/disk/by-path/pci-0000:05:00.0-sas-phy4-lun-0
This is my use case if you are curious. I'm using a system with multiple hot swap bays and frequently insert new drives to wipe. When I need more info on a specific wipe, I can only search the logs using the pid of that nwipe process. Would be nice if I could use the drives serial number instead.
What version of nwipe are you using?
Nwipe has been putting serial numbers in the logs and in the wipe summary table (since v0.31) for a while now.
[2021/06/04 21:41:12] notice: Starting pass 1/1, round 1/1, on /dev/loop44
[2021/06/04 21:41:12] notice: Initialising Isaac prng
[2021/06/04 21:41:12] notice: prng stream is active
[2021/06/04 21:41:13] notice: 31457280 bytes written to /dev/loop44
[2021/06/04 21:41:13] notice: Finished pass 1/1, round 1/1, on /dev/loop44
[2021/06/04 21:41:13] notice: Finished final round 1 of 1 on /dev/loop44
******************************** Error Summary *********************************
! Device | Pass Errors | Verifications Errors |
--------------------------------------------------------------------------------
loop44 | 0 | 0 |
********************************************************************************
********************************* Drive Status *********************************
! Device | Status | Thru-put | HH:MM:SS | Model/Serial Number
--------------------------------------------------------------------------------
loop44 | Erased | 31 MB/s | 00:00:01 | Loopback device/
--------------------------------------------------------------------------------
[2021/06/04 21:41:17] Total Throughput 31 MB/s, PRNG Stream, 1R+NB+NV
********************************************************************************
Not a good example as it shows a loop device, but you can see from the table header where the serial number is supposed to appear.
It would be great to have the drives serial number in each log line. If that's out of question, it would be nice to have it log the path used to call nwipe so that when I run it like this, it will log that path and not /dev/sdX.
nwipe --autonuke --method dod522022m --nogui /dev/disk/by-path/pci-0000:05:00.0-sas-phy4-lun-0
I did know anybody was referencing drives like that. Why do you reference a drive by its path rather than by its short form name?
I'll have a think about what issues that would raise regarding the implementation.
Just a thought, but would having a separate log file for each drive solve the problem?
Nwipe has been putting serial numbers in the logs and in the wipe summary table (since v0.31) for a while now.
I'm using nwipe 0.33 and yes, I've seen the drives serial numbers in the summary table. Very handy.
I did know anybody was referencing drives like that. Why do you reference a drive by its path rather than by its short form name?
Just a thought, but would having a separate log file for each drive solve the problem?
Already got this solved using systemd. I've got a systemd service for each physical hot-swap bay of my harddrive deletion machine, named driveX
(X as the number of the physical drive bay). journalctl -xeu driveX
gives me the logs for the physical drive bays. If you want to check it out, see the link in my initial post. The thing is, in my use case, /dev/sdX
is a non-information and it would be nice to have something that maps to the physical drive bay or the harddrive itself everywhere in the logs.
I also log to a syslog server tho where there is one log for each machine. So no journald over there and I have to match with nwipe's pid again.
It's not really a problem. Just a nice to have feature, not an issue that needs fixing.
If I'm understanding the issue correctly, you need the progress reports generated by nwipe that mention /dev/sdx replaced by the bypath identification. The nwipe progress being accessed via journalctl -xeu?
I think I could implement a change that is enabled by the option --disp-bypath so that /dev/sdx is replaced by the bypath value or maybe keep the sdx value with bypath in brackets i.e sda (pci-0000:05:00.0-sas-phy4-lun-0)
Does that look like it would solve your problem?
This exactly. Thanks for having a go at it.
The nwipe progress being accessed via journalctl -xeu?
Thats just because I run nwipe using a systemd service unit. You can get journalctl output for systemd units with its -u
option.
Just one other question, I'm assuming you're ok downloading the source and compiling to test it. I.e what distro are you running nwipe on?
I've got to finish off something else I'm working on this week but should have some free time to work on it from next week.
Sure, I'll grab the source and test it. My drive deletion machine runs on NixOS. On my normal machines, I run openSUSE Tumbleweed or Debian.
I had a very similar issue, but I need to display a custom disk name in GUI.
I have implemented it using a map (/dev/sdX -> label) read from file.
Do you think that it might be useful for you and I could upstream it? The other solution would be to add labels as input arguments.
had a very similar issue, but I need to display a custom disk name in GUI.
I have implemented it using a map (/dev/sdX -> label) read from file.
Do you think that it might be useful for you and I could upstream it? The other solution would be to add labels as input arguments.
Sure, I'd be happy to take a look at that.