Prepare temporary VM disk

To prepare a disk mounted on a Microsoft Azure VM:

  1. At the command line, connect to the new vm using the IP address from the prior task and ssh.
    ssh okta@AA.BB.CC.DD.
  2. Find the disk using dmesg| grep "SCSI disk" command.

    For example:

    # dmesg | grep "SCSI disk"
    [    2.234786] sd 3:0:1:0: [sdb] Attached SCSI disk
    [    2.243805] sd 0:0:0:0: [sda] Attached SCSI disk
    [   2.503937] sd 5:0:0:0: [sdc] Attached SCSI disk
  3. Create a primary disk partition using the sudo fdisk /dev/sdc command as shown below :

    For example:

    sudo fdisk /dev/sdc
    . . . 
    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): 1
    First sector (2048-1048575999, default 2048):
    Last sector, +sectors or +size{K,M,G,T,P} (2048-1048575999, default 1048575999):[cr]
    Command (m for help): w
    . . .
    Syncing disks.
  4. Create a pfile system on the disk the sudo mkfs -t ext4 /dev/sdc1 command as shown below :

    For example:

    sudo mkfs -t ext4 /dev/sdc1
    mke2ds 1.44.1 . . . 
    . . .
    Writing superblocsl and filesystem accounting information: done
  5. Create a mount point for the new disk using mkdir as shown below:
    sudo mkdir /datadrive
  6. Mount the disk to the new mount point using mount as shown below:
    sudo mount /dev/sdc1 /datadrive
  7. Determine the UUID of the disk using the blkid command as shown below:
    sudo -i blkid  | grep sdc1
    /dev/sdc1: UUID="1fcbf355-d641-4fcf-8817-0b4b492413ac" TYPE="ext4" PARTUUID="75642bad-01"
  8. Using an editor such as nano or vi add a new entry to /etc/fstab which should resemble:
    sudo nano /etc/fstab
    UUID="1fcbf355-d641-4fcf-8817-0b4b492413ac"      /datadrive   ext4   defaults,nofail   1 2
  9. Reboot the VM, reconnect and verify that the new file system is mounted:
    sudo shutdown -r now
    ssh okta@ip address
    df -h | grep sdc1

    The new device should show approximate 467GB free.

Related topics