Storage
- Utilities
Utilities
dmsetup — low level logical volume management
[root@node02 ~]# dmsetup info -C
Name Maj Min Stat Open Targ Event UUID
mpathe 253 24 L--w 1 1 1 mpath-3600d023100036e4461f399ce40b9ee7d
mpathn 253 3 L--w 1 1 1 mpath-3600d02310009005d059f19bb5ab8640d
mpatha 253 9 L--w 2 1 1 mpath-3600c0ff0003b82e9224a5f5b01000000
mpathm 253 1 L--w 1 1 1 mpath-3600d02310008b5e3539e4069163b90b3
mpathl 253 5 L--w 1 1 1 mpath-3600c0ff0003b82e94fe5f75b01000000
mpathx 253 2 L--w 0 1 1 mpath-3600c0ff0003b82e99238355f01000000
mpathk 253 8 L--w 1 1 1 mpath-3600d02310003efb83183e0594afc2ab6
mpathv 253 6 L--w 1 1 1 mpath-3600c0ff0003b82e966f10a5f01000000
mpathi 253 12 L--w 1 1 1 mpath-3600d023100000cfb1768d16b7398866e
mpathu 253 4 L--w 1 1 1 mpath-3600d02310009e5e609098a5574e7230b
mpatht 253 0 L--w 1 1 1 mpath-3600d02310009e5da20a218e06bfa00ad
mpathg 253 20 L--w 1 1 1 mpath-3600d0231000375e811d2b3a36590ee86
mpathf 253 16 L--w 1 1 1 mpath-3600d023100000cf342d486b4755400ed
dmsetup table
Disks are then in /dev/mapper/
lsblk – list block devices
root@cephhost01:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55M 1 loop /snap/core18/1705
loop1 7:1 0 69.3M 1 loop /snap/lxd/15457
loop3 7:3 0 27.1M 1 loop /snap/snapd/7264
loop4 7:4 0 30.3M 1 loop /snap/snapd/7777
loop5 7:5 0 55M 1 loop /snap/core18/1754
loop6 7:6 0 71.2M 1 loop /snap/lxd/15564
sr0 11:0 1 1024M 0 rom
vda 252:0 0 25G 0 disk
├─vda1 252:1 0 1M 0 part
└─vda2 252:2 0 25G 0 part /
vdb 252:16 0 20G 0 disk
-f, –fs
Output info about filesystems. This option is equivalent to -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT.
root@cephhost01:~# lsblk --fs
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0 squashfs 0 100% /snap/core18/1705
loop1 squashfs 0 100% /snap/lxd/15457
loop3 squashfs 0 100% /snap/snapd/7264
loop4 squashfs 0 100% /snap/snapd/7777
loop5 squashfs 0 100% /snap/core18/1754
loop6 squashfs 0 100% /snap/lxd/15564
sr0
vda
├─vda1
└─vda2 ext4 49b14327-2d4e-4d59-b2f1-78966ca950f3 15.2G 33% /
vdb
-t, –topology
Output info about block-device topology. This option is equivalent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
$ lsblk -t
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME
sda 0 4096 0 4096 512 1 mq-deadline 64 128 0B
└─sda1 0 4096 0 4096 512 1 mq-deadline 64 128 0B
sdb 0 4096 0 4096 512 1 mq-deadline 64 128 0B
└─sdb1 0 4096 0 4096 512 1 mq-deadline 64 128 0B
sdc 0 512 0 512 512 0 mq-deadline 64 128 0B
├─sdc1 0 512 0 512 512 0 mq-deadline 64 128 0B
├─sdc2 0 512 0 512 512 0 mq-deadline 64 128 0B
└─sdc3 0 512 0 512 512 0 mq-deadline 64 128 0B
sdd 0 4096 0 4096 512 1 mq-deadline 64 128 0B
sde 0 4096 0 4096 512 1 mq-deadline 64 128 0B
sdf 0 4096 0 4096 512 1 mq-deadline 64 128 0B
sr0 0 512 0 512 512 1 mq-deadline 64 128 0B
nvme1n1 0 512 0 512 512 0 none 1023 128 0B
└─nvme1n1p1 0 512 0 512 512 0 none 1023 128 0B
nvme0n1 0 512 0 512 512 0 none 1023 128 0B
├─nvme0n1p1 0 512 0 512 512 0 none 1023 128 0B
└─nvme0n1p2 0 512 0 512 512 0 none 1023 128 0B
blkid – locate/print block device attributes
blkid
/dev/disk filesystem
ll /dev/disk/by-uuid
tree /dev/disk/by-id/
dstat – versatile tool for generating system resource statistics
dstat -d -D sda,nvme1n1
hdparm – get/set SATA/IDE device parameters
-I | Request identification info directly from the drive |
-A | Get/set the IDE drive’s read-lookahead feature (usually ON by default). Usage: -A0 (disable) or -A1 (enable). |
-W | Get/set the IDE/SATA drive’s write-caching feature. |
hdparm /dev/sda
hdparm -W /dev/sda
/dev/sda:
write-caching = 1 (on)
hdparm -I /dev/disk/by-id/ata-ST33000651AS_8XK7FBZG | grep 'Sector\|Rotation'
ATA Secure Erase/Enhanced Security Erase
WARNING: Do not attempt to do this through a USB interface!
hdparm -I /dev/sda
If the disk is frozen
, put the machine to sleep with:
echo -n mem > /sys/power/state
then disconnect the disk (unplug the cables) wait 2-3 seconds, put it back in and wake up the machine. Thus the bios won’t send the frozen signal to the disk that prevents secure erase.
Set a passwd:
hdparm --user-master u --security-set-pass p /dev/sda
Kill the disk:
time hdparm --user-master u --security-erase-enhanced p /dev/sda
After the secure erase is finished, security feature will be disabled (password removed).
https://archive.kernel.org/oldwiki/ata.wiki.kernel.org/index.php/ATA_Secure_Erase.html
Random
hdparm --security-help
ATA Security Commands:
Most of these are VERY DANGEROUS and can destroy all of your data!
Due to bugs in older Linux kernels, use of these commands may even
trigger kernel segfaults or worse. EXPERIMENT AT YOUR OWN RISK!
--security-freeze Freeze security settings until reset.
--security-set-pass PASSWD Lock drive, using password PASSWD:
Use 'NULL' to set empty password.
Drive gets locked if user-passwd is selected.
--security-unlock PASSWD Unlock drive.
--security-disable PASSWD Disable drive locking.
--security-erase PASSWD Erase a (locked) drive.
--security-erase-enhanced PASSWD Enhanced-erase a (locked) drive.
The above four commands may optionally be preceded by these options:
--security-mode LEVEL Use LEVEL to select security level:
h high security (default).
m maximum security.
--user-master WHICH Use WHICH to choose password type:
u user-password (default).
m master-password
source: https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase
smartctl – Control and Monitor Utility for SMART Disks
-i, –info | Prints the device model number, serial number, firmware version, and ATA Standard version/revision information. |
-a, –all | Prints all SMART information about the disk, or TapeAlert information about the tape drive or changer. |
Tests
-l TYPE, –log=TYPE | Prints various device logs. |
-t TEST, –test=TEST | Executes TEST immediately. |
-c, –capabilities | If the device can carry out self-tests, this option also shows the estimated time required to run those tests. |
VALID ARGUMENTS ARE: offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off]
smartctl -t short /dev/sda
smartctl -c /dev/sda
SCT Error Recovery Control
smartctl -l scterc,70,70 /dev/sda
https://superuser.com/questions/1551943/do-i-need-to-edit-sct-error-recovery-control-time