geek-peachの日記

geekを目指してpeachが頑張るブログ。実行したコマンドやデータ分析についてメモっていく

HDDのパーティション削除+lvmの作成

f:id:geek-peach:20180501204333j:plain

今日は昔使っていたHDDを新しく組んだPCに追加します。

私の環境はubuntu17.10(今度OSのバージョンアップもやりますかね。)

 

まずは昔のパーティションを削除の、前にパーティションの確認

$ sudo fdisk /dev/sda

コマンド (m でヘルプ): p

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 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

Disklabel type: dos

Disk identifier: 0x8b6c2ac2

 

バイス   起動     Start   最後から     セクタ   Size Id タイプ

/dev/sda1               63  209728574  209728512   100G  7 HPFS/NTFS/exFAT

/dev/sda2        209728575 1233727739 1023999165 488.3G  7 HPFS/NTFS/exFAT

/dev/sda3       1233727740 2257726904 1023999165 488.3G  7 HPFS/NTFS/exFAT

/dev/sda4       2257726905 2467455416  209728512   100G  7 HPFS/NTFS/exFAT

 

 パーティションの削除

コマンド (m でヘルプ): d

パーティション番号 (1-4, default 4): 1

#1〜4まで削除

 

消えてるか確認

コマンド (m でヘルプ): p

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 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

Disklabel type: dos

Disk identifier: 0x8b6c2ac2

 

パーティション情報の変更を保存して終了 

コマンド (m でヘルプ): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

 

5年前の記事を参考にlvmを作成(笑)

geek-paech.hatenablog.com

たまには自分の記事も役に立ちますねw

次回はHDDとSSDのパフォーマンス比較でもやってみましょう。

 

追記)

/etc/fstabに以下を追加してOS起動時に自動的にマウントする様に設定

/dev/mapper/hdd2TB-data_strg /data ext4 errors=remount-ro 0 1