天天看點

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>
           

繼續閱讀