天天看点

azure 微软云 规范挂载附加数据磁盘/etc/fstabCreated by anaconda on Wed Jan 15 04:45:47 2014Accessible filesystems, by reference, are maintained under ‘/dev/disk’See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

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

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building 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.
</code></span></span></span>
           

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): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-133544, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-133544, default 133544):

Using default value 133544

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

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): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[[email protected]_db_m01 ~]#

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# fdisk -l
</code></span></span></span>
           

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000c23d3

Device Boot Start End Blocks Id System

/dev/sda1 * 1 3789 30432256 83 Linux

/dev/sda2 3789 3917 1024000 82 Linux swap / Solaris

Disk /dev/sdb: 240.5 GB, 240518168576 bytes

255 heads, 63 sectors/track, 29241 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x40a7f99c

Device Boot Start End Blocks Id System

/dev/sdb1 1 29242 234879936 83 Linux

Disk /dev/sdc: 1098.4 GB, 1098437885952 bytes

255 heads, 63 sectors/track, 133544 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0xd788cc0a

Device Boot Start End Blocks Id System

/dev/sdc1 1 133544 1072692148+ 83 Linux

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
67043328 inodes, 268173037 blocks
13408651 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
8184 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
</code></span></span></span>
           

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[[email protected]_db_m01 ~]#

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# mkdir /oracle
[[email protected]_db_m01 ~]# mount /dev/sdc1 /oracle
[[email protected]_db_m01 ~]# 
</code></span></span></span>
           
  • 1
  • 2
  • 3
  • 4
  • 5

5,开机启动挂载配置

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code> [[email protected]_db_m01 ~]# blkid
/dev/sda1: UUID="6d089360-3e14-401d-91d0-378f3fd09332" TYPE="ext4" 
/dev/sdc1: UUID="81796489-70bd-4707-b844-9088f8a1a209" TYPE="ext4" 
[[email protected]_db_m01 ~]# 
</code></span></span></span>
           

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# vim /etc/fstab 
You have new mail in /var/spool/mail/root
[[email protected]_db_m01 ~]# more /etc/fstab 
</code></span></span></span>
           

/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 1

UUID=81796489-70bd-4707-b844-9088f8a1a209 /oracle ext4 defaults 1 2

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

[[email protected]_db_m01 ~]#

云服务器搭载业务,选择合适的平台最重要!

从目前国内云计算市场的格局来看,国内云计算前三强分别是阿里云、腾讯云和华为云,阿里云、腾讯云作为背靠互联网平台的企业,更偏向于B端用户;华为与作为传统的通信巨头,更偏向于G端。

当然如何选择服务器机型,这里有篇文档汇总的比较详细,文档地址:

云服务器哪家好!2021年阿里云、腾讯云、华为云的服务器配置及价格对比?​

如果是高并发,高IO业务场景,需要确定服务器规格,可让业务应用性能发挥到最佳,参考官方文档:

阿里云服务器规格:规格实例族 - 云服务器 ECS

腾讯云服务器规格:规格实例族 - 云服务器CVM

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

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

<span style="color:rgba(0, 0, 0, 0.75)"><span style="background-color:#ffffff"><span style="color:#000000"><code>[[email protected]_db_m01 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building 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.
</code></span></span></span>
           

继续阅读