非対話型 parted コマンドでパーティション・タイプを設定する

非対話型 parted コマンドでパーティション・タイプを設定する

Linux(Centos)には新しいディスクがあります。

# fdisk -l /dev/sdb

Disk /dev/sdb: 536 MB, 536870912 bytes, 1048576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

次のコマンドを使用して、GPTパーティションテーブルと新しいパーティションを作成します。

# parted -a optimal --script /dev/sdb mklabel gpt mkpart primary 0% 100%

fdisk -l示す:

# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 536 MB, 536870912 bytes, 1048576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 332CB746-DE7D-4FB0-AE34-D9B5CB008473


#         Start          End    Size  Type            Name
 1         2048      1046527    510M  Microsoft basic primary

partedコマンドがタイプを ""に設定するのはなぜですかMicrosoft basicLinux filesystem上記のコマンドライン(非対話型)コマンドを使用してparted""に設定するにはどうすればよいですか?

現在これを変更するには、gdisk /dev/sdb手動で「」を実行してからtコードを選択する必要があります8300

Command (? for help): t
Using 1
Current type is 'Microsoft basic data'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

もう一つの質問は、上記のコマンドを使用してパーティションを作成し、サイズを使用するときにコマンドを使用してpartedパーティションを作成する場合よりもサイズが1MB小さくなるのはなぜですか?100%gdisk

分離された:

#         Start          End    Size  Type            Name
 1         2048      1046527    510M  Linux filesyste primary

gディスク:

#         Start          End    Size  Type            Name
 1         2048      1048542    511M  Linux filesyste Linux filesystem

ベストアンサー1

おすすめ記事