Linux的fsdisk命令解析

來源:互聯網
上載者:User

sfdisk 是 Linux下面的分區表操作工具,可顯示分區的設定資訊,並檢查分區是否正常。sfdisk 也可用來建立分區。

用法:

sfdisk [options] device …

選項說明:

常用選項:

-s [or --show-size]: 顯示一個分區的大小

-c [or --id]: 顯示或者修改檔案系統類型ID

-l [or --list]: 顯示每個裝置的分區表資訊

-d [or --dump]: 同上,但是以一個格式化的方式輸出

-i [or --increment]: number cylinders etc. from 1 instead of from 0

-uS, -uB, -uC, -uM: 以扇面/塊/柱面數/MB為單位 顯示或形成報告

-T [or --list-types]:顯示所有已知的sfdisk能辨識的檔案系統ID

-D [or --DOS]: 相容DOS但是會浪費一點磁碟空間

-R [or --re-read]: 讓核心重新讀取分區表

-N# : 只改變分區的編號 #

-n : 修改但實際上並沒有儲存到磁碟

-O file : 儲存扇面修改並寫入分區表檔案

-I file : 重新恢複修改的扇面

危險的選項:

-g [or --show-geometry]: print the kernel’s idea of the geometry

-G [or --show-pt-geometry]: print geometry guessed from the partition table

-x [or --show-extended]: also list extended partitions on output

or expect descriptors for them on input

-L [or --Linux]: do not complain about things irrelevant for Linux

-q [or --quiet]: suppress warning messages

You can override the detected geometry using:

-C# [or --cylinders #]:set the number of cylinders to use

-H# [or --heads #]: set the number of heads to use

-S# [or --sectors #]: set the number of sectors to use

樣本:

sfdisk -d /dev/hda > hda-table 備份分區表並儲存到檔案

[root@mux02 tmp]# sfdisk -d /dev/hda

# partition table of /dev/hda

unit: sectors

/dev/hda1 : start=       63, size=   208782, Id=83, bootable

/dev/hda2 : start=   208845, size=156039345, Id=8e

/dev/hda3 : start=        0, size=        0, Id= 0

/dev/hda4 : start=        0, size=        0, Id= 0

sfdisk /dev/hda < hda-table 從檔案中恢複分區表

sfdisk -d /dev/hda | sfdisk /dev/hdb 在兩個磁碟間複製分區表

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.