LoginSignup
0
0

More than 3 years have passed since last update.

Nutanix CE ベアメタルインストール時のUSBディスクのrootパーティションのサイズを拡張してみた

Posted at

nutanix CEライフをシングルノードで満喫しているのですが、
そろそろクラスターにしたいなと、電気代を気にしつつの今日このごろです。

nutanix CEのアラートでずっと消せていないDisk 'root' space usage (93%) を探していたのですが、
AHVのrootパーティションが93%でした。

[root@NTNX-97cd02ac-A ~]# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sde1       6.8G  6.0G  509M  93% /

これを今回改善します。
注意: オンラインでやる前にddとかでイメージとっておくことをおすすめします。gpartedとか使えばもっと楽にできますよ

この記録はオンラインで強引にやるパターンなので、自己責任で・・・

1. パーティションの削除と、作成

[root@NTNX-97cd02ac-A ~]# fdisk /dev/sde
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sde: 15.6 GB, 15590227968 bytes, 30449664 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 label type: dos
Disk identifier: 0x000efa2c

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        2048    14540799     7269376   83  Linux

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-30449663, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-30449663, default 30449663):
Using default value 30449663
Partition 1 of type Linux and of size 14.5 GiB is set

Command (m for help): a
Selected partition 1

Command (m for help): p

Disk /dev/sde: 15.6 GB, 15590227968 bytes, 30449664 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 label type: dos
Disk identifier: 0x000efa2c

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        2048    30449663    15223808   83  Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

2. AHV再起動

  • VMを全部止める

3. resize2fs

再起動後、AHVへログインしてresize2fs

# resize2fs /dev/sde1

4. 完了確認

[root@NTNX-97cd02ac-A ~]# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sde1        15G  5.9G  7.7G  44% /
0
0
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
0
0