ubuntu下硬盘相关

硬盘检测

ubuntu自带 disk

在这里插入图片描述

坏道检测:

sudo badblocks -s -v -c 32 /dev/

在这里插入图片描述

#分区工具:

ubuntu自带fdisk

fdisk -l:列出所有硬盘
在这里插入图片描述

Usage:
fdisk [options] change partition table
fdisk [options] -l [] list partition table(s)

Display or manipulate a disk partition table.

Options:
-b, --sector-size physical and logical sector size#物理和逻辑块的大小
-B, --protect-boot don’t erase bootbits when create a new label
-c, --compatibility[=] mode is ‘dos’ or ‘nondos’ (default)
-L, --color[=] colorize output (auto, always or never)
colors are enabled by default
-l, --list display partitions end exit
-o, --output output columns
-t, --type recognize specified partition table type only
-u, --units[=] display units: ‘cylinders’ or ‘sectors’ (default)
-s, --getsz display device size in 512-byte sectors [DEPRECATED]
–bytes print SIZE in bytes rather than in human readable format

-C, --cylinders specify the number of cylinders
-H, --heads specify the number of heads
-S, --sectors specify the number of sectors per track

-h, --help display this help and exit
-V, --version output version information and exit

Available columns (for -o):
gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S Start-C/H/S
bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
sgi: Device Start End Sectors Cylinders Size Type Id Attrs
sun: Device Start End Sectors Cylinders Size Type Id Flags

开机挂载硬盘

先找到需要开机挂载的硬盘的UUID

ls -l /dev/disk/by-uuid/

找到对应UUID

编辑开机挂载文档

vim /etc/fstab

配置模板:UUID=************* /xxxxx ext4 defaults 1 1

第一列是UUID
第二列是挂载点。

挂载点必须为当前已经存在的目录,为了兼容起见,最好在创建需要挂载的目标目录后,将其权限设置为777,以开放所有权限。

第三列为此分区的文件系统类型。

Linux可以使用ext2、ext3等类型,此字段须与分区格式化时使用的类型相同。也可以使用 auto 这一特殊的语法,使系统自动侦测目标分区的分区类型。auto通常用于可移动设备的挂载。

第四列是挂载的选项,用于设置挂载的参数。

常见参数如下:

auto: 系统自动挂载,fstab默认就是这个选项
defaults: rw, suid, dev, exec, auto, nouser, and async.
noauto 开机不自动挂载
nouser 只有超级用户可以挂载
ro 按只读权限挂载
rw 按可读可写权限挂载
user 任何用户都可以挂载
请注意光驱和软驱只有在装有介质时才可以进行挂载,因此它是noauto

第五列是dump备份设置。

当其值设置为1时,将允许dump备份程序备份;设置为0时,忽略备份操作;

第六列是fsck磁盘检查设置。

其值是一个顺序。当其值为0时,永远不检查;而 / 根目录分区永远都为1。其它分区从2开始,数字越小越先检查,如果两个分区的数字相同,则同时检查。

当修改完此文件并保存后,重启服务器生效。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值