Menu Close

Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

4.2. 實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​管​​​​​​​理​​​​​​​

此​​​​​​​部​​​​​​​份​​​​​​​描​​​​​​​述​​​​​​​了​​​​​​​進​​​​​​​行​​​​​​​各​​​​​​​種​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​管​​​​​​​理​​​​​​​的​​​​​​​指​​​​​​​令​​​​​​​。​​​​​​​

4.2.1. 建​​​​​​​立​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​

下​​​​​​​列​​​​​​​小​​​​​​​部​​​​​​​分​​​​​​​描​​​​​​​述​​​​​​​了​​​​​​​幾​​​​​​​項​​​​​​​使​​​​​​​用​​​​​​​來​​​​​​​建​​​​​​​立​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​的​​​​​​​指​​​​​​​令​​​​​​​。​​​​​​​

4.2.1.1. 設​​​​​​​定​​​​​​​分​​​​​​​割​​​​​​​區​​​​​​​類​​​​​​​型​​​​​​​

若​​​​​​​您​​​​​​​要​​​​​​​使​​​​​​​用​​​​​​​整​​​​​​​個​​​​​​​磁​​​​​​​碟​​​​​​​裝​​​​​​​置​​​​​​​來​​​​​​​作​​​​​​​為​​​​​​​您​​​​​​​的​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​,該​​​​​​​磁​​​​​​​碟​​​​​​​上​​​​​​​必​​​​​​​須​​​​​​​沒​​​​​​​有​​​​​​​分​​​​​​​割​​​​​​​表​​​​​​​。​​​​​​​對​​​​​​​於​​​​​​​ DOS 磁​​​​​​​碟​​​​​​​分​​​​​​​割​​​​​​​區​​​​​​​來​​​​​​​講​​​​​​​,分​​​​​​​割​​​​​​​區​​​​​​​ id 應​​​​​​​被​​​​​​​透​​​​​​​過​​​​​​​使​​​​​​​用​​​​​​​ fdisk 或​​​​​​​是​​​​​​​ cfdisk 指​​​​​​​令​​​​​​​來​​​​​​​設​​​​​​​為​​​​​​​ 0x8e。​​​​​​​當​​​​​​​使​​​​​​​用​​​​​​​整​​​​​​​個​​​​​​​磁​​​​​​​碟​​​​​​​裝​​​​​​​置​​​​​​​時​​​​​​​,只​​​​​​​有​​​​​​​分​​​​​​​割​​​​​​​表​​​​​​​必​​​​​​​須​​​​​​​被​​​​​​​清​​​​​​​除​​​​​​​掉​​​​​​​,如​​​​​​​此​​​​​​​一​​​​​​​來​​​​​​​便​​​​​​​能​​​​​​​有​​​​​​​效​​​​​​​地​​​​​​​清​​​​​​​除​​​​​​​該​​​​​​​磁​​​​​​​碟​​​​​​​上​​​​​​​的​​​​​​​所​​​​​​​有​​​​​​​資​​​​​​​料​​​​​​​。​​​​​​​您​​​​​​​可​​​​​​​藉​​​​​​​由​​​​​​​使​​​​​​​用​​​​​​​下​​​​​​​列​​​​​​​指​​​​​​​令​​​​​​​來​​​​​​​將​​​​​​​第​​​​​​​一​​​​​​​個​​​​​​​磁​​​​​​​區​​​​​​​化​​​​​​​零​​​​​​​以​​​​​​​便​​​​​​​移​​​​​​​除​​​​​​​現​​​​​​​有​​​​​​​的​​​​​​​分​​​​​​​割​​​​​​​表​​​​​​​:
dd if=/dev/zero of=PhysicalVolume bs=512 count=1

4.2.1.2. 初​​​​​​​始​​​​​​​化​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​

