LoginSignup
14
16

More than 5 years have passed since last update.

Azure仮想マシンへのディスク追加

Posted at

Azure仮想マシンのディスク容量はデフォルトだと数10Gしかないので、
データが溜まっていくようなケースで使用する場合には、追加ディスクをマウントする必要がある.

ディスクの接続

  1. Azure管理ポータルの仮想マシンのページで該当の仮想マシンを選択
  2. [ディスクの接続]->[空のディスクの接続]
  3. 適当なファイル名とファイルサイズを設定

※ キャッシュ設定は、REDOログファイルの領域にもなるため、[なし]を選択

接続されたディスクの識別子を確認

tail -f /var/log/syslog

おそらくsdcという文字列があるはず

接続したディスクにパーティションを作成

sudo 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 0xf068a662.
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)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-1048575999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1048575999, default 1048575999):
Using default value 1048575999

Command (m for help): p

Disk /dev/sdc: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders, total 1048576000 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
Disk identifier: 0xf068a662

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048  1048575999   524286976   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

作成したパーティションをフォーマット

sudo mkfs -t ext4 /dev/sdc1

作成したパーティションをマウント

sudo mount /dev/sdc1 /(path_to_mount)

OS再起動時もマウントされるよう設定

/etc/fstabに下記1行を追加

/dev/sdc1  /(path_to_mount)  ext4  defaults  0 0

参考

14
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
16