How can I format and mount a new disk I've created?

Linode Staff

I've created a blank disk that I'd like to format with an ext filesystem and mount it afterwards? How can this be done? Can I have the disk mounted automatically during my server's boot process?

1 Reply

Once you create a new disk, you can edit the configuration profile that you boot your server under and assign it to a block storage device. This typically would start with /dev/sdc. If you have more than one disk, you can assign them to /dev/sdd and /dev/sde.

https://www.linode.com/docs/platform/disk-images/disk-images-and-configuration-profiles/#creating-a-blank-disk
https://www.linode.com/docs/platform/disk-images/disk-images-and-configuration-profiles/#editing-a-configuration-profile

To have the disk mounted automatically during your server's boot process, you can add an entry for the disk in your /etc/fstab file. Here's an example from my personal server:

/dev/sdc /mnt/test_dir ext4 defaults 0 1

Once this is done, boot your server and verify that the disk has been detected. To do so, you can run the "blkid" command.

blkid

/dev/sdc: UUID="d6daebd2-7ff9-420c-83d5-dd19ca0671b5" TYPE="ext4"
/dev/sda: UUID="e35b085a-5943-4752-99a6-77608f260e12" TYPE="ext4"
/dev/sdb: UUID="c3d374ca-a9de-497a-8b48-dcefc16ca42b" TYPE="swap"

To make a filesystem on the disk, you can use the 'mkfs' command. The following link provides some examples of this command.

https://linux.101hacks.com/unix/mkfs/

Now that the disk has been created, mounted, and formatted, you can change to this directory and create clank files on the disk for testing.

cd /mnt/test_dir
touch one two three

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct