How to add HDD to Ubuntu

Introduction

When I was building a personal computer, I had several opportunities to add HDDs, and each time I was investigating how to add HDDs. So here are the steps you took in your environment. In addition, the environment is Ubuntu 20.04LTS, and we will proceed assuming that the HDD is already connected.

Recognition status of additional HDD

First, check how the HDD you want to add is recognized on the Ubuntu side.

dmesg | lv

When you hit

For NVME


[    2.547103] EXT4-fs (nvme0n1p2): mounted filesystem with ordered data mode. Opts: (null)

For HDD


[    1.196264] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    1.196984] ata2.00: ATA-10: WDC WD40EFAX-68JH4N0, 82.00A82, max UDMA/133
[    1.196985] ata2.00: 7814037168 sectors, multi 16: LBA48 NCQ (depth 32), AA
[    1.197574] ata2.00: configured for UDMA/133
[    1.197712] scsi 1:0:0:0: Direct-Access     ATA      WDC WD40EFAX-68J 0A82 PQ: 0 ANSI: 5
[    1.197885] sd 1:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[    1.197886] sd 1:0:0:0: [sda] 4096-byte physical blocks
[    1.197889] sd 1:0:0:0: [sda] Write Protect is off
[    1.197890] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.197895] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

It is displayed as. Below, we will proceed as adding / dev/sda.

Partition and format

HDDs of 2TB or more need to be formatted in GPT format instead of the usual format.

sudo parted /dev/sda

Now that you can access / dev/sda, allocate GPT.

mklabel gpt

Then create a partition.

mkpart

At this point, you will be asked to start and end the sector, so you can allocate disk space as needed.

Finally,

sudo mkfs.ext4 /dev/sda1

Format as ext4 format.

fstab settings

The HDD is ready, but ubuntu has not been set up yet. First, check the UUID of the disk.

sudo blkid /dev/sda1

/dev/sda1: UUID="2745c617-1428-4d4d-ab18-hogehoehoed9" TYPE="ext4" PARTLABEL="pub" PARTUUID="hogehoge-1416-4c61-b6a3-hoehoe"

Copy the UUID value to fstab. Here, assuming that/dev/sda1 is mounted as/pub,

fstab


UUID=22745c617-1428-4d4d-ab18-hogehoehoed9       /pub    ext4    defaults        0       2

with this,

sudo mount -a

The HDD will be mounted with.

Summary

With a HDD of 2TB or more, the entire capacity cannot be used up with the normal format. It is necessary to allocate GPT to HDD and then format it with ext4 etc.

that's all.

Recommended Posts

How to add HDD to Ubuntu
How to add ActionText function
How to add Hyperledger Iroha Peer
How to use Bio-Formats on Ubuntu 20.04
How to install WildFly on Ubuntu 18.04
How to add the delete function
How to build vim on Ubuntu 20.04
How to distinguish ubuntu cloud image
[Xcode] How to add a README.md file
How to add local jar to maven pom.xml
[Java] How to add data to List (add, addAll)
How to add jar file in ScalaIDE
How to install production Metabase on Ubuntu
How to deploy
How to change the timezone on Ubuntu
How to add application version information to Sentry information
(Memo) How to solve dummy output in Ubuntu 20.04
How to configure ubuntu to be used on GCP
How to add / remove Ruby on Rails columns
How to add sound in the app (swift)
How to install NVIDIA driver on Ubuntu 18.04 (Note)
How to add a classpath in Spring Boot
How to conditionally add html.erb class in Rails
How to use nfs protocol version 2 with ubuntu 18.04
How to Install Oracle JDK 1.8 in Ubuntu 18.04 LTS?
How to build a Pytorch environment on Ubuntu
How to run NullpoMino 7.5.0 on Ubuntu 20.04.1 64bit version
Add files to jar files
How to develop OpenSPIFe
How to call AmazonSQSAsync
How to use Map
How to write Rails
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use map
How to use collection_select
How to adapt Bootstrap
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
How to write dockerfile
How to uninstall Rails
How to install docker-machine
[How to use label]
How to write docker-compose
How to use identity
How to use hashes
How to write Mockito
How to use JUnit 5
How to install MySQL
How to write migrationfile
How to build android-midi-lib
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector