新购买阿里云服务器Linux系统数据盘挂载
1、查看磁盘
# lsblk
2、创建目录
# mkdir /www
3、挂载数据硬盘
输入"fdisk /dev/vdb",然后根据下图的提示,输入n,p,1,回车,回车,wq,保存退出。
4、格式化分区
# mkfs.ext4 /dev/vdb1
5、挂载到目录
# mount /dev/vdb1 /www
6、查看验证
# df -h
具体操作如下:
Welcome to Alibaba Cloud Elastic Compute Service ! [root@lowcode-shuangbao ~]# [root@lowcode-shuangbao ~]# df -hl Filesystem Size Used Avail Use% Mounted on devtmpfs 915M 0 915M 0% /dev tmpfs 933M 0 933M 0% /dev/shm tmpfs 933M 432K 933M 1% /run tmpfs 933M 0 933M 0% /sys/fs/cgroup /dev/vda1 20G 2.6G 16G 14% / tmpfs 187M 0 187M 0% /run/user/0 [root@lowcode-shuangbao ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 20G 0 disk └─vda1 253:1 0 20G 0 part / vdb 253:16 0 20G 0 disk [root@lowcode-shuangbao ~]# fdisk -l Disk /dev/vda: 20 GiB, 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 Disklabel type: dos Disk identifier: 0x96be1a8e Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 41943039 41940992 20G 83 Linux Disk /dev/vdb: 20 GiB, 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 [root@lowcode-shuangbao ~]# cd / [root@lowcode-shuangbao /]# ls bin dev home lib64 media opt root sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [root@lowcode-shuangbao /]# mkdir /www [root@lowcode-shuangbao /]# ls bin dev home lib64 media opt root sbin sys usr www boot etc lib lost+found mnt proc run srv tmp var [root@lowcode-shuangbao /]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 915M 0 915M 0% /dev tmpfs 933M 0 933M 0% /dev/shm tmpfs 933M 432K 933M 1% /run tmpfs 933M 0 933M 0% /sys/fs/cgroup /dev/vda1 20G 2.6G 16G 14% / tmpfs 187M 0 187M 0% /run/user/0 [root@lowcode-shuangbao /]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.32.1). 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. Created a new DOS disklabel with disk identifier 0x785153c5. Command (m for help): m Help: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display/entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-41943039, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): Created a new partition 1 of type 'Linux' and of size 20 GiB. Command (m for help): wq The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@lowcode-shuangbao /]# fdisk -l Disk /dev/vda: 20 GiB, 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 Disklabel type: dos Disk identifier: 0x96be1a8e Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 41943039 41940992 20G 83 Linux Disk /dev/vdb: 20 GiB, 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 Disklabel type: dos Disk identifier: 0x785153c5 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 41943039 41940992 20G 83 Linux [root@lowcode-shuangbao /]# mkfs.ext4 /dev/vdb1 mke2fs 1.45.6 (20-Mar-2020) Creating filesystem with 5242624 4k blocks and 1310720 inodes Filesystem UUID: a3653fcb-10b4-4ddd-ae6b-1620994c999a 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 [root@lowcode-shuangbao /]# mount /dev/vdb1 /www [root@lowcode-shuangbao /]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 915M 0 915M 0% /dev tmpfs 933M 0 933M 0% /dev/shm tmpfs 933M 436K 933M 1% /run tmpfs 933M 0 933M 0% /sys/fs/cgroup /dev/vda1 20G 2.6G 16G 14% / tmpfs 187M 0 187M 0% /run/user/0 /dev/vdb1 20G 45M 19G 1% /www [root@lowcode-shuangbao /]#
新购买阿里云服务器Linux系统挂载数据盘,成功挂载到/WWW目录。
加入启动挂载
# vi /etc/rc.d/rc.local mount /dev/vdb1 /www
版权声明:若文中没有特别声明皆为原创文章,转载时请以链接形式注明文章出处与原文链接。
非书面授权,禁止转载。本作品采用 CC BY-NC-ND/2.5/CN 许可协议。
如果帮您解决了问题,可以给小编打赏,小编不抽烟不喝酒,6元就够吃个泡面了,感激不尽。
非书面授权,禁止转载。本作品采用 CC BY-NC-ND/2.5/CN 许可协议。
如果帮您解决了问题,可以给小编打赏,小编不抽烟不喝酒,6元就够吃个泡面了,感激不尽。