Friday, May 3, 2024

How to add , Format and mount an attached filesystem disk volume on Azure Linux VM ?

Add , Format and mount an attached filesystem disk volume on Azure Linux VM


[azureadm@oracletgt-1 ~]$

[azureadm@oracletgt-1 ~]$ sudo su - root

Last login: Fri May  3 07:09:49 UTC 2024

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fdisk -l

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: gpt

Disk identifier: CC07BBFF-E48E-4614-B09E-BFD7ED16E3D9



#         Start          End    Size  Type            Name

 1      1026048      2050047    500M  Microsoft basic

 2      2050048     62912511     29G  Microsoft basic

14         2048        10239      4M  BIOS boot

15        10240      1024000    495M  EFI System      EFI System Partition


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: 0xe5bd4e29


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    33552383    16775168    7  HPFS/NTFS/exFAT

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fdisk -l

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: gpt

Disk identifier: CC07BBFF-E48E-4614-B09E-BFD7ED16E3D9



#         Start          End    Size  Type            Name

 1      1026048      2050047    500M  Microsoft basic

 2      2050048     62912511     29G  Microsoft basic

14         2048        10239      4M  BIOS boot

15        10240      1024000    495M  EFI System      EFI System Partition


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: 0xe5bd4e29


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    33552383    16775168    7  HPFS/NTFS/exFAT


Disk /dev/sdc: 53.7 GB, 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


[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fidk /dev/sdc

-bash: fidk: command not found

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fdisk /dev/sdc

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.


Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x4c1bf713.


The device presents a logical sector size that is smaller than

the physical sector size. Aligning to a physical sector (or optimal

I/O) size boundary is recommended, or performance may be impacted.


Command (m for help): p


Disk /dev/sdc: 53.7 GB, 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

Disk label type: dos

Disk identifier: 0x4c1bf713


   Device Boot      Start         End      Blocks   Id  System


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):

First sector (2048-104857599, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):

Using default value 104857599

Partition 1 of type Linux and of size 50 GiB is set


Command (m for help): p


Disk /dev/sdc: 53.7 GB, 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

Disk label type: dos

Disk identifier: 0x4c1bf713


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048   104857599    52427776   83  Linux


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fdisk -l

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: gpt

Disk identifier: CC07BBFF-E48E-4614-B09E-BFD7ED16E3D9



#         Start          End    Size  Type            Name

 1      1026048      2050047    500M  Microsoft basic

 2      2050048     62912511     29G  Microsoft basic

14         2048        10239      4M  BIOS boot

15        10240      1024000    495M  EFI System      EFI System Partition


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: 0xe5bd4e29


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    33552383    16775168    7  HPFS/NTFS/exFAT


Disk /dev/sdc: 53.7 GB, 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

Disk label type: dos

Disk identifier: 0x4c1bf713


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048   104857599    52427776   83  Linux

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# cat /etc/fstab


#

# /etc/fstab

# Created by anaconda on Tue Feb 11 10:36:35 2020

#

# 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

#

/dev/sda2               /                       btrfs   subvol=root     0 0

UUID=90b82350-a900-475f-8d8f-23db65d7f70a /boot                   xfs     defaults        0 0

UUID=3B29-C04C          /boot/efi               vfat    defaults,uid=0,gid=0,umask=0077,shortname=winnt 0 0

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# df -Th

Filesystem                                      Type      Size  Used Avail Use% Mounted on

devtmpfs                                        devtmpfs  3.8G     0  3.8G   0% /dev

tmpfs                                           tmpfs     3.8G     0  3.8G   0% /dev/shm

tmpfs                                           tmpfs     3.8G  8.6M  3.8G   1% /run

tmpfs                                           tmpfs     3.8G     0  3.8G   0% /sys/fs/cgroup

/dev/sda2                                       btrfs      30G   19G   11G  65% /

/dev/sda1                                       xfs       497M  329M  169M  67% /boot

/dev/sda15                                      vfat      495M  7.4M  488M   2% /boot/efi

//oraclemigrsa.file.core.windows.net/transfer01 cifs      5.0T  3.3G  5.0T   1% /mnt/Backup

tmpfs                                           tmpfs     766M     0  766M   0% /run/user/995

tmpfs                                           tmpfs     766M     0  766M   0% /run/user/54322

[root@oracletgt-1 ~]# lsblk

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sdb       8:16   0   16G  0 disk

└─sdb1    8:17   0   16G  0 part

sdc       8:32   0   50G  0 disk

└─sdc1    8:33   0   50G  0 part

sda       8:0    0   30G  0 disk

├─sda2    8:2    0   29G  0 part /

├─sda14   8:14   0    4M  0 part

├─sda15   8:15   0  495M  0 part /boot/efi

└─sda1    8:1    0  500M  0 part /boot

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#


