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, 2019 in GCP by anonymous
• 19,610 points
2,393 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, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer
–1 vote
1 answer

How to copy files between Cloud Shell and the local machine in GCP?

Hi@akhtar, You can copy files from the remote ...READ MORE

answered Nov 9, 2020 in GCP by MD
• 95,460 points
9,503 views
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,350 points
2,884 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, 2019 in GCP by Sirajul
• 59,230 points
2,896 views
0 votes
1 answer
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, 2019 in GCP by Sirajul
• 59,230 points

edited Jun 16, 2023 by Khan Sarfaraz 1,245 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, 2019 in GCP by Sirajul
• 59,230 points
7,248 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP