Tuesday, April 3, 2018

Linux box in Azure partitions issue

when you create a Linux box in Azure, such as Centos, even you select the hard drive of 64G, the partition tools not fully use the disk, it might like this

#fdisk -l

Disk /dev/sda: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000cd8ad

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62914559    30944256   83  Linux

Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x9075e55c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             128    33552383    16776128   83  Linux


# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  3.0G   27G  10% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G   65M  3.9G   2% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1       497M  105M  392M  22% /boot
/dev/sdb1        16G   45M   15G   1% /mnt/resource
tmpfs           797M     0  797M   0% /run/user/1000

then you need to resize the partition
here are the steps
for Centos 7:
1. sudo fdisk /dev/sda

type: p
this will show both partitions /dev/sda1 and /dev/sda2 which are basically partitions 1 and 2

type: d then 2 (to delete partition 2)
type: n then p , 2 (to recreate partition 2) you can accept the default values
type: w (to save the new partition)
type: q (to exit fdisk)
sudo reboot (to reboot the VM so the partition is updated)

2. To finalize the resize, after the reboot, execute the command:


sudo xfs_growfs /dev/sda2

No comments:

How to use Telus Actionec T3200M as a wireless Access point

when you install Telus Internet, they will offer you a modem + router + wireless device Actionec T3200M, a lot of users still want to use th...