[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# fdisk -l

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: gpt

Disk identifier: CC07BBFF-E48E-4614-B09E-BFD7ED16E3D9



#         Start          End    Size  Type            Name

 1      1026048      2050047    500M  Microsoft basic

 2      2050048     62912511     29G  Microsoft basic

14         2048        10239      4M  BIOS boot

15        10240      1024000    495M  EFI System      EFI System Partition


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: 0xe5bd4e29


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    33552383    16775168    7  HPFS/NTFS/exFAT


Disk /dev/sdc: 53.7 GB, 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

Disk label type: dos

Disk identifier: 0x4c1bf713


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048   104857599    52427776   83  Linux

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# mkfs -t xfs /dev/sdc

mkfs.xfs: /dev/sdc appears to contain a partition table (dos).

mkfs.xfs: Use the -f option to force overwrite.

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# mkfs -t xfs /dev/sdc1

meta-data=/dev/sdc1              isize=256    agcount=4, agsize=3276736 blks

         =                       sectsz=4096  attr=2, projid32bit=1

         =                       crc=0        finobt=0, sparse=0, rmapbt=0

         =                       reflink=0

data     =                       bsize=4096   blocks=13106944, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1

log      =internal log           bsize=4096   blocks=6399, version=2

         =                       sectsz=4096  sunit=1 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

Discarding blocks...Done.

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# mount /dev/sdc1 /u02

mount: mount point /u02 does not exist

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# mkdir /u02

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# mount /dev/sdc1 /u02

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# df -h

Filesystem                                       Size  Used Avail Use% Mounted on

devtmpfs                                         3.8G     0  3.8G   0% /dev

tmpfs                                            3.8G     0  3.8G   0% /dev/shm

tmpfs                                            3.8G  8.6M  3.8G   1% /run

tmpfs                                            3.8G     0  3.8G   0% /sys/fs/cgroup

/dev/sda2                                         30G   19G   11G  65% /

/dev/sda1                                        497M  329M  169M  67% /boot

/dev/sda15                                       495M  7.4M  488M   2% /boot/efi

//oraclemigrsa.file.core.windows.net/transfer01  5.0T  3.3G  5.0T   1% /mnt/Backup

tmpfs                                            766M     0  766M   0% /run/user/995

tmpfs                                            766M     0  766M   0% /run/user/54322

/dev/sdc1                                         50G   33M   50G   1% /u02

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# blkid

/dev/sda2: LABEL="btr_pool" UUID="f6f5bfb0-4864-48a6-9a16-2d143b78c40d" UUID_SUB="3bd8c97c-a996-43b4-801c-70bb51b5ea22" TYPE="btrfs" PARTUUID="2006f71f-46a3-48f3-acfe-d17a895b899d"

/dev/sda1: UUID="90b82350-a900-475f-8d8f-23db65d7f70a" TYPE="xfs" PARTUUID="2018006f-a0e6-4796-9b0d-3f4a2ed5321d"

/dev/sda14: PARTUUID="63bb33c1-4d38-4651-98f8-3f604016aa35"

/dev/sda15: SEC_TYPE="msdos" UUID="3B29-C04C" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="a73c2ce6-b3b3-4d7b-8c2c-817217f5958e"

/dev/sdb1: LABEL="Temporary Storage" UUID="6232F43632F410B1" TYPE="ntfs"

/dev/sdc1: UUID="f4022ae4-936f-48d5-b477-0fc06f5740a9" TYPE="xfs"

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# vi /etc/fstab

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# df -h

Filesystem                                       Size  Used Avail Use% Mounted on

devtmpfs                                         3.8G     0  3.8G   0% /dev

tmpfs                                            3.8G     0  3.8G   0% /dev/shm

tmpfs                                            3.8G  8.6M  3.8G   1% /run

tmpfs                                            3.8G     0  3.8G   0% /sys/fs/cgroup

/dev/sda2                                         30G   19G   11G  65% /

/dev/sda1                                        497M  329M  169M  67% /boot

/dev/sda15                                       495M  7.4M  488M   2% /boot/efi

//oraclemigrsa.file.core.windows.net/transfer01  5.0T  3.3G  5.0T   1% /mnt/Backup

tmpfs                                            766M     0  766M   0% /run/user/995

tmpfs                                            766M     0  766M   0% /run/user/54322

/dev/sdc1                                         50G   33M   50G   1% /u02

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]#

[root@oracletgt-1 ~]# cd /u02/

[root@oracletgt-1 u02]# ls -lrt

total 0

[root@oracletgt-1 u02]#

[root@oracletgt-1 u02]# touch anurag_mark.txt

[root@oracletgt-1 u02]#

[root@oracletgt-1 u02]#

[root@oracletgt-1 u02]# ls -lrt

total 0

-rw-r--r--. 1 root root 0 May  3 10:17 anurag_mark.txt

[root@oracletgt-1 u02]#

[root@oracletgt-1 u02]#




Automatically mount an attached storage volume after reboot


[root@oracletgt-1 u02]#

[root@oracletgt-1 u02]# cat /etc/fstab


#

# /etc/fstab

# Created by anaconda on Tue Feb 11 10:36:35 2020

#

# 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

#

/dev/sda2               /                       btrfs   subvol=root     0 0

UUID=90b82350-a900-475f-8d8f-23db65d7f70a /boot                   xfs     defaults        0 0

UUID=3B29-C04C          /boot/efi               vfat    defaults,uid=0,gid=0,umask=0077,shortname=winnt 0 0


UUID=f4022ae4-936f-48d5-b477-0fc06f5740a9  /u02  xfs  defaults,nofail  0  2

[root@oracletgt-1 u02]#



Link :

https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.html


No comments:

Post a Comment