很多朋友对于disk的和Disk磁盘挂载不太懂,今天就由小编来为大家分享,希望可以帮助到大家,下面一起来看看吧!
由于需要存储大量数据,怕原先的磁盘容量不够,又新买的了一块200G的磁盘,记录下云盘挂载操作
这个步骤不可少,万一挂载失败还可以回撤,阿里云服务器可以创建快照
数据库备份,还有网站备份,直接下载下来备份文件
发现有磁盘,路径为/dev/sdb。然后使用fdisk命令进行建立分区
[root@localhost~]#fdisk/dev/vdb\n\nWelcometofdisk(util-linux2.32.1).\nChangeswillremaininmemoryonly,untilyoudecidetowritethem.\nBecarefulbeforeusingthewritecommand.\n\nDevicedoesnotcontainarecognizedpartitiontable.\nCreatedanewDOSdisklabelwithdiskidentifier0x44a58d0f.\n\nCommand(mforhelp):n\nPartitiontype\npprimary(0primary,0extended,4free)\neextended(containerforlogicalpartitions)\nSelect(defaultp):p\nPartitionnumber(1-4,default1):\nFirstsector(2048-419430399,default2048):\nLastsector,+sectorsor+size{K,M,G,T,P}(2048-419430399,default419430399):\n\nCreatedanewpartition1oftype'Linux'andofsize200GiB.\n\nCommand(mforhelp):wq\nSyncingdisks.\n
一直回车最后一步输入wq保存即可
[root@localhost~]#fdisk-l\nDisk/dev/vda:40GiB,42949672960bytes,83886080sectors\nUnits:sectorsof1*512=512bytes\nSectorsize(logical/physical):512bytes/512bytes\nI/Osize(minimum/optimal):512bytes/512bytes\nDisklabeltype:dos\nDiskidentifier:0xea870d90\n\nDeviceBootStartEndSectorsSizeIdType\n/dev/vda1*2048838860468388399940G83Linux\n\nDisk/dev/vdb:200GiB,214748364800bytes,419430400sectors\nUnits:sectorsof1*512=512bytes\nSectorsize(logical/physical):512bytes/512bytes\nI/Osize(minimum/optimal):512bytes/512bytes\nDisklabeltype:dos\nDiskidentifier:0x44a58d0f\nDeviceBootStartEndSectorsSizeIdType\n/dev/vdb12048419430399419428352200G83Linux\n建好分区后要格式化分区,建立文件系统
[root@localhost~]#mkfs.ext4/dev/vdb1\n分区挂载添加到开启动,就完成了操作。这样文件系统就建好了,然后选择一个挂载点挂上就可以了,我挂载在/www/data下了,这个可以按照你的需求去挂载
[root@localhost~]#cd/www\n[root@localhost~]#mkdirdata\n[root@localhost~]#echo"/dev/vdb1/www/dataext4defaults00">>/etc/fstab\n重新挂载所有分区使用这个命令。mount-a
[root@localhost~]#mount-a\n
或者单独挂载一个
[root@localhost~]#mount/dev/vdb/www/data\n最后确认检查磁盘是否挂载成功,使用DF命令查看。
[root@localhostwww]#df-l\nFilesystem1K-blocksUsedAvailableUse%Mountedon\ndevtmpfs3812180038121800%/dev\ntmpfs3830572838305641%/dev/shm\ntmpfs383057250838300641%/run\ntmpfs3830572038305720%/sys/fs/cgroup\n/dev/vda141103804116995962750050030%/\ntmpfs76611207661120%/run/user/0\n/dev/vdb1205313000281948108801%/www/data\n\n
可以看到新的存储盘/dev/vdb1已经挂载到了/www/data上面了。
#blkid\n/dev/vda1:UUID="072bc37c-xxxx-xxxx-xxxx-dbd8b6d2fc0d"TYPE="ext4"\n/dev/vdb:UUID="29f2c03f-xxxx-xxxx-xxxx-2a42120b4757"TYPE="ext4"\n
设置开机mount
vim/etc/fstab\nUUID=29f2c03f-xxxx-xxxx-xxxx-2a42120b4757/u01ext4defaults11\n
结束:重启看下挂载正常
文章分享结束,disk的和Disk磁盘挂载的答案你都知道了吗?欢迎再次光临本站哦!