Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Created June 24, 2014 02:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkuchiki/49142585c4860e773a42 to your computer and use it in GitHub Desktop.
Save tkuchiki/49142585c4860e773a42 to your computer and use it in GitHub Desktop.
General Purpose SSD パーティション拡張方法
$ parted /dev/xvda
GNU Parted 2.1
/dev/xvda を使用
GNU Parted へようこそ! コマンド一覧を見るには 'help' と入力してください。
(parted) help
  align-check TYPE N                        check partition N for TYPE(min|opt) alignment
  check NUMBER                  ファイルシステムの簡単なチェックする
  cp [転送元デバイス] 転送元NUMBER 転送先NUMBER
                    ファイルシステムを他のパーティションにコピーする
  help [コマンド]               ヘルプ表示。コマンド指定でそのヘルプを表示
  mklabel,mktable ラベルの種類  新しいラベル(パーティションテーブル)を作る
  mkfs NUMBER ファイルシステムの種類
                    指定した種類のファイルシステムを作る
  mkpart パーティションの種類 [ファイルシステムの種類] 開始 終了
                    パーティションを作る
  mkpartfs パーティションの種類 ファイルシステムの種類 開始 終了
                    パーティションとファイルシステムを作る
  move NUMBER 開始 終了         パーティションを移動する
  name NUMBER 名前              パーティションに名前をつける
  print [devices|free|list,all|NUMBER]
                     パーティションテーブルや、利用可能なデバイス、空き領域、
                     見つかった全てのパーティション、あるいは特定のパーティションについて表示する
  quit                          プログラムを終了する
  rescue 開始 終了              開始、終了で指定した範囲付近にあるパーティションを復活させる
  resize NUMBER 開始 終了       パーティションとその中のファイルシステムをリサイズする
  rm NUMBER                     パーティションを削除する
  select デバイス               操作するデバイスを選択
  set NUMBER フラグ 状態        ファイルシステムのフラグと状態を設定する
  toggle [NUMBER [FLAG]]        パーティションのフラグの状態を反転する
  unit UNIT                     デフォルトの単位を UNIT にする
  version                       GNU Parted のバージョンと著作権情報を表示
(parted) print
エラー: あるべき GPT テーブルのバックアップがディスクの最後にありません。他の OS がディスクはもっと小さいものだと思っているのかもしれません。バックアップを最後に持ってきて(古い
バックアップを削除して)修復しますか?
修正/Fix/無視(I)/Ignore/取消(C)/Cancel? F
警告: /dev/xvda で利用可能な領域の一部が利用されていません。GPT を修正して全ての領域を利用可能にするか(25165824 ブロック増えます)、このままで続行することができますが、どうします
か?
修正/Fix/無視(I)/Ignore? F
モデル: Xen Virtual Block Device (xvd)
ディスク /dev/xvda: 21.5GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: gpt

号  開始    終了    サイズ  ファイルシステム  名前                 フラグ
128   1049kB  2097kB  1049kB                    BIOS Boot Partition  bios_grub
 1    2097kB  8590MB  8588MB  ext4              Linux

(parted) quit
$ gdisk /dev/xvda
GPT fdisk (gdisk) version 0.8.7

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/xvda: 41943040 sectors, 20.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 87FB49FF-E94B-4BE7-B1DE-D393E5FFC85D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 41943006
Partitions will be aligned on 2048-sector boundaries
Total free space is 25167838 sectors (12.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            4096        16777182   8.0 GiB     8300  Linux
 128            2048            4095   1024.0 KiB  EF02  BIOS Boot Partition

Command (? for help): d
Partition number (1-128): 1

Command (? for help): p
Disk /dev/xvda: 41943040 sectors, 20.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 87FB49FF-E94B-4BE7-B1DE-D393E5FFC85D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 41943006
Partitions will be aligned on 2048-sector boundaries
Total free space is 41940925 sectors (20.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
 128            2048            4095   1024.0 KiB  EF02  BIOS Boot Partition

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-41943006, default = 4096) or {+-}size{KMGTP}:
Last sector (4096-41943006, default = 41943006) 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): p
Disk /dev/xvda: 41943040 sectors, 20.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 87FB49FF-E94B-4BE7-B1DE-D393E5FFC85D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 41943006
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            4096        41943006   20.0 GiB    8300  Linux filesystem
 128            2048            4095   1024.0 KiB  EF02  BIOS Boot Partition

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/xvda.
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.
$ reboot
$ resize2fs /dev/xvda1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment