投げ銭

★当サイトへの投げ銭(PayPal)★

LINK


(無償、寄付歓迎) logo
世界中で使われるISO標準オフィスソフト(MSオフィス互換)

★LibreOfficeの導入事例★
詳細について

人気の投稿(1ヶ月間)

Ad

Ad

投げ銭

★当サイトへの投げ銭(PayPal)★

2012年4月13日金曜日

【Linux CentOS6.2 64bit版】gdiskコマンドを使いGPT対応大容量ディスクにパーティションを追加する

GPTに対応したディスクには、gdiskコマンドでもパーティションの操作などができる。
gdiskコマンドは、fdiskと操作がとても似ている。

以下は、gdiskコマンドを使って、GPTに対応した大容量ディスクにパーティションを追加したときのメモ。

gdiskコマンドは、epelリポジトリにあってyumを使ってインストールできる。
GPT対応のディスクツールをインストールした」を参照。



■現在のパーティションテーブルを確認する

○対象のディスクデバイスを指定しgdiskコマンドを起動した
 [root@iscsi-01 ~]# gdisk /dev/sda ←(例)としてsdaを指定している
GPT fdisk (gdisk) version 0.8.2

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present ←このディスクのパーティション管理はGPTになっている

Found valid GPT with protective MBR; using GPT.

○現在のパーティションテーブルを表示させた
Command (? for help): p
Disk /dev/sda: 9762242560 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): (略)
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9762242526
Partitions will be aligned on 2048-sector boundaries
Total free space is 9576898493 sectors (4.5 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1026047   500.0 MiB   EF00
   2         1026048       164866047   78.1 GiB    0700
   3       164866048       185346047   9.8 GiB     8200 ←最後尾にあるパーティションの末端セクタ
( この次のセクタから次のパーティションが開始されるように以下の手順で設定している)


■新しいパーティションを追加準備する
(この段階では、実際にはまだディスクに書き込まれない。wコマンドを発行すると書き込まれる)

○一つ目のパーティションを追加準備する

First sector ・・・追加するパーティションの開始位置を指定する
Last sector  ・・・このパーティションの終了位置(or 確保するサイズ)を指定する
Command (? for help): n
Partition number (4-128, default 4):
First sector (34-9762242526, default = 185346048) or {+-}size{KMGTP}: ←何も指定せずエンターキーを押せばデフォルト値が適用された
Last sector (185346048-9762242526, default = 9762242526) or {+-}size{KMGTP}: +1T ←確保するサイズで指定した
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ←Linux filesystemで使用するので、何も指定せずエンターキーを押した
Changed type of partition to 'Linux filesystem'

○予約されたパーティションテーブルを表示させた
Command (? for help): p
Disk /dev/sda: 9762242560 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): (略)
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9762242526
Partitions will be aligned on 2048-sector boundaries
Total free space is 7429414845 sectors (3.5 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1026047   500.0 MiB   EF00
   2         1026048       164866047   78.1 GiB    0700
   3       164866048       185346047   9.8 GiB     8200
   4       185346048      2332829695   1024.0 GiB  8300  Linux filesystem

○同様の手順でパーティションを追加し、予約されたパーティションテーブルを表示させた
実際の書き込みに備えて誤りがないかを最終確認
Command (? for help): p
Disk /dev/sda: 9762242560 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): (略)
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9762242526
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         1026047   500.0 MiB   EF00
   2         1026048       164866047   78.1 GiB    0700
   3       164866048       185346047   9.8 GiB     8200
   4       185346048      2332829695   1024.0 GiB  8300  Linux filesystem
   5      2332829696      5268842495   1.4 TiB     8300  Linux filesystem
   6      5268842496      7416326143   1024.0 GiB  8300  Linux filesystem
   7      7416326144      9762242526   1.1 TiB     8300  Linux filesystem


■予約したパーティションテーブルを実際にディスクに書き込み、システムを再起動する
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).
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.

[root@iscsi-01 ~]# reboot ←Linuxシステムを再起動させる。再起動後に新しいパーティションが有効になる。

投げ銭

★当サイトへの投げ銭(PayPal)★

Ad

Ad