ubuntu下硬盘相关
文章目錄
- 硬盤檢測
- ubuntu自帶 disk
- 壞道檢測:
- ubuntu自帶fdisk
 
- 開機掛載硬盤
- 先找到需要開機掛載的硬盤的UUID
- 編輯開機掛載文檔
 
硬盤檢測
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開始,數字越小越先檢查,如果兩個分區的數字相同,則同時檢查。
當修改完此文件并保存后,重啟服務器生效。
總結
以上是生活随笔為你收集整理的ubuntu下硬盘相关的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: linux文件目录结构
- 下一篇: conda配置
