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>
422 lines
58 KiB
HTML
422 lines
58 KiB
HTML
<a name="evs_01_0018"></a><a name="evs_01_0018"></a>
|
|
|
|
<h1 class="topictitle1">Extending Partitions and File Systems for SCSI Disks (Linux)</h1>
|
|
<div id="body1506410165082"><div class="section" id="evs_01_0018__section4385650719406"><h4 class="sectiontitle">Scenarios</h4><p id="evs_01_0018__p2029473616495">After a disk is expanded on the management console, the disk size is enlarged, but the additional space cannot be used directly.</p>
|
|
<p id="evs_01_0018__p6821893715">In Linux, you must allocate the additional space to an existing partition or a new partition.</p>
|
|
<div class="p" id="evs_01_0018__p24596192205637">This section uses CentOS 7.4 64bit as the sample OS to describe how to extend an MBR partition of a SCSI data disk. The method for allocating the additional space varies with the server OS. This section is used for reference only. For detailed operations and differences, see the corresponding OS documents.<ul id="evs_01_0018__ul7123597717"><li id="evs_01_0018__li78122016151915"><a href="#evs_01_0018__section12265143819280">Creating a New MBR Partition</a></li><li id="evs_01_0018__li15123599713"><a href="#evs_01_0018__section31113372194023">Extending an Existing MBR Partition</a></li></ul>
|
|
</div>
|
|
<div class="notice" id="evs_01_0018__note206209142082"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="evs_01_0018__en-us_topic_0017616396_p1185312105267">Performing the expansion operations with caution. Incorrect operations may lead to data loss or exceptions. So you are advised to back up the disk data using CBR or snapshots before expansion. For details about using CBR, see <a href="evs_01_0110.html">Managing EVS Backups</a>. For details about using snapshots, see <a href="en-us_topic_0066615262.html">Creating a Snapshot</a>.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="evs_01_0018__section19088989195835"><h4 class="sectiontitle">Prerequisites</h4><ul id="evs_01_0018__evs_01_0072_ul28913191171813"><li id="evs_01_0018__evs_01_0072_li1233185612427">You have expanded the disk capacity and attached the disk to a <span id="evs_01_0018__evs_01_0072_text1615511293514">server</span> on the management console. For details, see <a href="evs_01_0007.html">Expanding Capacity for an In-use EVS Disk</a> or <a href="evs_01_0008.html">Expanding Capacity for an Available EVS Disk</a>.</li><li id="evs_01_0018__evs_01_0072_en-us_topic_0000001855168897_en-us_topic_0044524740_li36962755115557">You have logged in to the <span id="evs_01_0018__evs_01_0072_text1689703784510">server</span>.<ul id="evs_01_0018__evs_01_0072_en-us_topic_0000001855168897_en-us_topic_0044524740_ul6229092211568"><li id="evs_01_0018__evs_01_0072_en-us_topic_0000001855168897_en-us_topic_0044524740_li197989548398">For how to log in to an ECS, see the <em id="evs_01_0018__evs_01_0072_i418924714426">Elastic Cloud Server User Guide</em>.</li><li id="evs_01_0018__evs_01_0072_en-us_topic_0000001855168897_en-us_topic_0044524740_li7220898115452">For how to log in to a BMS, see the <em id="evs_01_0018__evs_01_0072_i62114310438">Bare Metal Server User Guide</em>.</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="evs_01_0018__section12265143819280"><a name="evs_01_0018__section12265143819280"></a><a name="section12265143819280"></a><h4 class="sectiontitle">Creating a New MBR Partition</h4><p id="evs_01_0018__p20813164219293">Originally, data disk <strong id="evs_01_0018__b0459749123915">/dev/sda</strong> has 50 GiB and one partition (<strong id="evs_01_0018__b14592498392">/dev/sda1</strong>), and then 50 GiB is added to the disk. The following procedure shows you how to create a new MBR partition <strong id="evs_01_0018__b1532161912400">/dev/sda2</strong> with this 50 GiB.</p>
|
|
<ol id="evs_01_0018__ol64002072195025"><li id="evs_01_0018__li1253360195025"><span>Run the following command to view the disk partition information:</span><p><p id="evs_01_0018__p5241531195025"><strong id="evs_01_0018__b8038932195025">fdisk -l</strong></p>
|
|
<div class="p" id="evs_01_0018__p21910876195025">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen16607193113518">[root@ecs-scsi ~]# 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/sda: 107.4 GiB, 107374182400 bytes, 209715200 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: 0x915ffe6a
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/sda1 2048 104857599 52427776 83 Linux</pre>
|
|
</div>
|
|
<div class="p" id="evs_01_0018__p137292716363">View the <strong id="evs_01_0018__b1381601913418">/dev/sda</strong> capacity and check whether the additional space is included.<ul id="evs_01_0018__ul372977103615"><li id="evs_01_0018__li1573027163610">If the additional space is not included, refresh the capacity according to <a href="#evs_01_0018__li1311112192367">2</a>.</li><li id="evs_01_0018__li177301374361">If the additional space is included, go to <a href="#evs_01_0018__li14771329195025">3</a>.</li></ul>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li1311112192367"><a name="evs_01_0018__li1311112192367"></a><a name="li1311112192367"></a><span>(Optional) Run the following command to update the capacity of the SCSI data disk:</span><p><ol type="a" id="evs_01_0018__ol1673017711363"><li id="evs_01_0018__li87300717367">Run the following command to update the disk capacity on <span id="evs_01_0018__evs_01_0018_text37663996163357">the server</span>:<p id="evs_01_0018__evs_01_0018_p2504993515476"><strong id="evs_01_0018__evs_01_0018_b5416949915584">echo 1 > /sys/class/scsi_device/</strong><em id="evs_01_0018__evs_01_0018_i2093191415584">%d:%d:%d:%d</em><strong id="evs_01_0018__evs_01_0018_b1776344815584">/device/rescan &</strong></p>
|
|
<p id="evs_01_0018__evs_01_0018_p6560736155816">In the command, <strong id="evs_01_0018__evs_01_0018_b8423527062071">%d:%d:%d:%d</strong> indicates a folder in the <strong id="evs_01_0018__evs_01_0018_b84235270620721">/sys/class/scsi_device/</strong> directory and can be obtained using <strong id="evs_01_0018__evs_01_0018_b171249295520756">ll /sys/class/scsi_device/</strong>.</p>
|
|
<div class="p" id="evs_01_0018__evs_01_0018_p389486591604">Information similar to the following is displayed: (<strong id="evs_01_0018__evs_01_0018_b84235270620813">2:0:0:0</strong> indicates the folder to be obtained.)<pre class="screen" id="evs_01_0018__evs_01_0018_screen1412245416038">cs-xen-02:/sys/class/scsi_device # ll /sys/class/scsi_device/
|
|
total 0
|
|
lrwxrwxrwx 1 root root 0 Sep 26 11:37 2:0:0:0 -> ../../devices/xen/vscsi-2064/host2/target2:0:0/2:0:0:0/scsi_device/2:0:0:0</pre>
|
|
</div>
|
|
<p id="evs_01_0018__evs_01_0018_p1402441415471">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__evs_01_0018_p21953339154642"><strong id="evs_01_0018__evs_01_0018_b4285737154648">echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan &</strong></p>
|
|
</li><li id="evs_01_0018__li137318793613">After the disk capacity is updated, run the following command to view the disk partition information again:<p id="evs_01_0018__p2731127153613"><a name="evs_01_0018__li137318793613"></a><a name="li137318793613"></a><strong id="evs_01_0018__b167316713368">fdisk -l</strong></p>
|
|
<p id="evs_01_0018__p1173116753616">If the additional space is included, go to <a href="#evs_01_0018__li14771329195025">3</a>.</p>
|
|
</li></ol>
|
|
</p></li><li id="evs_01_0018__li14771329195025"><a name="evs_01_0018__li14771329195025"></a><a name="li14771329195025"></a><span>Run the following command to enter fdisk:</span><p><p id="evs_01_0018__p6144114623920"><strong id="evs_01_0018__b3702144810435">fdisk</strong> <em id="evs_01_0018__i177033487431">Disk</em></p>
|
|
<p id="evs_01_0018__p12312131684011">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p34413303195025"><strong id="evs_01_0018__b2028708619">fdisk /dev/sda</strong></p>
|
|
<div class="p" id="evs_01_0018__p36014179195025"><span id="evs_01_0018__text41284277195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen090722113110">[root@ecs-scsi ~]# fdisk /dev/sda
|
|
Welcome to fdisk (util-linux 2.23.2).
|
|
|
|
Changes will remain in memory only, until you decide to write them.
|
|
Be careful before using the write command.
|
|
|
|
|
|
Command (m for help):</pre>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li6345756195025"><span>Enter <strong id="evs_01_0018__b8562368176">n</strong> and press <strong id="evs_01_0018__b1756317616178">Enter</strong> to create a new partition.</span><p><div class="p" id="evs_01_0018__p30880659195025"><span id="evs_01_0018__text55626967195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen30531245195025">Command (m for help): n
|
|
Partition type:
|
|
p primary (1 primary, 0 extended, 3 free)
|
|
e extended
|
|
Select (default p):</pre>
|
|
</div>
|
|
<div class="p" id="evs_01_0018__p181971445182818">There are two types of disk partitions:<ul id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_ul5364496116158"><li id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_li1304260716158">Choosing <span class="parmvalue" id="evs_01_0018__evs_01_0109_evs_01_0109_parmvalue5027460516158"><b>p</b></span> creates a primary partition.</li><li id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_li4981826916158">Choosing <span class="parmvalue" id="evs_01_0018__evs_01_0109_evs_01_0109_parmvalue4571123816158"><b>e</b></span> creates an extended partition.</li></ul>
|
|
<div class="note" id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_note13373129016"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_p4376112918117">If MBR is used, a maximum of four primary partitions, or three primary partitions plus one extended partition can be created. The extended partition must be divided into logical partitions before use.</p>
|
|
<p id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_p20170151213510">Disk partitions created using GPT are not categorized.</p>
|
|
</div></div>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li451384024818"><span>In this example, a primary partition is created. Therefore, enter <strong id="evs_01_0018__b775412215448">p</strong> and press <strong id="evs_01_0018__b147557219445">Enter</strong> to create a primary partition.</span><p><div class="p" id="evs_01_0018__p115131740184811">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen14177739195017">Select (default p): p
|
|
Partition number (2-4, default 2):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p1451494010489"><span class="parmname" id="evs_01_0018__parmname11390610184415"><b>Partition number</b></span> indicates the serial number of the primary partition. Because partition number 1 has been used, the value ranges from <strong id="evs_01_0018__b6390191014448">2</strong> to <strong id="evs_01_0018__b93919103447">4</strong>.</p>
|
|
</p></li><li id="evs_01_0018__li823334618472"><span>Enter the serial number of the primary partition and press <strong id="evs_01_0018__b192334270442">Enter</strong>. Partition number <span class="parmvalue" id="evs_01_0018__parmvalue1423317275444"><b>2</b></span> is used in this example. Therefore, enter <strong id="evs_01_0018__b202341727144418">2</strong> and press <strong id="evs_01_0018__b323652720443">Enter.</strong></span><p><div class="p" id="evs_01_0018__p1623374615477">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen1627017376515">Partition number (2-4, default 2): 2
|
|
First sector (104857600-209715199, default 104857600):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p0234546164712"><strong id="evs_01_0018__b1113814579443">First sector</strong> indicates the start sector. The value ranges from <strong id="evs_01_0018__b49047427449">104857600</strong> to <strong id="evs_01_0018__b7904124204419">209715199</strong>, and the default value is <strong id="evs_01_0018__b16905134210448">104857600</strong>.</p>
|
|
</p></li><li id="evs_01_0018__li41769519195025"><span>Enter the new partition's start sector and press <strong id="evs_01_0018__b660423111452">Enter</strong>. In this example, the default start sector is used.</span><p><p id="evs_01_0018__p1339431213110">The system displays the start and end sectors of the partition's available space. You can customize the value within this range or use the default value. The start sector must be smaller than the partition's end sector.</p>
|
|
<div class="p" id="evs_01_0018__p62653510195025"><span id="evs_01_0018__text44244203195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen7933144012128">First sector (104857600-209715199, default 104857600):
|
|
Using default value 104857600
|
|
Last sector, +sectors or +size{K,M,G} (104857600-209715199, default 209715199):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p185731896582"><strong id="evs_01_0018__b116154794617">Last sector</strong> indicates the end sector. The value ranges from <strong id="evs_01_0018__b1188533514619">104857600</strong> to <strong id="evs_01_0018__b1488673514616">209715199</strong>, and the default value is <strong id="evs_01_0018__b17886235104615">209715199</strong>.</p>
|
|
</p></li><li id="evs_01_0018__li63358740195025"><span>Enter the new partition's end sector and press <strong id="evs_01_0018__b1861201774711">Enter</strong>. In this example, the default end sector is used.</span><p><p id="evs_01_0018__p3623215214">The system displays the start and end sectors of the partition's available space. You can customize the value within this range or use the default value. The start sector must be smaller than the partition's end sector.</p>
|
|
<div class="p" id="evs_01_0018__p49663971195025"><span id="evs_01_0018__text27887840195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen1393613289136">Last sector, +sectors or +size{K,M,G} (104857600-209715199, default 209715199):
|
|
Using default value 209715199
|
|
Partition 2 of type Linux and of size 50 GiB is set
|
|
|
|
Command (m for help):</pre>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li33357756195025"><span>Enter <strong id="evs_01_0018__b1255961419488">p</strong> and press <strong id="evs_01_0018__b175595147487">Enter</strong> to view the new partition.</span><p><div class="p" id="evs_01_0018__p775454195221"><span id="evs_01_0018__text31784354195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen1584114447131">Command (m for help): p
|
|
|
|
Disk /dev/sda: 107.4 GiB, 107374182400 bytes, 209715200 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: 0x915ffe6a
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/sda1 2048 104857599 52427776 83 Linux
|
|
/dev/sda2 104857600 209715199 52428800 83 Linux
|
|
|
|
Command (m for help):</pre>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li66935752195025"><span>Enter <strong id="evs_01_0018__b1190222064814">w</strong> and press <strong id="evs_01_0018__b16903220194818">Enter</strong> to write the changes to the partition table.</span><p><div class="p" id="evs_01_0018__p756878195025"><span id="evs_01_0018__text29910259195025">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen480710018144">Command (m for help): w
|
|
The partition table has been altered!
|
|
|
|
Calling ioctl() to re-read partition table.
|
|
|
|
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
|
|
The kernel still uses the old table. The new table will be used at
|
|
the next reboot or after you run partprobe(8) or kpartx(8)
|
|
Syncing disks.</pre>
|
|
</div>
|
|
<div class="note" id="evs_01_0018__note4366792011219"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__p1060395711212">In case that you want to discard the changes made before, you can exit fdisk by entering <strong id="evs_01_0018__b842352706161749">q</strong>.</p>
|
|
</div></div>
|
|
</p></li><li id="evs_01_0018__li65550858195025"><span>Run the following command to synchronize the new partition table to the OS:</span><p><p class="litext" id="evs_01_0018__p2882928101423"><strong id="evs_01_0018__b53086813195025">partprobe</strong></p>
|
|
</p></li><li id="evs_01_0018__li58324522195025"><span>Run the following command to set the file system format for the new partition:</span><p><p id="evs_01_0018__p9952448106"><strong id="evs_01_0018__b442415416485">mkfs -t</strong> <em id="evs_01_0018__i0425185414487">File system</em> <em id="evs_01_0018__i742615414488">Disk partition</em></p>
|
|
<ul id="evs_01_0018__ul17185855123210"><li id="evs_01_0018__li718516552324">Sample command of the ext* file system:<p id="evs_01_0018__p274718172610"><a name="evs_01_0018__li718516552324"></a><a name="li718516552324"></a><strong id="evs_01_0018__b2759194614613">mkfs -t ext4 /dev/sda2</strong></p>
|
|
<div class="p" id="evs_01_0018__p778911441404"><span id="evs_01_0018__text67874442008">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen778910444016">[root@ecs-scsi ~]# mkfs -t ext4 /dev/sda2
|
|
mke2fs 1.42.9 (28-Dec-2013)
|
|
Filesystem label=
|
|
OS type: Linux
|
|
Block size=4096 (log=2)
|
|
Fragment size=4096 (log=2)
|
|
Stride=0 blocks, Stripe width=0 blocks
|
|
3276800 inodes, 13107200 blocks
|
|
655360 blocks (5.00%) reserved for the super user
|
|
First data block=0
|
|
Maximum filesystem blocks=2162163712
|
|
400 block groups
|
|
32768 blocks per group, 32768 fragments per group
|
|
8192 inodes per group
|
|
Superblock backups stored on blocks:
|
|
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
|
|
4096000, 7962624, 11239424
|
|
|
|
Allocating group tables: done
|
|
Writing inode tables: done
|
|
Creating journal (32768 blocks): done
|
|
Writing superblocks and filesystem accounting information: done</pre>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="evs_01_0018__ul58123393334"><li id="evs_01_0018__li1281214392337">Sample command of the xfs file system:<p id="evs_01_0018__p1420161913418"><a name="evs_01_0018__li1281214392337"></a><a name="li1281214392337"></a><strong id="evs_01_0018__b053913165349">mkfs -t xfs /dev/sda2</strong></p>
|
|
<p id="evs_01_0018__p161621548143418"><span id="evs_01_0018__text197371349113410">Information similar to the following is displayed:</span></p>
|
|
<pre class="screen" id="evs_01_0018__screen164115544347">[root@ecs-scsi ~]# mkfs -t xfs /dev/sda2
|
|
meta-data=/dev/sda2 isize=512 agcount=4, agsize=3276800 blks
|
|
= sectsz=512 attr=2, projid32bit=1
|
|
= crc=1 finobt=0, sparse=0
|
|
data = bsize=4096 blocks=13107200, imaxpct=25
|
|
= sunit=0 swidth=0 blks
|
|
naming =version2 bsize=4096 ascii-ci=0 ftype=1
|
|
log =internal log bsize=4096 blocks=6400, version=2
|
|
= sectsz=512 sunit=0 blks, lazy-count=1
|
|
realtime =none extsz=4096 blocks=0, rtextents=0</pre>
|
|
</li></ul>
|
|
<p id="evs_01_0018__p77896448010">The formatting takes a while, and you need to observe the system running status. Once <strong id="evs_01_0018__b15216434104914">done</strong> is displayed in the command output, the formatting is complete.</p>
|
|
</p></li><li id="evs_01_0018__li168221027111514"><span>(Optional) Run the following command to create a mount point:</span><p><p id="evs_01_0018__evs_01_0109_p461184732217">Perform this step if you want to mount the partition on a new mount point.</p>
|
|
<p id="evs_01_0018__evs_01_0109_p3611447172210"><strong id="evs_01_0018__evs_01_0109_b5314195503820">mkdir</strong> <em id="evs_01_0018__evs_01_0109_i12315555103819">Mount point</em></p>
|
|
<p id="evs_01_0018__evs_01_0109_p12611147172210">In this example, run the following command to create the <strong id="evs_01_0018__evs_01_0109_b15799115618383">/mnt/test</strong> mount point:</p>
|
|
<p id="evs_01_0018__evs_01_0109_p1661144710223"><strong id="evs_01_0018__evs_01_0109_b4364122213513">mkdir</strong> <strong id="evs_01_0018__evs_01_0109_b1365132211351">/mnt/test</strong></p>
|
|
</p></li><li id="evs_01_0018__li21354544195025"><span>Run the following command to mount the new partition:</span><p><p id="evs_01_0018__p176844133313"><strong id="evs_01_0018__b117374404914">mount</strong> <em id="evs_01_0018__i0174134419496">Disk partition</em> <em id="evs_01_0018__i171741544134915">Mount point</em></p>
|
|
<p id="evs_01_0018__p376916453319">In this example, run the following command to mount the new partition <strong id="evs_01_0018__b12461147124920">/dev/sda2</strong> on <strong id="evs_01_0018__b624794712496">/mnt/test</strong>:</p>
|
|
<p id="evs_01_0018__p11769194183313"><strong id="evs_01_0018__b187691047337">mount /dev/sda2 /mnt/test</strong></p>
|
|
<div class="note" id="evs_01_0018__note0542201631620"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0109_p14348212195025">If the new partition is mounted on a directory that is not empty, the subdirectories and files in the directory will be hidden. Therefore, you are advised to mount the new partition on an empty directory or a new directory. If the new partition must be mounted on a directory that is not empty, move the subdirectories and files in this directory to another directory temporarily. After the partition is successfully mounted, move the subdirectories and files back.</p>
|
|
</div></div>
|
|
</p></li><li id="evs_01_0018__li167131050621"><span>Run the following command to view the mount result:</span><p><p id="evs_01_0018__p971317501720"><strong id="evs_01_0018__b157132501723">df -TH</strong></p>
|
|
<div class="p" id="evs_01_0018__p19713650225"><span id="evs_01_0018__text87138505216">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen10714850622">[root@ecs-scsi ~]# df -TH
|
|
Filesystem Type Size Used Avail Use% Mounted on
|
|
/dev/vda1 ext4 43G 2.0G 39G 5% /
|
|
devtmpfs devtmpfs 509M 0 509M 0% /dev
|
|
tmpfs tmpfs 520M 0 520M 0% /dev/shm
|
|
tmpfs tmpfs 520M 7.2M 513M 2% /run
|
|
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
|
|
tmpfs tmpfs 104M 0 104M 0% /run/user/0
|
|
/dev/sda1 ext4 53G 55M 50G 1% /mnt/sdc
|
|
/dev/sda2 ext4 53G 55M 50G 1% /mnt/test</pre>
|
|
<div class="note" id="evs_01_0018__note18200144517281"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__p520194516281">If the <span id="evs_01_0018__text112014451284">server</span> is restarted, the mounting will become invalid. You can modify the <strong id="evs_01_0018__b101111624342">/etc/fstab</strong> file to configure automount at startup. For details, see <a href="#evs_01_0018__section1122546162318">Configuring Automatic Mounting at System Start</a>.</p>
|
|
</div></div>
|
|
</div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="evs_01_0018__section31113372194023"><a name="evs_01_0018__section31113372194023"></a><a name="section31113372194023"></a><h4 class="sectiontitle">Extending an Existing MBR Partition</h4><div class="notice" id="evs_01_0018__note136201693912"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="evs_01_0018__evs_01_0109_p065513114456">If the additional space is allocated to an existing partition, data on the disk will not be cleared but you must use <strong id="evs_01_0018__evs_01_0109_b1814492110326">umount</strong> to unmount the existing partition. In this case, services will be affected.</p>
|
|
</div></div>
|
|
<p id="evs_01_0018__p1393412227431">Originally, SCSI data disk <strong id="evs_01_0018__b24141315910">/dev/sda</strong> has 100 GiB and two partitions (<strong id="evs_01_0018__b9519138912">/dev/sda1</strong> and <strong id="evs_01_0018__b18610139919">/dev/sda2</strong>), and then 50 GiB is added to the disk. The following procedure shows you how to add this 50 GiB to the existing MBR partition <strong id="evs_01_0018__b860283619105">/dev/sda2</strong>.</p>
|
|
<p id="evs_01_0018__p97625416398">During an expansion, the additional space is added to the end of the disk. Therefore, if the disk has multiple partitions, the additional space can only be allocated to the partition at the disk end.</p>
|
|
<ol id="evs_01_0018__ol1293195319479"><li id="evs_01_0018__li6396237219479"><a name="evs_01_0018__li6396237219479"></a><a name="li6396237219479"></a><span>Run the following command to view the disk partition information:</span><p><p id="evs_01_0018__p1385482419479"><strong id="evs_01_0018__b153942419479">fdisk -l</strong></p>
|
|
<div class="p" id="evs_01_0018__p3609954819479">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen1589053417329">[root@ecs-scsi ~]# 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/sda: 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: 0x915ffe6a
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/sda1 2048 104857599 52427776 83 Linux
|
|
/dev/sda2 104857600 209715199 52428800 83 Linux</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p163747161317">In the command output, take note of the partition's start and end sectors. In this example, <strong id="evs_01_0018__b104253641111">/dev/sda2</strong>'s start sector is <strong id="evs_01_0018__b44266651112">104857600</strong>, and its end sector is <strong id="evs_01_0018__b6427766113">209715199</strong>.</p>
|
|
<div class="p" id="evs_01_0018__p21681768143136">View the <strong id="evs_01_0018__b628163710114">/dev/sda</strong> capacity and check whether the additional space is included.<ul id="evs_01_0018__ul2151952921336"><li id="evs_01_0018__li1797905221336">If the additional space is not included, refresh the capacity according to <a href="#evs_01_0018__li11239195417383">2</a>.</li><li id="evs_01_0018__li2788192521341">If the additional space is included, take note of the start and end sectors of the target partition and then go to <a href="#evs_01_0018__li3879043619479">3</a>. These values will be used in the subsequent operations.</li></ul>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li11239195417383"><a name="evs_01_0018__li11239195417383"></a><a name="li11239195417383"></a><span>(Optional) Run the following command to update the capacity of the SCSI data disk:</span><p><ol type="a" id="evs_01_0018__ol6100626173919"><li id="evs_01_0018__li44977360154625">Run the following command to update the disk capacity on <span id="evs_01_0018__text37663996163357">the server</span>:<p id="evs_01_0018__p2504993515476"><strong id="evs_01_0018__b5416949915584">echo 1 > /sys/class/scsi_device/</strong><em id="evs_01_0018__i2093191415584">%d:%d:%d:%d</em><strong id="evs_01_0018__b1776344815584">/device/rescan &</strong></p>
|
|
<p id="evs_01_0018__p6560736155816">In the command, <strong id="evs_01_0018__b8423527062071">%d:%d:%d:%d</strong> indicates a folder in the <strong id="evs_01_0018__b84235270620721">/sys/class/scsi_device/</strong> directory and can be obtained using <strong id="evs_01_0018__b171249295520756">ll /sys/class/scsi_device/</strong>.</p>
|
|
<div class="p" id="evs_01_0018__p389486591604">Information similar to the following is displayed: (<strong id="evs_01_0018__b84235270620813">2:0:0:0</strong> indicates the folder to be obtained.)<pre class="screen" id="evs_01_0018__screen1412245416038">cs-xen-02:/sys/class/scsi_device # ll /sys/class/scsi_device/
|
|
total 0
|
|
lrwxrwxrwx 1 root root 0 Sep 26 11:37 2:0:0:0 -> ../../devices/xen/vscsi-2064/host2/target2:0:0/2:0:0:0/scsi_device/2:0:0:0</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p1402441415471">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p21953339154642"><strong id="evs_01_0018__b4285737154648">echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan &</strong></p>
|
|
</li><li id="evs_01_0018__li30485688154640">After the disk capacity is updated, run the following command to view the disk partition information again:<p id="evs_01_0018__p3158443116426"><a name="evs_01_0018__li30485688154640"></a><a name="li30485688154640"></a><strong id="evs_01_0018__b4187264016430">fdisk -l</strong></p>
|
|
<p id="evs_01_0018__p195121410184017">If the additional space is included, take note of the start and end sectors of the target partition and then go to <a href="#evs_01_0018__li3879043619479">3</a>. These values will be used in the subsequent operations.</p>
|
|
</li></ol>
|
|
</p></li><li id="evs_01_0018__li3879043619479"><a name="evs_01_0018__li3879043619479"></a><a name="li3879043619479"></a><span>Run the following command to unmount the partition:</span><p><p id="evs_01_0018__p17486737194816"><strong id="evs_01_0018__b1694591121720">umount</strong> <em id="evs_01_0018__i159474161714">Disk partition</em></p>
|
|
<p id="evs_01_0018__p194135115524">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p119093035317"><strong id="evs_01_0018__b19318175214425">umount /dev/sda2</strong></p>
|
|
</p></li><li id="evs_01_0018__li51489499541"><span>Run the following command to enter fdisk:</span><p><p id="evs_01_0018__p614812491542"><strong id="evs_01_0018__b1473314891716">fdisk</strong> <em id="evs_01_0018__i57340810177">Disk</em></p>
|
|
<p id="evs_01_0018__p20148194955411">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p8148184995420"><strong id="evs_01_0018__b141196385439">fdisk /dev/sda</strong></p>
|
|
<div class="p" id="evs_01_0018__p21491149185416"><span id="evs_01_0018__text1149134975416">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen28799442431">[root@ecs-scsi ~]# fdisk /dev/sda
|
|
Welcome to fdisk (util-linux 2.23.2).
|
|
|
|
Changes will remain in memory only, until you decide to write them.
|
|
Be careful before using the write command.
|
|
|
|
|
|
Command (m for help):</pre>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li17813113445312"><span>Run the following command to delete the partition to be extended:</span><p><ol type="a" id="evs_01_0018__ol1255935265514"><li id="evs_01_0018__li1224017347557">Enter <strong id="evs_01_0018__b17721144121712">d</strong> and press <strong id="evs_01_0018__b1772219411176">Enter</strong> to delete the partition.<div class="p" id="evs_01_0018__p15240173410553"><span id="evs_01_0018__text2024013435516">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen168714317577">Command (m for help): d
|
|
Partition number (1,2, default 2):</pre>
|
|
</div>
|
|
</li><li id="evs_01_0018__li5950232125616">Enter the partition number and press <strong id="evs_01_0018__b394735419178">Enter</strong> to delete the partition. In this example, enter <strong id="evs_01_0018__b1894865491718">2</strong>.<div class="p" id="evs_01_0018__p9950132125616"><span id="evs_01_0018__text995017325567">Information similar to the following is displayed:</span><pre class="screen" id="evs_01_0018__screen1338410320418">Partition number (1,2, default 2): 2
|
|
Partition 2 is deleted
|
|
|
|
Command (m for help): </pre>
|
|
</div>
|
|
<div class="note" id="evs_01_0018__note3667889916833"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__p6167463516833">After deleting the partition, re-create the partition according to the following steps, and data on this disk will not be lost.</p>
|
|
</div></div>
|
|
</li></ol>
|
|
</p></li><li id="evs_01_0018__li103625919479"><span>Enter <strong id="evs_01_0018__b11523669111138">n</strong> and press <strong id="evs_01_0018__b149560470211138">Enter</strong> to create a new partition.</span><p><div class="p" id="evs_01_0018__p59954713211919">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen85822126452">Command (m for help): n
|
|
Partition type:
|
|
p primary (1 primary, 0 extended, 3 free)
|
|
e extended
|
|
Select (default p): </pre>
|
|
</div>
|
|
<div class="p" id="evs_01_0018__p44635586111440">There are two types of disk partitions:<ul id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_ul5364496116158_1"><li id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_li1304260716158_1">Choosing <span class="parmvalue" id="evs_01_0018__evs_01_0109_evs_01_0109_parmvalue5027460516158_1"><b>p</b></span> creates a primary partition.</li><li id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_li4981826916158_1">Choosing <span class="parmvalue" id="evs_01_0018__evs_01_0109_evs_01_0109_parmvalue4571123816158_1"><b>e</b></span> creates an extended partition.</li></ul>
|
|
<div class="note" id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_note13373129016_1"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_p4376112918117_1">If MBR is used, a maximum of four primary partitions, or three primary partitions plus one extended partition can be created. The extended partition must be divided into logical partitions before use.</p>
|
|
<p id="evs_01_0018__evs_01_0109_evs_01_0109_evs_01_0109_p20170151213510_1">Disk partitions created using GPT are not categorized.</p>
|
|
</div></div>
|
|
</div>
|
|
</p></li><li id="evs_01_0018__li831073319479"><span>Ensure that the entered partition type is the same as the partition had before. In this example, a primary partition is used. Therefore, enter <strong id="evs_01_0018__b19682172911200">p</strong> and press <strong id="evs_01_0018__b868362972018">Enter</strong> to create a primary partition.</span><p><div class="p" id="evs_01_0018__p1124223819479">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen127275215452">Select (default p): p
|
|
Partition number (2-4, default 2):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p2155346311115"><span class="parmname" id="evs_01_0018__parmname3698543911112"><b>Partition number</b></span> indicates the serial number of the primary partition.</p>
|
|
</p></li><li id="evs_01_0018__li1872681419479"><span>Ensure that entered partition number is the same as the partition had before. In this example, partition number <strong id="evs_01_0018__b199631052112012">2</strong> is used. Therefore, enter <strong id="evs_01_0018__b109640523202">2</strong> and press <strong id="evs_01_0018__b996595219209">Enter</strong>.</span><p><div class="p" id="evs_01_0018__p13419762211924">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen6186122465">Partition number (2-4, default 2): 2
|
|
First sector (104857600-314572799, default 104857600):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p1093014711145">In the command output, <span class="parmname" id="evs_01_0018__parmname1744532415164930"><b>First sector</b></span> specifies the start sector.</p>
|
|
<div class="note" id="evs_01_0018__note41689024105742"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><div class="p" id="evs_01_0018__p19105357105846">Data will be lost if the following operations are performed:<ul id="evs_01_0018__ul36797169105915"><li id="evs_01_0018__li47641200105915">Select a start sector other than the partition had before.</li><li id="evs_01_0018__li5436174105919">Select an end sector smaller than the partition had before.</li></ul>
|
|
</div>
|
|
</div></div>
|
|
</p></li><li id="evs_01_0018__li4385698519479"><span>Ensure that the entered start sector is the same as the partition had before. In this example, start sector <strong id="evs_01_0018__b295081111219">104857600</strong> is recorded in <a href="#evs_01_0018__li6396237219479">1</a> or <a href="#evs_01_0018__li11239195417383">2</a>. Therefore, enter <strong id="evs_01_0018__b1195220114212">104857600</strong> and press <strong id="evs_01_0018__b109531311182111">Enter</strong>.</span><p><div class="p" id="evs_01_0018__p4693769519479">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen14769177114714">First sector (104857600-314572799, default 104857600):
|
|
Using default value 104857600
|
|
Last sector, +sectors or +size{K,M,G} (104857600-314572799, default 314572799):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p575928411210">In the command output, <span class="parmname" id="evs_01_0018__parmname1266702454165930"><b>Last sector</b></span> specifies the end sector.</p>
|
|
</p></li><li id="evs_01_0018__li4998406319479"><span>Ensure that the entered end sector is greater than or equal to the end sector recorded in <a href="#evs_01_0018__li6396237219479">1</a> or <a href="#evs_01_0018__li11239195417383">2</a>. In this example, the recorded end sector is <span class="parmvalue" id="evs_01_0018__parmvalue2059570501165946"><b>209715199</b></span>, and the default end sector is used. Therefore, enter <span class="parmvalue" id="evs_01_0018__parmvalue260557902165946"><b>314572799</b></span> and press <strong id="evs_01_0018__b1540247594165946">Enter</strong>.</span><p><div class="p" id="evs_01_0018__p5916855219479">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen4391735144817">Last sector, +sectors or +size{K,M,G} (104857600-314572799, default 314572799):
|
|
Using default value 314572799
|
|
Partition 2 of type Linux and of size 100 GiB is set
|
|
|
|
Command (m for help):</pre>
|
|
</div>
|
|
<p id="evs_01_0018__p5657681611229">The partition is created.</p>
|
|
</p></li><li id="evs_01_0018__li1308116219479"><span>Enter <strong id="evs_01_0018__b141165917513">p</strong> and press <strong id="evs_01_0018__b342195918514">Enter</strong> to print the partition details.</span><p><p id="evs_01_0018__p2217727419479">Information similar to the following is displayed:</p>
|
|
<pre class="screen" id="evs_01_0018__screen3652115091714">Command (m for help): p
|
|
|
|
Disk /dev/sda: 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: 0x915ffe6a
|
|
|
|
Device Boot Start End Blocks Id System
|
|
/dev/sda1 2048 104857599 52427776 83 Linux
|
|
/dev/sda2 104857600 314572799 104857600 83 Linux
|
|
|
|
Command (m for help):</pre>
|
|
</p></li><li id="evs_01_0018__li656115819479"><span>Enter <strong id="evs_01_0018__b842352706192329">w</strong> and press <strong id="evs_01_0018__b842352706192333">Enter</strong> to write the changes to the partition table.</span><p><div class="p" id="evs_01_0018__p5062160119479">Information similar to the following is displayed: (The partition is successfully created.)<pre class="screen" id="evs_01_0018__screen1501624175716">Command (m for help): w
|
|
The partition table has been altered!
|
|
|
|
Calling ioctl() to re-read partition table.
|
|
|
|
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
|
|
The kernel still uses the old table. The new table will be used at
|
|
the next reboot or after you run partprobe(8) or kpartx(8)
|
|
Syncing disks.</pre>
|
|
</div>
|
|
<div class="note" id="evs_01_0018__note65949998112750"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0109_p1060395711212">In case that you want to discard the changes made before, you can exit fdisk by entering <strong id="evs_01_0018__evs_01_0109_b842352706161749">q</strong>.</p>
|
|
</div></div>
|
|
</p></li><li id="evs_01_0018__li1131119242916"><span>Run the following command to synchronize the new partition table to the OS:</span><p><p class="litext" id="evs_01_0018__p203111210299"><strong id="evs_01_0018__b03111210291">partprobe</strong></p>
|
|
</p></li><li id="evs_01_0018__li1819014933917"><span>Perform the following operations based on the file system of the disk:</span><p><ul id="evs_01_0018__ul1946411684016"><li id="evs_01_0018__li13464816154019">For the <strong id="evs_01_0018__b517031272514">ext</strong><em id="evs_01_0018__i121701512192510">*</em> file system<ol type="a" id="evs_01_0018__ol3784106184320"><li id="evs_01_0018__li43615331000">Run the following command to check the correctness of the file system on the partition:<p id="evs_01_0018__p199826384190"><a name="evs_01_0018__li43615331000"></a><a name="li43615331000"></a><strong id="evs_01_0018__b7392345132515">e2fsck -f</strong> <em id="evs_01_0018__i1139310452251">Disk partition</em></p>
|
|
<p id="evs_01_0018__p2033068102013">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p10784126134314"><strong id="evs_01_0018__b2057416235013">e2fsck -f /dev/sda2</strong></p>
|
|
<div class="p" id="evs_01_0018__p1540433100">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen93981942115911">[root@ecs-scsi ~]# e2fsck -f /dev/sda2
|
|
e2fsck 1.42.9 (28-Dec-2013)
|
|
Pass 1: Checking inodes, blocks, and sizes
|
|
Pass 2: Checking directory structure
|
|
Pass 3: Checking directory connectivity
|
|
Pass 4: Checking reference counts
|
|
Pass 5: Checking group summary information
|
|
/dev/sda2: 11/3276800 files (0.0% non-contiguous), 251790/13107200 blocks</pre>
|
|
</div>
|
|
</li><li id="evs_01_0018__li1337554714014">Run the following command to extend the file system of the partition:<p id="evs_01_0018__p163221111182118"><a name="evs_01_0018__li1337554714014"></a><a name="li1337554714014"></a><strong id="evs_01_0018__b13530125862518">resize2fs</strong> <em id="evs_01_0018__i1531185842515">Disk partition</em></p>
|
|
<p id="evs_01_0018__p1132301112211">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p2797102411110"><strong id="evs_01_0018__b20694132814112">resize2fs /dev/sda2</strong></p>
|
|
<div class="p" id="evs_01_0018__p1037954715018">Information similar to the following is displayed:<pre class="screen" id="evs_01_0018__screen1339511151914">[root@ecs-scsi ~]# resize2fs /dev/sda2
|
|
resize2fs 1.42.9 (28-Dec-2013)
|
|
Resizing the filesystem on /dev/sda2 to 26214400 (4k) blocks.
|
|
The filesystem on /dev/sda2 is now 26214400 blocks long.</pre>
|
|
</div>
|
|
</li><li id="evs_01_0018__li83441022043">(Optional) Run the following command to create a mount point:<p id="evs_01_0018__p6347164833119"><a name="evs_01_0018__li83441022043"></a><a name="li83441022043"></a>Perform this step if you want to mount the partition on a new mount point.</p>
|
|
<p id="evs_01_0018__p2349648173112"><strong id="evs_01_0018__b8846205519417">mkdir</strong> <em id="evs_01_0018__i2851185519418">Mount point</em></p>
|
|
<p id="evs_01_0018__p193525482311">In this example, run the following command to create the <strong id="evs_01_0018__b1277025624113">/mnt/test</strong> mount point:</p>
|
|
<p id="evs_01_0018__p12353194823113"><strong id="evs_01_0018__b1335317486316">mkdir</strong> <strong id="evs_01_0018__b11353144833114">/mnt/test</strong></p>
|
|
</li><li id="evs_01_0018__li761184712229">Run the following command to mount the partition:<p id="evs_01_0018__p1161144710226"><a name="evs_01_0018__li761184712229"></a><a name="li761184712229"></a><strong id="evs_01_0018__b107181832162612">mount</strong> <em id="evs_01_0018__i16719153219265">Disk partition</em> <em id="evs_01_0018__i9719832112614">Mount point</em></p>
|
|
<p id="evs_01_0018__p96114720227">In this example, run the following command to mount partition <strong id="evs_01_0018__b1100153512262">/dev/sda2</strong> on <strong id="evs_01_0018__b21014350266">/mnt/test</strong>:</p>
|
|
<p id="evs_01_0018__p36164782213"><strong id="evs_01_0018__b69871321639">mount /dev/sda2 /mnt/test</strong></p>
|
|
<div class="note" id="evs_01_0018__note1861194782215"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0109_p14348212195025_1">If the new partition is mounted on a directory that is not empty, the subdirectories and files in the directory will be hidden. Therefore, you are advised to mount the new partition on an empty directory or a new directory. If the new partition must be mounted on a directory that is not empty, move the subdirectories and files in this directory to another directory temporarily. After the partition is successfully mounted, move the subdirectories and files back.</p>
|
|
</div></div>
|
|
</li></ol>
|
|
</li><li id="evs_01_0018__li67201552174013">For the <strong id="evs_01_0018__b842352706223748">xfs</strong> file system<ol type="a" id="evs_01_0018__ol185863634417"><li id="evs_01_0018__li726011429239">(Optional) Run the following command to create a mount point:<p id="evs_01_0018__evs_01_0109_p461184732217_1"><a name="evs_01_0018__li726011429239"></a><a name="li726011429239"></a>Perform this step if you want to mount the partition on a new mount point.</p>
|
|
<p id="evs_01_0018__evs_01_0109_p3611447172210_1"><strong id="evs_01_0018__evs_01_0109_b5314195503820_1">mkdir</strong> <em id="evs_01_0018__evs_01_0109_i12315555103819_1">Mount point</em></p>
|
|
<p id="evs_01_0018__evs_01_0109_p12611147172210_1">In this example, run the following command to create the <strong id="evs_01_0018__evs_01_0109_b15799115618383_1">/mnt/test</strong> mount point:</p>
|
|
<p id="evs_01_0018__evs_01_0109_p1661144710223_1"><strong id="evs_01_0018__evs_01_0109_b4364122213513_1">mkdir</strong> <strong id="evs_01_0018__evs_01_0109_b1365132211351_1">/mnt/test</strong></p>
|
|
</li><li id="evs_01_0018__li2138532245">Run the following command to mount the partition:<p id="evs_01_0018__evs_01_0018_p1161144710226"><a name="evs_01_0018__li2138532245"></a><a name="li2138532245"></a><strong id="evs_01_0018__evs_01_0018_b107181832162612">mount</strong> <em id="evs_01_0018__evs_01_0018_i16719153219265">Disk partition</em> <em id="evs_01_0018__evs_01_0018_i9719832112614">Mount point</em></p>
|
|
<p id="evs_01_0018__evs_01_0018_p96114720227">In this example, run the following command to mount partition <strong id="evs_01_0018__evs_01_0018_b1100153512262">/dev/sda2</strong> on <strong id="evs_01_0018__evs_01_0018_b21014350266">/mnt/test</strong>:</p>
|
|
<p id="evs_01_0018__evs_01_0018_p36164782213"><strong id="evs_01_0018__evs_01_0018_b69871321639">mount /dev/sda2 /mnt/test</strong></p>
|
|
<div class="note" id="evs_01_0018__evs_01_0018_note1861194782215"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0018_evs_01_0109_p14348212195025">If the new partition is mounted on a directory that is not empty, the subdirectories and files in the directory will be hidden. Therefore, you are advised to mount the new partition on an empty directory or a new directory. If the new partition must be mounted on a directory that is not empty, move the subdirectories and files in this directory to another directory temporarily. After the partition is successfully mounted, move the subdirectories and files back.</p>
|
|
</div></div>
|
|
</li><li id="evs_01_0018__li29957134441">Run the following command to extend the file system of the partition:<p id="evs_01_0018__p1468819448245"><a name="evs_01_0018__li29957134441"></a><a name="li29957134441"></a><strong id="evs_01_0018__b643512972718">sudo</strong> <strong id="evs_01_0018__b94356902716">xfs</strong><strong id="evs_01_0018__b1543618915279">_</strong><strong id="evs_01_0018__b5437290271">growfs</strong> <em id="evs_01_0018__i64388982713">Disk partition</em></p>
|
|
<p id="evs_01_0018__p1513035472410">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__p032614820455"><strong id="evs_01_0018__b281751313127">sudo</strong> <strong id="evs_01_0018__b1994677111415">xfs</strong><strong id="evs_01_0018__b112801210131419">_</strong><strong id="evs_01_0018__b109461372143">growfs</strong> <strong id="evs_01_0018__b11151123161412">/dev/sda2</strong></p>
|
|
<p id="evs_01_0018__p99739109403">Information similar to the following is displayed:</p>
|
|
<pre class="screen" id="evs_01_0018__screen1656261514402">[root@ecs-scsi ~]# sudo xfs_growfs /dev/sda2
|
|
meta-data=/dev/sda2 isize=512 agcount=4, agsize=3276800 blks
|
|
= sectsz=512 attr=2, projid32bit=1
|
|
= crc=1 finobt=0, spinodes=0
|
|
data = bsize=4096 blocks=13107200, imaxpct=25
|
|
= sunit=0 swidth=0 blks
|
|
naming =version2 bsize=4096 ascii-ci=0 ftype=1
|
|
log =internal bsize=4096 blocks=6400, version=2
|
|
= sectsz=512 sunit=0 blks, lazy-count=1
|
|
realtime =none extsz=4096 blocks=0, rtextents=0
|
|
data blocks changed from 13107200 to 26214400df .</pre>
|
|
</li></ol>
|
|
</li></ul>
|
|
</p></li><li id="evs_01_0018__li4639982615418"><span>Run the following command to view the mount result:</span><p><p id="evs_01_0018__evs_01_0109_evs_01_0035_p45817768112214"><strong id="evs_01_0018__evs_01_0109_evs_01_0035_b13926953112830">df -TH</strong></p>
|
|
<p id="evs_01_0018__p46291625512">Information similar to the following is displayed:</p>
|
|
<pre class="screen" id="evs_01_0018__screen1915119611817">[root@ecs-scsi ~]# df -TH
|
|
Filesystem Type Size Used Avail Use% Mounted on
|
|
/dev/vda1 ext4 43G 2.0G 39G 5% /
|
|
devtmpfs devtmpfs 509M 0 509M 0% /dev
|
|
tmpfs tmpfs 520M 0 520M 0% /dev/shm
|
|
tmpfs tmpfs 520M 7.2M 513M 2% /run
|
|
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
|
|
tmpfs tmpfs 104M 0 104M 0% /run/user/0
|
|
/dev/sda1 ext4 53G 55M 50G 1% /mnt/sdc
|
|
/dev/sda2 ext4 106G 63M 101G 1% /mnt/test</pre>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="evs_01_0018__section1122546162318"><a name="evs_01_0018__section1122546162318"></a><a name="section1122546162318"></a><h4 class="sectiontitle">Configuring Automatic Mounting at System Start</h4><p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p10888449418">The <strong id="evs_01_0018__evs_01_0072_b113731194817">fstab</strong> file controls what disks are automatically mounted at <span id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_text288818413414">server</span> startup. You can configure the <strong id="evs_01_0018__evs_01_0072_b1888013169494">fstab</strong> file of a <span id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_text615861019358">server</span> that has data. This operation will not affect the existing data.</p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p3301097119558">The following example uses UUIDs to identify disks in the <strong id="evs_01_0018__evs_01_0072_b052832165015">fstab</strong> file. You are advised not to use device names (like <strong id="evs_01_0018__evs_01_0072_b18387201210586">/dev/vdb1</strong>) to identify disks in the file because device names are assigned dynamically and may change (for example, from <strong id="evs_01_0018__evs_01_0072_b1844841645810">/dev/vdb1</strong> to <strong id="evs_01_0018__evs_01_0072_b2249111965816">/dev/vdb2</strong>) after a <span id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_text60279752174534">server</span> stop or start. This can even prevent your <span id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_text33232815911">server</span> from booting up.</p>
|
|
<div class="note" id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_note6058396910219"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p838481110219">UUIDs are the unique character strings for identifying partitions in Linux.</p>
|
|
</div></div>
|
|
<ol id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_ol7409641133211"><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_li840964143216"><span>Query the partition UUID.</span><p><p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p32760575102436"><strong id="evs_01_0018__evs_01_0072_b14524341165217">blkid</strong> <em id="evs_01_0018__evs_01_0072_i452424112524">Disk partition</em></p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p54606997105845">In this example, the UUID of the <span class="parmname" id="evs_01_0018__evs_01_0072_parmname77581449165211"><b>/dev/vdb1</b></span> partition is queried.</p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p204811453103215"><strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b11565159153817">blkid /dev/vdb1</strong></p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p13610514113319">Information similar to the following is displayed:</p>
|
|
<pre class="screen" id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_screen361091453315">[root@ecs-test-0001 ~]# blkid /dev/vdb1
|
|
/dev/vdb1: UUID="0b3040e2-1367-4abb-841d-ddb0b92693df" TYPE="ext4"</pre>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p275684701890">Carefully record the UUID, as you will need it for the following step.</p>
|
|
</p></li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_li199421823183318"><span>Open the <strong id="evs_01_0018__evs_01_0072_b173611450539">fstab</strong> file using the vi editor.</span><p><p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p9610114153320"><strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b1361031419337">vi /etc/fstab</strong></p>
|
|
</p></li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_li941511389331"><span>Press <strong id="evs_01_0018__evs_01_0072_b138621310205316">i</strong> to enter editing mode.</span></li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_li8415123893310"><span>Move the cursor to the end of the file and press <strong id="evs_01_0018__evs_01_0072_b16102161513531">Enter</strong>. Then, add the following information:</span><p><pre class="screen" id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_screen8133145031318">UUID=0b3040e2-1367-4abb-841d-ddb0b92693df /mnt/sdc ext4 defaults 0 2</pre>
|
|
</p></li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_li841512388338"><span>Press <strong id="evs_01_0018__evs_01_0072_b1940892811568">Esc</strong>, enter <strong id="evs_01_0018__evs_01_0072_b13409122817561">:wq</strong>, and press <strong id="evs_01_0018__evs_01_0072_b14409192816561">Enter</strong>.</span><p><p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_p1141543813310">The system saves the configurations and exits the vi editor.</p>
|
|
</p></li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li17720613102410"><span>Verify that the disk is auto-mounted at startup.</span><p><ol type="a" id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_ol199891910256"><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li1620791415268">Unmount the partition.<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p18208131462618"><a name="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li1620791415268"></a><a name="evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li1620791415268"></a><strong id="evs_01_0018__evs_01_0072_b208731402564">umount</strong> <em id="evs_01_0018__evs_01_0072_i78741940165615">Disk partition</em></p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p621161413262">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p1521115148260"><strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_b0213614192618">umount /dev/vdb1</strong></p>
|
|
</li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li2397162792610">Reload all the content in the <strong id="evs_01_0018__evs_01_0072_b1457010482568">/etc/fstab</strong> file.<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p1739714278269"><strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_b63981278267">mount -a</strong></p>
|
|
</li><li id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li9280203710269">Query the file system mounting information.<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p3282133715264"><a name="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li9280203710269"></a><a name="evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_li9280203710269"></a><strong id="evs_01_0018__evs_01_0072_b131131459105615">mount</strong> <strong id="evs_01_0018__evs_01_0072_b61137597565">|</strong> <strong id="evs_01_0018__evs_01_0072_b131133593568">grep</strong> <em id="evs_01_0018__evs_01_0072_i311465915568">Mount point</em></p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p3286437112619">In this example, run the following command:</p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p18286123782619"><strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b925094342911">mount</strong> <strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b1725119437291">|</strong> <strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b15324154395212">grep</strong> <strong id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_b1831387417">/mnt/sdc</strong></p>
|
|
<p id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_p429163752616">If information similar to the following is displayed, automatic mounting has been configured:</p>
|
|
<pre class="screen" id="evs_01_0018__evs_01_0072_en-us_topic_0044524669_en-us_topic_0142861223_screen429312370265">root@ecs-test-0001 ~]# mount | grep /mnt/sdc
|
|
/dev/vdb1 on /mnt/sdc type ext4 (rw,relatime,data=ordered)</pre>
|
|
</li></ol>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="evs_01_0094.html">Extending Disk Partitions and File Systems (Linux)</a></div>
|
|
</div>
|
|
</div>
|
|
|