linux 硬盘加密hdparm 怎样清除加密硬盘

1553人阅读
linux命令(4)
hdparm&命令
该命令用来获取或设置SATA/IDE设备的参数。实际上hdparm是linux中的一个用户层程序,查看源码会发现这个命令就是向磁盘发送一些ioctl命令。但是注意了,既然可以获取也可以设置,所以使用这个命令的时候务必要小心。当然我们只是为了获取查看硬盘信息,故不会对硬盘及系统造成什么危害。通常会配合 -i 或 -I(大写的i) 选项来取得硬盘的硬件信息。例如序列码等等啊~用法如下: hdparm -i /dev/sdb
例如输出如下:
[root@localhost grub]# hdparm -i /dev/sdb
Model=WDC, FwRev=01.01V02, SerialNo=WD-WCAW
Config={ HardSect NotMFM HdSw&15uSec SpinMotCtl Fixed DTR&5Mbs FmtGapReq }
RawCHS=, TrkSize=0, SectSize=0, ECCbytes=50
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
CurCHS=, CurSects=, LBA=yes, LBAsects=
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:
pio0 pio3 pio4
DMA modes:
mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: Unspecified:
ATA/ATAPI-1,2,3,4,5,6,7
* signifies the current active mode
smartctl 命令
这个一个用于控制和监控支持smart技术的硬盘的命令。通常配合 -a 选项我们可以查看到比较详尽的硬盘信息(比如序列号、硬盘容量、已运行时间、硬盘健康状况等)。用法如下:
smartctl -a /dev/sda
部分输出如下:
=== START OF INFORMATION SECTION ===
Model Family:
Western Digital RE4 Serial ATA
Device Model:
WDC WD1003FBYX-01Y7B1
Serial Number:
LU WWN Device Id: 5 0014ee 2b38e9ad1
Firmware Version: 01.01V02
User Capacity:
1,000,204,886,016 bytes [1.00 TB]
Sector Size:
512 bytes logical/physical
Device is:
In smartctl database [for details use: -P show]
ATA Version is:
ATA Standard is:
Exact ATA specification draft version not indicated
Local Time is:
8 20:22:16 2014 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status:
(0x82) Offline data collection activity
was completed without error.
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:133564次
积分:2412
积分:2412
排名:第15863名
原创:112篇
转载:20篇
(1)(2)(1)(3)(10)(28)(4)(12)(9)(1)(1)(13)(18)(22)(2)(2)(1)(3)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'博客访问: 554317
博文数量: 162
博客积分: 5123
博客等级: 大校
技术积分: 1483
注册时间:
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: LINUX
intel MLC SSD硬盘随着使用会产生很碎片,随着碎片的增加性能会大大降低。如果硬盘上的数据可以备份到别外,然后就可以用hdparm发送ATA “Secure Erase”指令去清空SSD硬盘中的数据的方法,把硬盘的写性能恢复到没有碎片时的状态。
注意: 这个操作会删除硬盘上所有的数据,而且这些数据不能被恢复。 注意:如果你不幸碰到了的操作系统内核bugs或SSD硬盘的fireware bugs,可能会硬盘不可写或操作系统crash。
发送 ATA Security Erase指令时需要先给硬盘设置一个密码,当然后面我们再发ATA Security Erase指令后这个密码会被删除掉的。
操作步骤:
先查看硬盘的状态,X代表sda,sdb,sdc等具体你要操作的硬盘:
hdparm -I /dev/X
主要看输出中的Security部分,如果结果中出现“not frozen”,那么这个硬盘是可以用ATA Security Erase命令去清除硬盘碎片的,
Security: &&&&&&& Master password revision code = 65534&&&&&&&&&&&&&&& supported&&&&&&& not&&&& enabled&&&&&&& not&&&& locked&&&&&&& not&&&& frozen&&&&&&& not&&&& expired: security count
如果结果是“frozen”的,有可能是主机的BIOS禁止发送ATA Security Erase指令,这需要找到BIOS中打开这个限制。
第二步:设置一个密码
hdparm --user-master u --security-set-pass&user123 /dev/X
user123是设置的一个密码.
#hdparm --user-master u --security-set-pass user123 /dev/sdesecurity_password="user123"
/dev/sde:&Issuing SECURITY_SET_PASS command, password="user123", user=user, mode=highSECURITY_SET_PASS: Invalid exchange
结果可能是“SECURITY_SET_PASS: Invalid exchange”,但密码也可能是设置上了,可以使用hdparm -I /dev/X检查是否设置上了,输出结果应该是“enabled”:
Security: &&&&&& Master password revision code = 65534&&&&&&&&&&&&&& supported&&&&&&&&&&&&&& enabled&&&&&& not&&&& locked&&&&&& not&&&& frozen&&&&&& not&&&& expired: security count
第三步:执行删除操作
hdparm --user-master u --security-erase user123 /dev/X
#hdparm --user-master u --security-erase user123 /dev/sde&& security_password="user123"
/dev/sde:&Issuing SECURITY_ERASE command, password="user123", user=userSECURITY_ERASE: Invalid exchange&
然后再检查Security被禁止了:
使用hdparm -I /dev/X检查是否设置上了,输出结果应该是“not enabled”:
Security: &&&&&& Master password revision code = 65534&&&&&&&&&&&&&& supported&&&&&&&not&&&&&enabled&&&&&& not&&&& locked&&&&&& not&&&& frozen&&&&&& not&&&& expired: security count
阅读(8066) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。文章总数:3888
页面总数:4
分类总数:80
标签总数:47
评论总数:118
浏览总数:1042279温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
吾生有涯,而知无涯……
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
&测试硬盘的读取速度&&检测IDE硬盘的电源管理模式[root@cnscn ~]# hdparm -C /dev/sda/dev/sda:drive state is: standby [省电模式].显示IDE硬盘的内定硬件规格[root@cnscn ~]# hdparm -i /dev/sda直接检测硬盘的硬件规格[root@cnscn ~]# hdparm -I /dev/sda/dev/sda:ATA device, with non-removable mediaModel Number: Maxtor 6B160M0Serial Number: B404PTJHFirmware Revision: BANC1BM0Standards:Supported: 7 6 5 4Likely used: 7Configuration:Logical max currentcylinders heads 16 16sectors/track 63 63–CHS current addressable sectors: LBA user addressable sectors: LBA48 user addressable sectors: device size with M = : 156334 MBytesdevice size with M = : 163928 MBytes (163 GB)Capabilities:LBA, IORDY(can be disabled)Queue depth: 32Standby timer values: spec’d by Standard, no device specific minimumR/W multiple sector transfer: Max = 16 Current = 16Advanced power management level: unknown setting (0×0000)Recommended acoustic management value: 192, current value: 254DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6Cycle time: min=120ns recommended=120nsPIO: pio0 pio1 pio2 pio3 pio4Cycle time: no flow control=120ns IORDY flow control=120nsCommands/features:Enabled Supported:* NOP cmd* READ BUFFER cmd* WRITE BUFFER cmd* Host Protected Area feature set* Look-ahead* Write cache* Power Management feature setSecurity Mode feature set* SMART feature set* FLUSH CACHE EXT command* Mandatory FLUSH CACHE command* Device Configuration Overlay feature set* 48-bit Address feature set* Automatic Acoustic Management feature setSET MAX security extensionAdvanced Power Management feature set* DOWNLOAD MICROCODE cmd* General Purpose Logging feature set* SMART self-test* SMART error loggingSecurity:Master password revision code = 65534supportednot enablednot lockednot frozennot expired: security countnot supported: enhanced eraseChecksum: correct.检测并设置IDE硬盘的32位I/O模式检测[root@cnscn ~]# hdparm -c /dev/sda/dev/sda:IO_support = 0 (default 16-bit) [默认16位I/O]设置[root@cnscn ~]# hdparm -c 1 /dev/sda.检测并设置IDE硬盘的DMA模式[root@cnscn ~]# hdparm -d /dev/sda/dev/sda:…[root@cnscn ~]# hdparm -d 1 /dev/sda.检测读取文件时,预先存入快取的扇区数[root@cnscn ~]# hdparm -a /dev/sda/dev/sda:readahead = 256 (on).查询并设置硬盘多重扇区存取的扇区数,以增进硬盘的存取效率[root@cnscn ~]# hdparm -m /dev/sda[root@cnscn ~]# hdparm -m 参数值为整数值如8 /dev/sda.将内顾虑缓冲的数据写入硬盘,并清除缓冲区的数据[root@cnscn ~]# hdparm -f /dev/sda摘自:http://www.centos.bz/2012/08/linux-hdparm-hard-disk-info/
阅读(3005)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Linux 硬盘工具之hdparm',
blogAbstract:'安装yum -y install hdparm显示硬盘的相关设置',
blogTag:'linux,hdparm',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:9,
publishTime:4,
permalink:'blog/static/',
commentCount:1,
mainCommentCount:1,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'吾生有涯,而知无涯……',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}linux读取硬盘序列号命令【fqz吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0可签7级以上的吧50个
本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:13贴子:
linux读取硬盘序列号命令
hdparm -i /dev/sda读取其中的 SerialNo= ,然后用MD5加密就可以了例子: import java.io.BufferedR import java.io.IOE import java.io.InputStreamR import java.io.PrintS public class UtilHDSerialNo { public static final String getHDSerialNo() throws Exception { String os = getOsName(); try { if (os.startsWith("Windows")) { return getHDSerialNoForWindows(); } if (os.startsWith("Linux")) { return getHDSerialNoForLinux(); } throw new IOException("unknown operating system: " + os); } catch (Exception ex) { System.out.println(ex.getMessage()); }throw new IOException(ex.getMessage()); } private static String getOsName() { String os = ""; os = System.getProperty("os.name"); } private static String getHDSerialNoForWindows() { return "windowsHDSerialNo"; }
甘家口建筑书店,建筑书店,低价任你来选!
贴吧热议榜
使用签名档&&
保存至快速回贴

我要回帖

更多关于 linux hdparm 安装 的文章

 

随机推荐