In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how Azure mounts data disks to ubuntu virtual machines. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Virtual machines created on azure are assigned two disks by default, a system disk and a temporary disk. If we want to install software such as mysql in the system, we need to create and mount a separate data disk to save the database file. This is because temporary disks are defined as operations for temporary data processing. It is characterized by good performance (SSD), but the space is limited and the data stored on it is not guaranteed (in some cases the data will be emptied). Therefore, temporary disks should never be used to store important data. At the same time, it is best not to put the data of the application on the system disk to facilitate migration, backup and expansion. This article describes how to add data disks to the Ubuntu virtual machine in Azure and complete the configuration accordingly.
Why do you need a separate process to add disks?
When we created a virtual machine from portal, we did not provide the option to add a data disk. So the created host contains only two default disks: the OS disk and the temporary disk:
And all we can see on portal is a system disk, and Azure hides temporary disk-related configurations from users.
Next we will show you how to add a data disk to a virtual host.
Check whether the virtual machine supports
The first thing you need to confirm is whether the virtual machine you created supports adding data disks, which can also be ignored. Because now the cheapest virtual machine can support adding two data disks. More expensive virtual opportunities support the addition of more data disks, so just pay attention here. You can view it in the size of the virtual machine:
I can't believe that Azure has launched a virtual machine that costs only $5.95 a month in some areas. it's so touching!
Standard disk and managed disk
Standard disk is an early virtual machine disk type introduced by Azure, which requires the explicit creation of an Azure Storage Account, this account is used to store virtual hard disk (VHD) files for virtual machine disks. The VHD file is stored in Azure Storage Account as a page Blob:
Managed disk is a new disk type, and the most prominent feature is that Azure manages the relevant Storage Account in the background, which makes it much easier for users to configure. At the same time, it is easier to expand. Of course, there are a lot of details to improve, interested students can refer to its official documentation.
The disk type used by the virtual machine is determined when the virtual machine configuration is created, and the default value is now managed disk:
The disk types in the demo of this article are all managed disks.
Add a data disk to a virtual machine
Okay, let's finally get to the point! Click the "Add data disk" button in the disks configuration of the virtual machine to start adding disks, then open the drop-down list and click the "Create disk" button:
Fill in the name of the disk and some basic configurations:
Whether or not to choose SSD depends on your usage scenario (SSD is still expensive), and the default size is 1T. Click "Create" when the setup is complete. Finally, save the disk configuration and log in to the system to view the newly added disks.
Now log in to the system to check the disk:
/ dev/sdc is the new disk.
Check the disk and mount status in the current system:
$df-h
By default, the OS disk is marked "/ dev/sda". The partition name is / dev/sda1 and the mount point is /.
The temporary disk is marked "/ dev/sdb". The partition name is / dev/sdb1 and the mount point is / mnt.
Let's partition the newly added disk and mount it to the system.
Mount a data disk
First partition the disk using the fdisk command:
(echo n; echo p; echo 1; echo; echo; echo w) | sudo fdisk / dev/sdc
Then use the mkfs command to write the file system to the partition:
Sudo mkfs-t ext4 / dev/sdc1
Finally mount the new disk partition to / mydata mount the new disk to make it accessible in the operating system:
Sudo mkdir / mydata & & sudo mount / dev/sdc1 / mydata
Then use the df command to view the results:
$df-h
The disk partition has been mounted to the directory / mydata.
Finally, it is set to mount at boot time.
Use the blkid utility to get the UUID of the disk:
$sudo-I blkid
The output looks like this:
/ dev/sdc1: UUID= "ed129dcb-b234-4fdf-877d-9ac359e1b544" TYPE= "ext4" PARTUUID= "6b476db1-01"
Add a line similar to the following in the / etc/fstab file:
UUID=ed129dcb-b234-4fdf-877d-9ac359e1b544 / mydata ext4 defaults,nofail,barrier=0 12
The file is saved and the disk will be mounted automatically when you turn it on later. At this point, we have completed all the configurations for adding data disks.
This is the end of the article on "how Azure mounts data disks to ubuntu virtual machines". I hope the above content can be of some help to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.