前言:将固态硬盘装到电脑,ubuntu系统需要格式化并挂载才能正式使用
将固态装在电脑上后,打开后端
1:查看现有硬盘分区及挂载状态
命令 :df -h
没有新增的SSD固态硬盘
2:查看服务器所有安装的硬盘状态(包括已安装和未安装的)
命令: fdisk -l
此时已经安装的磁盘,但是没有分区,先分区
3, 将磁盘分区,分一个区挂载到根目录下
命令:fdisk /dev/sdb (该目录是上面未安装的磁盘目录)
输入完命令后按回车或者直接按回车就好了
4 在查看磁盘分区情况
命令:fdisk -l
现在已经有新的分区了
5 格式化分区
命令: mkfs -t ext4 -c /dev/sdb1
# -t 制定要把磁盘格式化成什么类型
# -c 在建立文件系统之前检查环道,要等一段时间,新硬盘一般不需要
6 挂载新磁盘
1) 先在根目录下新建一个目录作为一个挂载点
命令 :mkdir /ssd
在执行挂载命令
命令 : mount /dev/sdb1 /ssd
显示挂载成功
7 .设置开机自动挂载
命令 : vim /etc/fstab
或者 gedit /etc/fstab
在文件最后添加 /dev/sdb1 /ssd ext4 defaults 0 0
安装完成后,还可以使用相关命令查看硬盘的读写速度
查看硬盘的读取速度
命令: hdparm -t /dev/sda 这个sda是安装ubuntu系统的根目录的挂载点
不同机器的挂载点不一样。使用命令查看挂载点
命令: df -TH
Filesystem下面的路径就是挂载点
硬盘数量、大小:sudo fdisk -l |grep "Disk /dev/sd"
硬盘型号:sudo hdparm -i /dev/sda |grep "Model"
liunx下查看硬盘型号和硬盘序列号:
命令 : hdparm -i /dev/sdb
显示硬盘的相关设置
[email protected]:~# hdparm /dev/sdb
/dev/sdb:
multcount = 1 (on)
IO_support = 1 (32-bit)
readonly = 0 (off)
readahead = 256 (on)
geometry = 60801 [柱面数] /255 [磁头数] /63 [扇区数], sectors = 976773168 [总扇区数], start = 0 [起始扇区数】
显示硬盘的柱面,磁头,扇区数
评估硬盘的读取效率
命令 : hdparm -t /dev/sdb1
评估硬盘快取的读取效率
命令 : hdparm -T /dev/sdb1
直接检测硬盘的硬件规格
[email protected]:~# hdparm -I /dev/sdb
/dev/sdb:
ATA device, with non-removable media
Model Number: Samsung SSD 860 EVO 500GB
Serial Number: S4CPNF0M708301K
Firmware Revision: RVT03B6Q
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
Used: unknown (minor revision code 0x005e)
Supported: 11 8 7 6 5
Likely used: 11
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 976773168
Logical Sector size: 512 bytes
Physical Sector size: 512 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 476940 MBytes
device size with M = 1000*1000: 500107 MBytes (500 GB)
cache/buffer size = unknown
Form Factor: 2.5 inch
Nominal Media Rotation Rate: Solid State Device
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec‘d by Standard, no device specific minimum
R/W multiple sector transfer: Max = 1 Current = 1
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
Write-Read-Verify feature set
* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Gen3 signaling speed (6.0Gb/s)
* Native Command Queueing (NCQ)
* Phy event counters
* READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
* DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Asynchronous notification (eg. media change)
* Software settings preservation
Device Sleep (DEVSLP)
* SMART Command Transport (SCT) feature set
* SCT Write Same (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
* reserved 69[4]
* DOWNLOAD MICROCODE DMA command
* SET MAX SETPASSWORD/UNLOCK DMA commands
* WRITE BUFFER DMA command
* READ BUFFER DMA command
* Data Set Management TRIM supported (limit 8 blocks)
* Deterministic read ZEROs after TRIM
Security:
Master password revision code = 65534
supported
not enabled
not locked
frozen
not expired: security count
supported: enhanced erase
4min for SECURITY ERASE UNIT. 8min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5002538e497129a7
NAA : 5
IEEE OUI : 002538
Unique ID : e497129a7
Device Sleep:
DEVSLP Exit Timeout (DETO): 50 ms (drive)
Minimum DEVSLP Assertion Time (MDAT): 30 ms (drive)
Checksum: correct
检测并设置IDE硬盘的32位I/O模式
检测
[[email protected]]# hdparm -c /dev/sdb
/dev/sdb:
IO_support = 0 (default 16-bit) [默认16位I/O]
设置
[[email protected] ~]# hdparm -c 1 /dev/sdb
.检测并设置IDE硬盘的DMA模式
检测
[[email protected]]# hdparm -d /dev/sdb
/dev/sdb
… www.2cto.com
设置
[[email protected]]# hdparm -d 1 /dev/sdb
.检测读取文件时,预先存入快取的扇区数
[[email protected] ~]# hdparm -a /dev/sdb
/dev/sdb:
readahead = 256 (on)
.查询并设置硬盘多重扇区存取的扇区数,以增进硬盘的存取效率
[[email protected] ~]# hdparm -m /dev/sdb
[[email protected] ~]# hdparm -m 参数值为整数值如8 /dev/sdb
.将内顾虑缓冲的数据写入硬盘,并清除缓冲区的数据
[[email protected] ~]# hdparm -f /dev/sdb
原文地址:https://www.cnblogs.com/bpdhpm/p/11384473.html