How to format and mount a local SSD device?

0 votes
What's the process for format and mount a local SSD device?
related to an answer for: Creating an instance with a local SSD
Nov 6 in GCP by anonymous
• 5,700 points
24 views

1 answer to this question.

0 votes

The easiest way to connect local SSDs to your instance is to format and mount each device with a single partition.

Format and mount the new local SSD on your Linux instance. You can use any partition format and configuration that you need. For this example, create a single ext4 partition.

  1. Go to the VM instances page.

  2. Click the SSH button next to the instance that has the new attached local SSD. The browser opens a terminal connection to the instance.

  3. In the terminal, use the lsblk command to identify the local SSD that you want to mount.

    $ lsblk

    Local SSDs in SCSI mode have standard names like sdb. Local SSDs in NVMe mode have names like nvme0n1, as shown in the NAME column of the following output:

    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda       8:0    0   10G  0 disk
    └─sda1    8:1    0   10G  0 part /
    nvme0n1 259:0    0  375G  0 disk
    
  4. Format the local SSD with an ext4 file system. This command deletes all existing data from the local SSD.

    $ sudo mkfs.ext4 -F /dev/[SSD_NAME]

    Replace [SSD_NAME] with the ID of the Local SSD that you want to format. For example, specify nvme0n1 to format the first NVMe Local SSD on the instance.

  5. Use the mkdir command to create a directory where you can mount the device.

    $ sudo mkdir -p /mnt/disks/[MNT_DIR]

    where: [MNT_DIR] is the directory where you want to mount your local SSD.

  6. Mount the local SSD to the instance. Optionally, you can disable write cache flushing to improve write performance while risking reduced durability for up to two seconds of cached data writes.

    $ sudo mount /dev/[SSD_NAME] /mnt/disks/[MNT_DIR]

    where:

    • [SSD_NAME] is the ID of the Local SSD that you want to mount.

    • [MNT_DIR] is the directory where you want to mount your local SSD.

  7. Configure read and write access to the device. For this example, grant write access to the device for all users.

    $ sudo chmod a+w /mnt/disks/[MNT_DIR]

    where: [MNT_DIR] is the directory where you mounted your local SSD.

For more info refer to https://cloud.google.com/compute/docs/disks/local-ssd#formatandmount 

answered Nov 6 by Sirajul
• 38,820 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer

How to delete a project from Google Cloud Console

First of all, select the project you ...READ MORE

answered Apr 18, 2018 in GCP by kurt_cobain
• 9,260 points
175 views
+1 vote
2 answers

How to open a port on google compute engine

You need to set the firewall rule ...READ MORE

answered Jul 9 in GCP by K sagar
157 views
0 votes
1 answer

Creating a SQL Server instance using Google Compute engine.

Google Compute Engine provides public images preconfigured with ...READ MORE

answered Sep 23 in GCP by Sirajul
• 38,820 points
38 views
0 votes
1 answer

How do i install gcloud compute?

The gcloud compute command-line tool enables you to easily ...READ MORE

answered Sep 23 in GCP by Sirajul
• 38,820 points
48 views
0 votes
1 answer

Is there a way to mount a cloud storage as a local disk?

You could probably try using Gcsfuse for ...READ MORE

answered Oct 9 in GCP by Sirajul
• 38,820 points
54 views
0 votes
1 answer