0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu 21.04で内蔵ドライブを認識させる方法(備忘録)

Posted at

古くなったAppleのMacMini(多分 MC816J/A [Mac mini Intel Core i5 2.5GHz)をUbuntuで利用しようとInstallしたところ2つ入れたはずのHDD(500GBx2)の片方が認識されない。
現象:/dev/sdbが人示威されているのに/dev/sdaが出てこない。

lshw のアウトプット

(省略)
*-scsi:0
          物理ID: c
          論理名: scsi0
          性能: emulated
        *-disk
             詳細: ATA Disk
             製品: ST500LM012 HN-M5
             物理ID: 0.0.0
             バス情報: scsi@0:0.0.0
             論理名: /dev/sda
             バージョン: 0003
             シリアル: xxxxx
             サイズ: 465GiB (500GB)
             性能: gpt-1.00 partitioned partitioned:gpt
             設定: ansiversion=5 guid=9c87a212-df23-45fc-8fc4-4136ff72e9e2 logicalsectorsize=512 sectorsize=4096
           *-volume:0
                詳細: Windows FAT ボリューム
                ベンダー: BSD  4.4
                物理ID: 1
                バス情報: scsi@0:0.0.0,1
                論理名: /dev/sda1
                バージョン: FAT32
                シリアル: 67e3-17ed
                サイズ: 199MiB
                容量: 199MiB
                性能: boot fat initialized
                設定: FATs=2 filesystem=fat label=EFI
           *-volume:1
                詳細: EXT4ボリューム
                ベンダー: Linux
                物理ID: 2
                バス情報: scsi@0:0.0.0,2
                論理名: /dev/sda2
                論理名: /mnt/hdd2
                バージョン: 1.0
                シリアル: xxxxx
                サイズ: 465GiB
                容量: 465GiB
                性能: journaled extended_attributes large_files huge_files dir_nlink recover 64bit extents ext4 ext2 initialized
                設定: created=2022-01-09 03:26:41 filesystem=ext4 modified=2022-01-10 06:02:46 mount.fstype=ext4 mount.options=rw,relatime mounted=2022-01-10 06:02:46 name=Apple HFS/HFS+ state=mounted
     *-scsi:1
          物理ID: d
          論理名: scsi1
          性能: emulated
        *-disk
             詳細: ATA Disk
             製品: APPLE HDD ST500L
             物理ID: 0.0.0
             バス情報: scsi@1:0.0.0
             論理名: /dev/sdb
             バージョン: 0008
             シリアル: xxxx
             サイズ: 465GiB (500GB)
             性能: gpt-1.00 partitioned partitioned:gpt
             設定: ansiversion=5 guid=ea198f2c-9f2b-450f-a38d-7fcf29ad60fe logicalsectorsize=512 sectorsize=4096

HDD2として読み書きできるようにします。
参考:https://www.tecklyfe.com/how-to-partition-format-and-mount-a-disk-on-ubuntu-20-04/

これから行うこと

  1. gdiskでパーティションの作成
  2. blkidでブロックデバイスのUUIDを確認
  3. mkdirでマウント先のDirを作成
  4. fstabでUUIDをつかって/dev/sba2を/mnt/hdd2としてマウントする

パーティションの作成

$ sudo gdisk /dev/sda
Command (? for help): d    *削除=delete
Partition number (1-2): 2

Command (? for help): n    *新規=new
Partition number (2-128, default 2): 
First sector (34-976773134, default = 409640) or {+-}size{KMGTP}: 
Last sector (409640-976773134, default = 976773134) or {+-}size{KMGTP}: 
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): w   *書き込み=write

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y

確認

$ sudo blkid
[sudo] xxxxxxx のパスワード: 
...(省略)...
/dev/sda2: UUID="9910d17d-998d-4a46-8d4e-9afa47cac968" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Apple HFS/HFS+" PARTUUID="77dce7b5-bd34-44d3-ad6e-d21611292f4b"

$ sudo vi /etc/fstab
...(省略)...
# /mnt/hdd2 is /dev/sda2 *added by who
/dev/disk/by-uuid/9910d17d-998d-4a46-8d4e-9afa47cac968 /mnt/hdd2 ext4 defaults 0 0

マウント先のDirを作成

$ mkdir /mnt/hdd2

fstabの編集

...(省略)...
# /mnt/hdd2 is /dev/sda2 *added by who
/dev/disk/by-uuid/9910d17d-998d-4a46-8d4e-9afa47cac968 /mnt/hdd2 ext4 defaults 0 0

$ df
...(省略)...
/dev/sda2                         479470248    73820 454970960   1% /mnt/hdd2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?