您​​​​​​​可​​​​​​​使​​​​​​​用​​​​​​​ pvcreate 指​​​​​​​令​​​​​​​來​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​一​​​​​​​個​​​​​​​將​​​​​​​被​​​​​​​用​​​​​​​來​​​​​​​作​​​​​​​為​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​的​​​​​​​區​​​​​​​塊​​​​​​​裝​​​​​​​置​​​​​​​。​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​和​​​​​​​格​​​​​​​式​​​​​​​化​​​​​​​檔​​​​​​​案​​​​​​​系​​​​​​​統​​​​​​​是​​​​​​​相​​​​​​​似​​​​​​​的​​​​​​​。​​​​​​​
下​​​​​​​列​​​​​​​指​​​​​​​令​​​​​​​會​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​ /dev/sdd1、​​​​​​​/dev/sde1 以​​​​​​​及​​​​​​​ /dev/sdf1 來​​​​​​​作​​​​​​​為​​​​​​​ LVM 實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​。​​​​​​​
pvcreate /dev/sdd1 /dev/sde1 /dev/sdf1
若​​​​​​​要​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​分​​​​​​​割​​​​​​​區​​​​​​​,而​​​​​​​不​​​​​​​是​​​​​​​整​​​​​​​個​​​​​​​磁​​​​​​​碟​​​​​​​:請​​​​​​​在​​​​​​​分​​​​​​​割​​​​​​​區​​​​​​​上​​​​​​​執​​​​​​​行​​​​​​​ pvcreate 指​​​​​​​令​​​​​​​。​​​​​​​下​​​​​​​列​​​​​​​範​​​​​​​例​​​​​​​會​​​​​​​將​​​​​​​ /dev/hdb1 分​​​​​​​割​​​​​​​區​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​為​​​​​​​一​​​​​​​個​​​​​​​ LVM 實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​,並​​​​​​​作​​​​​​​為​​​​​​​事​​​​​​​後​​​​​​​ LVM 邏​​​​​​​輯​​​​​​​卷​​​​​​​冊​​​​​​​的​​​​​​​一​​​​​​​部​​​​​​​分​​​​​​​來​​​​​​​使​​​​​​​用​​​​​​​。​​​​​​​
pvcreate /dev/hdb1

4.2.1.3. 掃​​​​​​​描​​​​​​​區​​​​​​​塊​​​​​​​裝​​​​​​​置​​​​​​​

您​​​​​​​可​​​​​​​透​​​​​​​過​​​​​​​ lvmdiskscan 指​​​​​​​令​​​​​​​來​​​​​​​掃​​​​​​​描​​​​​​​可​​​​​​​用​​​​​​​來​​​​​​​作​​​​​​​為​​​​​​​實​​​​​​​體​​​​​​​卷​​​​​​​冊​​​​​​​的​​​​​​​區​​​​​​​塊​​​​​​​裝​​​​​​​置​​​​​​​,如​​​​​​​下​​​​​​​列​​​​​​​範​​​​​​​例​​​​​​​所​​​​​​​示​​​​​​​。​​​​​​​
# lvmdiskscan
/dev/ram0                    [       16.00 MB]
  /dev/sda                     [       17.15 GB]
  /dev/root                    [       13.69 GB]
  /dev/ram                     [       16.00 MB]
  /dev/sda1                    [       17.14 GB] LVM physical volume
  /dev/VolGroup00/LogVol01     [      512.00 MB]
  /dev/ram2                    [       16.00 MB]
  /dev/new_vg/lvol0            [       52.00 MB]
  /dev/ram3                    [       16.00 MB]
  /dev/pkl_new_vg/sparkie_lv   [        7.14 GB]
  /dev/ram4                    [       16.00 MB]
  /dev/ram5                    [       16.00 MB]
  /dev/ram6                    [       16.00 MB]
  /dev/ram7                    [       16.00 MB]
  /dev/ram8                    [       16.00 MB]
  /dev/ram9                    [       16.00 MB]
  /dev/ram10                   [       16.00 MB]
  /dev/ram11                   [       16.00 MB]
  /dev/ram12                   [       16.00 MB]
  /dev/ram13                   [       16.00 MB]
  /dev/ram14                   [       16.00 MB]
  /dev/ram15                   [       16.00 MB]
  /dev/sdb                     [       17.15 GB]
  /dev/sdb1                    [       17.14 GB] LVM physical volume
  /dev/sdc                     [       17.15 GB]
  /dev/sdc1                    [       17.14 GB] LVM physical volume
  /dev/sdd                     [       17.15 GB]
  /dev/sdd1                    [       17.14 GB] LVM physical volume
  7 disks
  17 partitions
  0 LVM physical volume whole disks
  4 LVM physical volumes