azure 微软云 规范挂载附加数据磁盘

来源:互联网 发布:金山软件大厦 编辑:程序博客网 时间:2024/04/28 15:34

azure云上面,一般系统盘都很小,空间基本不够使用,所以我们需要附加磁盘,首先在管理界面附加一个SSD磁盘,一般默认的是/dev/sdc目录。在2016年的时候,附加磁盘可以直接使用mkfs.ext4 /dev/sdc进行数据磁盘初始化,但是在2017年就不可以了,如果直接mkfs.ext4 /dev/sdc的话,直接azure云上的vm虚拟机就down了罢工了,所以我们需要正确的进行磁盘挂载。


1,先使用fdisk进行磁盘分区,一般直接分成一个区

[root@crm_db_m01 ~]# fdisk /dev/sdcDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0xd788cc0a.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)WARNING: DOS-compatible mode is deprecated. It's strongly recommended to         switch off the mode (command 'c') and change display units to         sectors (command 'u').Command (m for help): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 1First cylinder (1-133544, default 1): Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-133544, default 133544): Using default value 133544Command (m for help): mCommand action   a   toggle a bootable flag   b   edit bsd disklabel   c   toggle the dos compatibility flag   d   delete a partition   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): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.[root@crm_db_m01 ~]# 




2,分区后查看实际分好的分区磁盘目录名称

[root@crm_db_m01 ~]# fdisk -lDisk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000c23d3   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1        3789    30432256   83  Linux/dev/sda2            3789        3917     1024000   82  Linux swap / SolarisDisk /dev/sdb: 240.5 GB, 240518168576 bytes255 heads, 63 sectors/track, 29241 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x40a7f99c   Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1       29242   234879936   83  LinuxDisk /dev/sdc: 1098.4 GB, 1098437885952 bytes255 heads, 63 sectors/track, 133544 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xd788cc0a   Device Boot      Start         End      Blocks   Id  System/dev/sdc1               1      133544  1072692148+  83  Linux




3,使用 mkfs.ext4 命令格式化磁盘成格式化成ext4各式的文件系统。

[root@crm_db_m01 ~]# mkfs.ext4 /dev/sdc1mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks67043328 inodes, 268173037 blocks13408651 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=42949672968184 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,     4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,     102400000, 214990848Writing inode tables: done                            Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 27 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.[root@crm_db_m01 ~]# 




4,开始挂载新的分区磁盘到/oracle

[root@crm_db_m01 ~]# mkdir /oracle[root@crm_db_m01 ~]# mount /dev/sdc1 /oracle[root@crm_db_m01 ~]# 




5,开机启动挂载配置



需要用uuid的方式挂载,最好先用ulkid获取/dev/sdc1的uuid,然后再设置开机启动挂载配置

 [root@crm_db_m01 ~]# blkid/dev/sda1: UUID="6d089360-3e14-401d-91d0-378f3fd09332" TYPE="ext4" /dev/sdc1: UUID="81796489-70bd-4707-b844-9088f8a1a209" TYPE="ext4" [root@crm_db_m01 ~]# 



进行配置/etc/fstab,配置uuid

[root@crm_db_m01 ~]# vim /etc/fstab You have new mail in /var/spool/mail/root[root@crm_db_m01 ~]# more /etc/fstab ## /etc/fstab# Created by anaconda on Wed Jan 15 04:45:47 2014## 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=6d089360-3e14-401d-91d0-378f3fd09332 /                       ext4    defaults        1 1UUID=81796489-70bd-4707-b844-9088f8a1a209           /oracle                   ext4    defaults        1 2tmpfs                   /dev/shm                tmpfs   defaults        0 0devpts                  /dev/pts                devpts  gid=5,mode=620  0 0sysfs                   /sys                    sysfs   defaults        0 0proc                    /proc                   proc    defaults        0 0[root@crm_db_m01 ~]# 
2 0