Attach or detach data disk to the VM Redhat in Azure cloud
- Login to Azure portal and go to the Virtual Machine VM section.
- Go to the Disk panel from left side.

3. On Disk section one disk shown as the disk for OS and its is temporary disk. We lost data if we keep it on disk when we stop the Virtual Machine. Below on Same Panel, we have option to Create the Data disk highlighted as shown below.

3. After press Create and attach a disk , we will fill the data associated like LAN , Disk Name, Storage type, size , IOPS, encryption. After choose Press SAVE button for creating Disk and attached to VM.

4. Attach Disk: If you want to attach any existing disk which is present by using ATTACH EXISTING DISKS.

5. Detach Disk: If you want to Detach the existing disk then you press X sign at last of disk panel and press SAVE for conform.

6. After adding disk from Azure portal. Connect the Redhat VM machine with putty window and check for df -h command for disk mapping.
[sunny@VM1 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.3M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 2.0G 77M 2.0G 4% /
/dev/mapper/rootvg-usrlv 10G 3.0G 7.1G 30% /usr
/dev/mapper/rootvg-tmplv 2.0G 47M 2.0G 3% /tmp
/dev/sdb1 496M 148M 348M 30% /boot
/dev/mapper/rootvg-varlv 8.0G 493M 7.6G 7% /var
/dev/mapper/rootvg-homelv 1014M 50M 965M 5% /home
/dev/sdb15 495M 6.9M 488M 2% /boot/efi
/dev/sda1 16G 45M 15G 1% /mnt
tmpfs 782M 12K 782M 1% /run/user/42
tmpfs 782M 4.0K 782M 1% /run/user/1000
7. We need to use FDISK for create partition. We added 10 GB and 50GB disk from Azure portal.
[sunny@VM1 ~]$ sudo fdisk -l
Disk /dev/sda: 16 GiB, 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
Disklabel type: dos
Disk identifier: 0xb73f50ba
Device Boot Start End Sectors Size Id Type
Disk /dev/sdb: 64 GiB, 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
Disklabel type: gpt
Disk identifier: CDAD5075-3352-4838-B728-0BFB80489A18
Device Start End Sectors Size Type
/dev/sdb1 1026048 2050047 1024000 500M Linux filesystem
/dev/sdb2 2050048 134215679 132165632 63G Linux LVM
/dev/sdb14 2048 10239 8192 4M BIOS boot
/dev/sdb15 10240 1024000 1013761 495M EFI System
Partition table entries are not in disk order.
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 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 /dev/sdd: 50 GiB, 53687091200 bytes, 104857600 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
7. We Create partition with FDISK for two attached disk in Azure portal. one is 10 GB and other is 50 GB.
[sunny@VM1 /]$ sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x256cac9b.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519):
Created a new partition 1 of type 'Linux' and of size 10 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[sunny@VM1 /]$ sudo fdisk /dev/sdd
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x437478e3.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599):
Created a new partition 1 of type 'Linux' and of size 50 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
8. Make the filesystem of attached disk
[sunny@VM1 /]$ ls /dev/sd*
/dev/sda /dev/sdb /dev/sdb14 /dev/sdb2 /dev/sdc1 /dev/sdd1
/dev/sda1 /dev/sdb1 /dev/sdb15 /dev/sdc /dev/sdd
[sunny@VM1 /]$ sudo mkfs.xfs /dev/sdc -f
meta-data=/dev/sdc isize=512 agcount=4, agsize=655360 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[sunny@VM1 /]$ sudo mkfs.xfs /dev/sdd -f
meta-data=/dev/sdd isize=512 agcount=4, agsize=3276800 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=6400, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
9. Make the directory for mount the both disk.
[sunny@VM1 /]$ sudo mkdir /disk1
[sunny@VM1 /]$ sudo mkdir /disk2
10. Mount the both disk in Redhat Virtual machine.
[sunny@VM1 /]$ sudo mount /dev/sdc /disk1
[sunny@VM1 /]$ sudo mount /dev/sdd /disk2
11. Verify the disk is attached with df -h commands:
[sunny@VM1 /]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.2M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 2.0G 77M 2.0G 4% /
/dev/sdb15 495M 6.9M 488M 2% /boot/efi
/dev/sda1 16G 45M 15G 1% /mnt
/dev/sdc 10G 104M 9.9G 2% /disk1
/dev/sdd 50G 390M 50G 1% /disk2
12. For permanent mount the disk on every reboot make an entry in /etc/fstab file.
sudo vi /etc/fstab
---Insert : for insert operation
/dev/sdc /disk1 xfs defaults 0 0
/dev/sdd /disk2 xfs defaults 0 0