国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

linux系統分區格式化和掛載數據盤(pán)的示例分析

發(fā)布時(shí)間:2021-09-14 18:13 來(lái)源:億速云 閱讀:0 作者:柒染 欄目: 服務(wù)器 歡迎投稿:712375056

這篇文章給大家介紹linux系統分區格式化和掛載數據盤(pán)的示例分析,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

使用【管理終端】,或遠程連接工具,輸入用戶(hù)名 root 和密碼登錄到linux系統。

1、運行fdisk -l命令查看數據盤(pán)。在沒(méi)有分區和格式化數據盤(pán)之前,使用 “df –h”命令,是無(wú)法看到數據盤(pán)的,可以使用“fdisk -l”命令查看。

執行命令后,如果不存在 /dev/vdb,表示沒(méi)有數據盤(pán)。確認數據盤(pán)是否已掛載。

2、依次執行以下命令以創(chuàng )建一個(gè)單分區數據盤(pán):

(1)運行fdisk -u /dev/vdb:分區數據盤(pán)。

(2)輸入p:查看數據盤(pán)的分區情況。本示例中,數據盤(pán)沒(méi)有分區。

(3)輸入n:創(chuàng )建一個(gè)新分區。

(4)輸入p:選擇分區類(lèi)型為主分區。

說(shuō)明 本示例中創(chuàng )建一個(gè)單分區數據盤(pán),所以只需要創(chuàng )建主分區。如果要創(chuàng )建四個(gè)以上分區,您應該創(chuàng )建至少一個(gè)擴展分區,即選擇 e(extended)。

(5)輸入分區編號并按回車(chē)鍵。本示例中,僅創(chuàng )建一個(gè)分區,輸入1。

(6)輸入第一個(gè)可用的扇區編號:按回車(chē)鍵采用默認值2048。

(7)輸入最后一個(gè)扇區編號:本示例僅創(chuàng )建一個(gè)分區,按回車(chē)鍵采用默認值。

(8)輸入p:查看該數據盤(pán)的規劃分區情況。

(9)輸入w:開(kāi)始分區,并在分區后退出。

[root@ecshost~ ]# fdisk -u /dev/vdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x3e60020e.
 
Command (m for help): p
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e
Device Boot Start End Blocks Id System
 
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
 
Command (m for help): p
 
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e
Device Boot Start End Blocks Id System
/dev/vdb1 2048 41943039 20970496 83 Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

3、運行命令fdisk -lu /dev/vdb 查看新分區。

如果出現以下信息,表示新分區/dev/vdb1創(chuàng )建成功。

[root@ecshost~ ]# fdisk -lu /dev/vdb
 
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e
 
Device Boot Start End Blocks Id System
/dev/vdb1 2048 41943039 20970496 83 Linux

4、運行命令mkfs.ext4 /dev/vdb1在新分區上創(chuàng )建一個(gè)文件系統。

本示例中,創(chuàng )建一個(gè)ext4文件系統。您也可以根據自己的需要,選擇創(chuàng )建其他文件系統,例如:如果您需要在 Linux、Windows和Mac系統之間共享文件,可以使用mkfs.vfat創(chuàng )建VFAT文件系統。

說(shuō)明 創(chuàng )建文件系統所需時(shí)間取決于數據盤(pán)大小。

[root@ecshost~ ]# mkfs.ext4 /dev/vdb1
 
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
1310720 inodes, 5242624 blocks
262131 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2153775104
160 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
 
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

5、(建議)運行命令cp /etc/fstab /etc/fstab.bak備份etc/fstab文件。

6、運行命令echo /dev/vdb1 /data0 ext4 defaults 0 0 >> /etc/fstab向/etc/fstab寫(xiě)入新分區信息。

說(shuō)明 Ubuntu 12.04系統不支持barrier,您需要運行命令 echo '/dev/vdb1 /data0 ext4 barrier=0 0 0' >> /etc/fstab。

如要把數據盤(pán)單獨掛載到某個(gè)文件夾,例如單獨用來(lái)存放網(wǎng)頁(yè),則將命令中/data0替換成所需的掛載點(diǎn)路徑。

7、運行命令cat /etc/fstab查看/etc/fstab中的新分區信息。

[root@ecshost~ ]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Dec 12 07:53:08 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d67c3b17-255b-4687-be04-f29190d37396 / ext4 defaults 1 1
/dev/vdb1 /mnt ext4 defaults 0 0

8、運行命令mount /dev/vdb1 /data0掛載文件系統。

9、運行命令df -h 查看目前磁盤(pán)空間和使用情況。

出現新建文件系統的信息,表示掛載成功。

<div><br class="Apple-interchange-newline">[root@ecshost~ ]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.6G 36G 5% /
devtmpfs 234M 0 234M 0% /dev
tmpfs 244M 0 244M 0% /dev/shm
tmpfs 244M 484K 244M 1% /run
tmpfs 244M 0 244M 0% /sys/fs/cgroup
tmpfs 49M 0 49M 0% /run/user/0
/dev/vdb1 20G 45M 19G 1% /mnt</div>
12345678910    [root@ecshost~ ]# df -h Filesystem Size Used Avail Use% Mounted on/dev/vda1 40G 1.6G 36G 5% /devtmpfs 234M 0 234M 0% /devtmpfs 244M 0 244M 0% /dev/shmtmpfs 244M 484K 244M 1% /runtmpfs 244M 0 244M 0% /sys/fs/cgrouptmpfs 49M 0 49M 0% /run/user/0/dev/vdb1 20G 45M 19G 1% /mnt

10、最后 reboot,重啟。

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

亚洲成AV人最新地堂无码| 日韩精品无码专区免费播放| 欧洲人激情毛片无码视频| 国产精品另类激情久久久免费| 亚洲制服丝袜精品久久| AV无码精品一区二区三区宅噜噜|