阿里云挂载新硬盘

阿里云挂载新硬盘,第1张

1、找到 待挂载 云盘,在 操作 列中,选择 更多 >挂载,刷新云盘列表,如果是使用中,表示挂载服务器成功

2、检查阿里云服务器数据盘情况,这里我们可以看到数据盘有没有挂载

3、挂载阿里云数据硬盘。输入"fdisk /dev/vdb",然后根据下图的提示,输入n,p,1,回车,回车,wq,保存退出。

4、格式化分区

5、挂载数据盘,这里选择挂载到root下面

6、使其重启永久生效

[root@test ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 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: 0x000b6c99

  Device Boot      Start        End      Blocks  Id  System

/dev/vda1  *        2048    83886046    41941999+  83  Linux

Disk /dev/vdb: 100.4 GB, 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

[root@test~]# fdisk /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 0xc247eca8.

Command (m for help): n    输入n

Partition type:

  p  primary (0 primary, 0 extended, 4 free)

  e  extended

Select (default p): p  输入p

Partition number (1-4, default 1): 1

First sector (2048-209715199, default 2048):      回车

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):       回车

Using default value 209715199        

Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): wq  输入wq退出

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@test~]# fdisk -l

Disk /dev/vda: 42.9 GB, 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: 0x000b6c99

  Device Boot      Start        End      Blocks  Id  System

/dev/vda1  *        2048    83886046    41941999+  83  Linux

Disk /dev/vdb: 107.4 GB, 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: 0xc247eca8

  Device Boot      Start        End      Blocks  Id  System

/dev/vdb1            2048  209715199  104856576  83  Linux      已创建/dev/vdb1分区

[root@test~]# 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

6553600 inodes, 26214144 blocks

1310707 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2174746624

800 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, 20480000, 23887872

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

[root@test~]# mkdir /mnt    创建挂载目录

mkdir: cannot create directory ‘/mnt’: File exists

[root@Hilbert ~]# echo /dev/vdb1 /mnt ext4 defaults 0 0 >>/etc/fstab

[root@Hilbert ~]# cat /etc/fstab       写入新分区信息

#

# /etc/fstab

# Created by anaconda on Wed May 25 02:12:53 2022

#

# 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=d71b01a9-bf24-4afb-b7d9-3a0961522139 /                      ext4    defaults        1 1

/dev/vdb1 /mnt ext4 defaults 0 0

[root@test~]# mount /dev/vdb1 /mnt      把分区挂载在/mnt目录下

[root@test~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

devtmpfs        3.9G    0  3.9G  0% /dev

tmpfs          3.9G    0  3.9G  0% /dev/shm

tmpfs          3.9G  608K  3.9G  1% /run

tmpfs          3.9G    0  3.9G  0% /sys/fs/cgroup

/dev/vda1        40G  2.1G  36G  6% /

tmpfs          783M    0  783M  0% /run/user/0

/dev/vdb1        98G  61M  91G  1% /mnt       新挂载的分区


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/326216.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-02
下一篇2023-05-02

发表评论

登录后才能评论

评论列表(0条)

    保存