美文网首页
468.【数据库】阿里云服务器挂载硬盘

468.【数据库】阿里云服务器挂载硬盘

作者: 七镜 | 来源:发表于2022-10-25 13:47 被阅读0次

一、查看带挂载的硬盘

[root@client ~]# 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: 0x000bb9c1

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83886046    41941999+  83  Linux

Disk /dev/vdb: 1073.7 GB, 1073741824000 bytes, 2097152000 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@client ~]# 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 0x5c7c69d5.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

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-2097151999, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151999, default 2097151999): 
Using default value 2097151999
Partition 1 of type Linux and of size 1000 GiB is set

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

三、创建文件系统(格式化分区)

[root@client ~]# 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: 0x000bb9c1

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83886046    41941999+  83  Linux

Disk /dev/vdb: 1073.7 GB, 1073741824000 bytes, 2097152000 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: 0x5c7c69d5

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048  2097151999  1048574976   83  Linux
[root@client ~]# 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
65536000 inodes, 262143744 blocks
13107187 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2409627648
8000 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, 71663616, 78675968, 
        102400000, 214990848

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

四、将文件系统挂载到目录

mount /dev/vdb1 /mnt

五、设置开机启动

echo $( blkid /dev/vdb1 | awk '{print $2}' | sed 's/\"//g' ) /mnt ext4 defaults 0 0 >> /etc/fstab 

PS: 这条命令值得好好品味品位,blkidawksed、管道符|、命令替换$( )、标准输出重定向>> 这些进阶 linux 命令 都使用到了。

相关文章

  • 494.【Linux】使用 parted 创建大于 2T 的分区

    今天使用之前的硬盘挂载文章(468.【数据库】阿里云服务器挂载硬盘[https://www.jianshu.com...

  • 468.【数据库】阿里云服务器挂载硬盘

    一、查看带挂载的硬盘 二、创建分区 三、创建文件系统(格式化分区) 四、将文件系统挂载到目录 五、设置开机启动 P...

  • 关于AWS云服务器硬盘的梗

    相信不少人使用过阿里云的服务器,使用阿里云服务器对于添加的硬盘需要自行挂载。这里记录下使用亚马逊云硬盘方面碰到的坑...

  • 一、Linux(CentOS7)系统磁盘分区及挂载

    新购买的阿里云服务器,默认硬盘容量肯定不够用,需要额外购买硬盘,购买后需要对硬盘进行分区及挂载操作,下面是硬盘分区...

  • 阿里云Linux服务器的数据库扩容

    今天碰到阿里云服务器数据库扩容的问题,犹豫原来有一块挂载过的硬盘,提升到500G,这里需要重新配置一下 给这个客户...

  • LINUX 挂载云盘

    利用fdisk -l命令,检查当前VPS的数据硬盘情况 挂载阿里云数据硬盘 输入"fdisk /dev/vdb",...

  • CentOS服务器初始化设置

    以阿里云服务器为例一、挂载硬盘1、磁盘分区fdisk -l #查看设备,一般可以看到设备名为/dev/xvdbfd...

  • 阿里云挂载新硬盘

    操作步骤 在本示例中,我们用一个新的 20 GB 数据盘(设备名为 /dev/xvdb)创建一个单分区数据盘并挂载...

  • 阿里云挂载新硬盘

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

  • 阿里云挂载新硬盘

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

网友评论

      本文标题:468.【数据库】阿里云服务器挂载硬盘

      本文链接:https://www.haomeiwen.com/subject/dhonzrtx.html