forked from docs/doc-exports
Reviewed-by: Miskanin, Jan <jan.miskanin@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
115 lines
14 KiB
HTML
115 lines
14 KiB
HTML
<a name="evs_faq_0131"></a><a name="evs_faq_0131"></a>
|
|
|
|
<h1 class="topictitle1">How Do I View the Disk Partition Style in Linux?</h1>
|
|
<div id="body8662426"><p id="evs_faq_0131__p139426231581">You can use either fdisk or parted to view the disk partition style.</p>
|
|
<ul id="evs_faq_0131__evs_01_0035_ul11242201183512"><li id="evs_faq_0131__evs_01_0035_li162438153514"><a href="#evs_faq_0131__evs_01_0035_section45741613172812">Method 1: Check Partition Style and File System Format Using fdisk</a></li><li id="evs_faq_0131__evs_01_0035_li152431415356"><a href="#evs_faq_0131__evs_01_0035_section7627683297">Method 2: Check Partition Style and File System Format Using parted</a></li></ul>
|
|
<div class="section" id="evs_faq_0131__evs_01_0035_section45741613172812"><a name="evs_faq_0131__evs_01_0035_section45741613172812"></a><a name="evs_01_0035_section45741613172812"></a><h4 class="sectiontitle">Method 1: Check Partition Style and File System Format Using fdisk</h4><ol id="evs_faq_0131__evs_01_0035_ol2900319714518"><li id="evs_faq_0131__evs_01_0035_li4640174163019"><a name="evs_faq_0131__evs_01_0035_li4640174163019"></a><a name="evs_01_0035_li4640174163019"></a><span>Run the following command to view all the disks attached to the <span id="evs_faq_0131__evs_01_0035_text56411141123020">server</span>:</span><p><p id="evs_faq_0131__evs_01_0035_p4641134114308"><strong id="evs_faq_0131__evs_01_0035_b1664118411308">lsblk</strong></p>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p106418412309">Information similar to the following is displayed:<pre class="screen" id="evs_faq_0131__evs_01_0035_screen9641104113010">[root@ecs-test-0001 ~]# lsblk
|
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
|
vda 253:0 0 40G 0 disk
|
|
└─vda1 253:1 0 40G 0 part /
|
|
vdb 253:16 0 150G 0 disk
|
|
└─vdb1 253:17 0 100G 0 part /mnt/sdc</pre>
|
|
</div>
|
|
<p id="evs_faq_0131__evs_01_0035_p1264117419305">In this example, data disk <strong id="evs_faq_0131__evs_01_0035_b1281718371306">/dev/vdb</strong> already has partition <strong id="evs_faq_0131__evs_01_0035_b04731653113011">/dev/vdb1</strong> before capacity expansion, and the additional 50 GiB added has not been allocated yet. Therefore, <strong id="evs_faq_0131__evs_01_0035_b1085184053413">/dev/vdb</strong> has 150 GiB, and <strong id="evs_faq_0131__evs_01_0035_b3787740143613">/dev/vdb1</strong> has 100 GiB.</p>
|
|
<div class="note" id="evs_faq_0131__evs_01_0035_note177820401835"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_faq_0131__evs_01_0035_p1877914401139">If you run <strong id="evs_faq_0131__b5235133514137">lsblk</strong> and find out that disk <strong id="evs_faq_0131__b7238143519138">/dev/vdb</strong> has no partitions, format the disk by referring to <a href="evs_faq_0073.html">How Do I Extend the File System of an Unpartitioned Data Disk in Linux?</a> and expand the capacity. Otherwise, the additional space cannot be used after expansion.</p>
|
|
</div></div>
|
|
</p></li><li id="evs_faq_0131__evs_01_0035_li5970218814518"><span>Run the following command to view the current disk partition style:</span><p><p id="evs_faq_0131__evs_01_0035_p44878614518"><strong id="evs_faq_0131__evs_01_0035_b403908014518">fdisk -l</strong></p>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p3635172814518">Information similar to the following is displayed:<pre class="screen" id="evs_faq_0131__evs_01_0035_screen107608156108">[root@ecs-test-0001 ~]# fdisk -l
|
|
|
|
Disk /dev/vda: 42.9 GiB, 42949672960 bytes, 83886080 sectors
|
|
Units = sectors of 1 * 512 = 512 bytes
|
|
Sector size (logical/physical): 512 bytes / 512 bytes
|
|
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
|
Disk label type: dos
|
|
Disk identifier: 0x000bcb4e
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/vda1 * 2048 83886079 41942016 83 Linux
|
|
|
|
Disk /dev/vdb: 161.1 GiB, 161061273600 bytes, 314572800 sectors
|
|
Units = sectors of 1 * 512 = 512 bytes
|
|
Sector size (logical/physical): 512 bytes / 512 bytes
|
|
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
|
Disk label type: dos
|
|
Disk identifier: 0x38717fc1
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/vdb1 2048 209715199 104856576 83 Linux</pre>
|
|
</div>
|
|
<p id="evs_faq_0131__evs_01_0035_p242784819494">The value in the <strong id="evs_faq_0131__evs_01_0035_b1070933413382">System</strong> column indicates the disk partition style. Value <strong id="evs_faq_0131__evs_01_0035_b5851113823815">Linux</strong> indicates the MBR partition style. Value <strong id="evs_faq_0131__evs_01_0035_b1080365743810">GPT</strong> indicates the GPT partition style.</p>
|
|
<ul id="evs_faq_0131__evs_01_0035_ul1426017189542"><li id="evs_faq_0131__evs_01_0035_li102601818165411">If the disk partitions displayed are inconsistent with those obtained in <a href="#evs_faq_0131__evs_01_0035_li4640174163019">1</a>, the possible reason may be that existing partitions uses GPT and there is unallocated disk space. In this case, you cannot query all the partitions using <strong id="evs_faq_0131__evs_01_0035_b1686601434418">fdisk -l</strong>. Go to <a href="#evs_faq_0131__evs_01_0035_section7627683297">Method 2: Check Partition Style and File System Format Using parted</a>.</li><li id="evs_faq_0131__evs_01_0035_li662513369540">If the disk partitions displayed are consistent with those obtained in <a href="#evs_faq_0131__evs_01_0035_li4640174163019">1</a>, continue with the following operations.</li></ul>
|
|
</p></li><li id="evs_faq_0131__evs_01_0035_li28968321150"><span>Run the following command to view the partition's file system format:</span><p><p id="evs_faq_0131__evs_01_0035_p99001247131718"><strong id="evs_faq_0131__evs_01_0035_b1708526520162011">blkid</strong> <em id="evs_faq_0131__evs_01_0035_i1458842329162011">Disk partition</em></p>
|
|
<p id="evs_faq_0131__evs_01_0035_p3765815178">In this example, run the following command:</p>
|
|
<p id="evs_faq_0131__evs_01_0035_p11896113281519"><strong id="evs_faq_0131__evs_01_0035_b9289131013187">blkid /dev/vdb1</strong></p>
|
|
<pre class="screen" id="evs_faq_0131__evs_01_0035_screen142881389248">[root@ecs-test-0001 ~]# blkid /dev/vdb1
|
|
/dev/vdb1: UUID="0b3040e2-1367-4abb-841d-ddb0b92693df" TYPE="ext4"</pre>
|
|
<p id="evs_faq_0131__evs_01_0035_p1889743231517">In the command output, the <strong id="evs_faq_0131__evs_01_0035_b051922918198">TYPE</strong> value is <strong id="evs_faq_0131__evs_01_0035_b9725153118199">ext4</strong>, indicating that <strong id="evs_faq_0131__evs_01_0035_b1870193414198">/dev/vdb1</strong>'s file system format is <strong id="evs_faq_0131__evs_01_0035_b14956113621919">ext4</strong>.</p>
|
|
</p></li><li id="evs_faq_0131__evs_01_0035_li116211321204"><span>Run the following command to view the file system status:</span><p><p id="evs_faq_0131__evs_01_0035_p176219327208">ext*: <strong id="evs_faq_0131__evs_01_0035_b946534714239">e2fsck -n</strong> <em id="evs_faq_0131__evs_01_0035_i4129105002315">Disk partition</em></p>
|
|
<p id="evs_faq_0131__evs_01_0035_p10113154732210">xfs: <strong id="evs_faq_0131__evs_01_0035_b6606115715237">xfs_repair -n</strong> <em id="evs_faq_0131__evs_01_0035_i156915210243">Disk partition</em></p>
|
|
<p id="evs_faq_0131__evs_01_0035_p156212321200">In this example, the ext4 file system is used. Therefore, run the following command:</p>
|
|
<p id="evs_faq_0131__evs_01_0035_p36223292011"><strong id="evs_faq_0131__evs_01_0035_b18280163812314">e2fsck -n /dev/vdb1</strong></p>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p1162113202010">Information similar to the following is displayed:<pre class="screen" id="evs_faq_0131__evs_01_0035_screen163052167259">[root@ecs-test-0001 ~]# e2fsck -n /dev/vdb1
|
|
e2fsck 1.42.9 (28-Dec-2013)
|
|
Warning! /dev/vdb1 is mounted.
|
|
Warning: skipping journal recovery because doing a read-only filesystem check.
|
|
/dev/vdb1: clean, 11/6553600 files, 459544/26214144 blocks</pre>
|
|
</div>
|
|
<p id="evs_faq_0131__evs_01_0035_p18631932122018">If the file system status is <strong id="evs_faq_0131__evs_01_0035_b1633615203278">clean</strong>, the file system is normal. Otherwise, rectify the faulty and then perform the capacity expansion.</p>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="evs_faq_0131__evs_01_0035_section7627683297"><a name="evs_faq_0131__evs_01_0035_section7627683297"></a><a name="evs_01_0035_section7627683297"></a><h4 class="sectiontitle">Method 2: Check Partition Style and File System Format Using parted</h4><ol id="evs_faq_0131__evs_01_0035_ol98829579413"><li id="evs_faq_0131__evs_01_0035_li62452961164027"><span>Run the following command to view all the disks attached to the <span id="evs_faq_0131__evs_01_0035_text20805162723010">server</span>:</span><p><p id="evs_faq_0131__evs_01_0035_p3438318916414"><strong id="evs_faq_0131__evs_01_0035_b185408516411">lsblk</strong></p>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p5454788116416">Information similar to the following is displayed:<pre class="screen" id="evs_faq_0131__evs_01_0035_screen11513730164145">[root@ecs-test-0001 ~]# lsblk
|
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
|
vda 253:0 0 40G 0 disk
|
|
└─vda1 253:1 0 40G 0 part /
|
|
vdb 253:16 0 150G 0 disk
|
|
└─vdb1 253:17 0 100G 0 part /mnt/sdc</pre>
|
|
</div>
|
|
<p id="evs_faq_0131__evs_01_0035_p10211121533410">In this example, data disk <strong id="evs_faq_0131__evs_01_0035_b530717142814">/dev/vdb</strong> already has partition <strong id="evs_faq_0131__evs_01_0035_b6308101192814">/dev/vdb1</strong> before capacity expansion, and the additional 50 GiB added has not been allocated yet. Therefore, <strong id="evs_faq_0131__evs_01_0035_b43080172820">/dev/vdb</strong> has 150 GiB, and <strong id="evs_faq_0131__evs_01_0035_b3309516287">/dev/vdb1</strong> has 100 GiB.</p>
|
|
<div class="note" id="evs_faq_0131__evs_01_0035_note655644391219"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_faq_0131__evs_01_0035_evs_01_0035_p1877914401139">If you run <strong id="evs_faq_0131__evs_01_0035_evs_01_0035_b10269165412545">lsblk</strong> and find out that disk <strong id="evs_faq_0131__evs_01_0035_evs_01_0035_b726955417543">/dev/vdb</strong> has no partitions, format the disk by referring to <a href="evs_faq_0073.html">How Do I Extend the File System of an Unpartitioned Data Disk in Linux?</a> and expand the capacity. Otherwise, the additional space cannot be used after expansion.</p>
|
|
</div></div>
|
|
</p></li><li id="evs_faq_0131__evs_01_0035_li1188255724115"><span>Run the following command and enter <strong id="evs_faq_0131__evs_01_0035_b842352706203657">p</strong> to view the disk partition style:</span><p><p id="evs_faq_0131__evs_01_0035_p12882155764115"><strong id="evs_faq_0131__evs_01_0035_b1025693618203712">parted</strong> <em id="evs_faq_0131__evs_01_0035_i1926238006203712">Disk</em></p>
|
|
<p id="evs_faq_0131__evs_01_0035_p53339869164347">For example, run the following command to view <strong id="evs_faq_0131__evs_01_0035_b842352706203733">/dev/vdb</strong>'s partition style:</p>
|
|
<p id="evs_faq_0131__evs_01_0035_p10864018164411"><strong id="evs_faq_0131__evs_01_0035_b44426524164414">parted /dev/vdb</strong></p>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p11882057144110">Information similar to the following is displayed:<pre class="screen" id="evs_faq_0131__evs_01_0035_screen135782815193">[root@ecs-test-0001 ~]# parted /dev/vdb
|
|
GNU Parted 3.1
|
|
Using /dev/vdb
|
|
Welcome to GNU Parted! Type 'help' to view a list of commands.
|
|
(parted) p
|
|
Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the
|
|
disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?
|
|
Fix/Ignore/Cancel? Fix
|
|
Warning: Not all of the space available to /dev/vdb appears to be used, you can fix the GPT to use all of the space (an extra 104857600
|
|
blocks) or continue with the current setting?
|
|
Fix/Ignore? Fix
|
|
Model: Virtio Block Device (virtblk)
|
|
Disk /dev/vdb: 161GiB
|
|
Sector size (logical/physical): 512B/512B
|
|
Partition Table: gpt
|
|
Disk Flags:
|
|
|
|
Number Start End Size File system Name Flags
|
|
1 1049kB 107GiB 107GiB ext4 test
|
|
|
|
(parted) </pre>
|
|
</div>
|
|
<div class="p" id="evs_faq_0131__evs_01_0035_p47387560145229"><strong id="evs_faq_0131__evs_01_0035_b7551103235017">Partition Table</strong> indicates the disk partition style. <strong id="evs_faq_0131__evs_01_0035_b531592313580">Partition Table: msdos</strong> means MBR, <strong id="evs_faq_0131__evs_01_0035_b13221941009">Partition Table: gpt</strong> means GPT, and <strong id="evs_faq_0131__evs_01_0035_b97038485011">Partition Table: loop</strong> means that the whole disk is partitioned.<ul id="evs_faq_0131__evs_01_0035_ul576616254336"><li id="evs_faq_0131__evs_01_0035_li77667254332">If the following error information is displayed, enter <strong id="evs_faq_0131__evs_01_0035_b205671610153013">Fix</strong>.<pre class="screen" id="evs_faq_0131__evs_01_0035_screen1044151515313">Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the
|
|
disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?</pre>
|
|
<p id="evs_faq_0131__evs_01_0035_p1219425063112">The GPT partition table information is stored at the start of the disk. To reduce the risk of damage, a backup of the information is saved at the end of the disk. When you expand the disk capacity, the end of the disk changes accordingly. In this case, enter <strong id="evs_faq_0131__evs_01_0035_b1912311713612">Fix</strong> to move the backup file of the information to new disk end.</p>
|
|
</li><li id="evs_faq_0131__evs_01_0035_li866116694718">If the following warning information is displayed, enter <strong id="evs_faq_0131__evs_01_0035_b78091630103715">Fix</strong>.<pre class="screen" id="evs_faq_0131__evs_01_0035_screen1450718714591">Warning: Not all of the space available to /dev/vdb appears to be used, you can fix the GPT to use all of the space (an extra 104857600
|
|
blocks) or continue with the current setting?
|
|
Fix/Ignore? Fix</pre>
|
|
<p id="evs_faq_0131__evs_01_0035_p2942122165910">Enter <strong id="evs_faq_0131__evs_01_0035_b9518141113384">Fix</strong> as prompted. The system automatically sets the GPT partition style for the additional space.</p>
|
|
</li></ul>
|
|
</div>
|
|
</p></li><li id="evs_faq_0131__evs_01_0035_li25527458164622"><span>Enter <strong id="evs_faq_0131__evs_01_0035_b84235270620397">q</strong> and press <strong id="evs_faq_0131__evs_01_0035_b842352706203910">Enter</strong> to exit parted.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="evs_01_0077.html">Capacity Expansion</a></div>
|
|
</div>
|
|
</div>
|
|
|