Ubuntu 18.04 に gdisk を使用して 12TB のHDDを増設したときのメモ

これまで2TBよりも大きいHDDの増設には parted を使用してきましたが、先日うまくいかないことがあり、 gdisk を試したところ、いい感じでうまくいったので、メモしておきます。

  1. 増設するHDDのデバイス名を確認
  2. fdisk -l が手っ取り早いです。

    sudo fdisk -l
    
    Disk /dev/sdg: 10.9 TiB, 12000138625024 bytes, 23437770752 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
    

    /dev/sdg がそれだとわかります。

  3. gdisk を起動
  4. gdisk デバイス名 で gdisk が起動し、デバイスをすぐに操作できるようになります。

    
    sudo gdisk /dev/sdg
    GPT fdisk (gdisk) version 1.0.1
    
    Partition table scan:
      MBR: not present
      BSD: not present
      APM: not present
      GPT: not present
    
    Creating new GPT entries.
    
    Command (? for help): 
    

    ここで、? for help とありますから、すなおに ? とタイプしてみます。

    Command (? for help): ?
    b	back up GPT data to a file
    c	change a partition's name
    d	delete a partition
    i	show detailed information on a partition
    l	list known partition types
    n	add a new partition
    o	create a new empty GUID partition table (GPT)
    p	print the partition table
    q	quit without saving changes
    r	recovery and transformation options (experts only)
    s	sort partitions
    t	change a partition's type code
    v	verify disk
    w	write table to disk and exit
    x	extra functionality (experts only)
    ?	print this menu
    
    Command (? for help): 
    
  5. パーティションの作成
  6. まず私はパーティションを作成したいので、 n をタイプしました。

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

    基本的にデフォルト通りでなんら問題ないかと思います。

  7. パーティションテーブルの確認
  8. p でパーティションテーブルを確認できます。

    Command (? for help): p
    Disk /dev/sdg: 23437770752 sectors, 10.9 TiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): DDA3B0D7-1DDB-4C6B-AB53-E6ADCB351371
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 23437770718
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 2014 sectors (1007.0 KiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048     23437770718   10.9 TiB    8300  Linux filesystem
    
    Command (? for help): 
    
  9. パーティションテーブルの書き込み
  10. 上記で問題なければ、 w で書き込むことができます。

    Command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!
    
    Do you want to proceed? (Y/N): Y
    OK; writing new GUID partition table (GPT) to /dev/sdg.
    The operation has completed successfully.
    

つまり、

sudo gdisk デバイス名
n #新規バーティションの作成
p #パーティションの表示
w #パーティションの書き込み

で簡単にできてしまいました。

最後に、ext4にフォーマットします。

sudo mkfs.ext4 /dev/sdg
mke2fs 1.42.13 (17-May-2015)
Found a gpt partition table in /dev/sdg
Proceed anyway? (y,n) y
Creating filesystem with 2929721344 4k blocks and 366215168 inodes
Filesystem UUID: UUIDが表示される
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544, 1934917632, 
	2560000000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done       

あとはこれをマウントすればOKです。

gdisk、使いやすくていい感じです。

Print Friendly, PDF & Email

3 thoughts on “Ubuntu 18.04 に gdisk を使用して 12TB のHDDを増設したときのメモ

  1. ピングバック: Ubuntu で 新しいハードディスクを追加する方法 step by step

  2. ピングバック: 2TB以上のSSD/HDD増設時にfdiskでうまくいかない場合の対処法(Ubuntu) - しゃこメモ

  3. ピングバック: Ubuntu 14.04 に parted を利用して 8TBのHDDを増設したときのメモ

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください