主に IT 技術を整理するためにメモ的に書き溜めています。少しだけフリーソフトもあるよ。コメントを残すには、 facebook を使ってください。

How to Create LVM

最終更新日 2007-04-07 18:52:36 (1年以上前の記事です)
LVM を手動で作成したときのメモ。手順としては、
  • LVM 用のパーティションの作成。
  • 物理ボリュームの作成。
  • ボリュームグループの作成。
  • 論理ボリュームの作成。
  • ext3 の作成。
  • マウント。
結構長い。

1. Create Primary Partition for LVM

First of all, a primary partition for LVM should be created on HDD with fdisk command.

# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

* p is a command for printing information.
Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
Using default value 60801

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
* 8e is a code of LVM partition.
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       60801   488384001   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Please note a Hex code of the LVM is 8e.

2. Create Physical Volume(PV)

Physical volume should be created with pvcreate command.

# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

3. Create Volume Group(VG)

Volume Group should be created with pvcreate command.

# vgcreate usbvg /dev/sdb1
  Volume group "usbvg" successfully created

4. Create Logical Volume(LV)

Logical Volume should be created with pvcreate command. It's going to be logical partition which you will use as real partition.

# lvcreate -L 15G -n usb_15g usbvg
  Logical volume "usb_15g" created

5. Create File System (ext3)

# mke2fs -j /dev/usbvg/usb_15g
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1966080 inodes, 3932160 blocks
196608 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4026531840
120 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

6. How to mount

# mount -t ext3 /dev/usbvg/usb_15g /mnt/usb_15/
最終更新日 2007-04-07 18:52:36

コメント このエントリーをはてなブックマークに追加

フリーソフトウエア
EnjoiFLV
EnjoiPacket
EnjoiCrypto
ランキング
rank1, rank2, rank3, rank7, rank9, rank10, rank11
todo メモ
facebook 対応
ページ処理
RSS feed
検索機能
認証いる?
更新日表示
実はカテゴリ機能
多言語
実はユーザ機能
ソースその内公開
動作環境メモ
php-5.1.6 with PDO
SQLite-3.3
IE6
FireFox-1.5
RSS
非認証

検索
Google