自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Debian Linux LVM配置手冊

運維 系統(tǒng)運維
LVM - Logical Volume Manager 是Linux系統(tǒng)下最強大的磁盤管理技術(shù)之一.它將您從不得不思考物理容量中解脫出來,代之以邏輯形式來思考這些容量.

LVM - Logical Volume Manager 是Linux系統(tǒng)下最強大的磁盤管理技術(shù)之一.它將您從不得不思考物理容量中解脫出來,代之以邏輯形式來思考這些容量. 當您需要考慮如何替用戶數(shù)據(jù)和系統(tǒng)文件分配空間的時候,LVM可以讓您徹底忘記傳統(tǒng)的分區(qū)做法.

簡單地來說,LVM就是將眾多物理設(shè)備組合成一個大的虛擬設(shè)備,用戶只需思考如何在虛擬設(shè)備上做傳統(tǒng)的空間分配策略,而將物理設(shè)備的管理交由LVM自己去處理.這個由物理設(shè)備組合所成的虛擬設(shè)備稱為卷組(Volume Group),簡稱為VG;而用戶在卷組VG上所劃分的磁盤空間則稱為邏輯卷(Logical Volume),簡稱為LV;而原始物理設(shè)備必須經(jīng)過初始化處理才能加入卷組集合,這種經(jīng)過特別處理的原始設(shè)備或磁盤空間則稱為物理卷(Physical Volume),簡稱為PV.

LVM磁盤空間管理系統(tǒng)允許您在需要的時候重新調(diào)整大小, 這也就意味著在管理磁盤空間資源方面, 您將獲得極大程度的自由. 基本上這是很有誘惑力的, 但您應(yīng)該留心硬盤出錯的情況,如果您沒有在LVM管理中為出現(xiàn)這種情況而做好計劃,那么您可能會丟失大量數(shù)據(jù).

LVM 術(shù)語:

PV - Physical Volume 物理卷,例如一個硬盤,或一個Software RAID設(shè)備;

VG - Volume Group 卷組,將一組物理卷收集為一個管理單元;

LV - Logical Volume 邏輯卷,等同于傳統(tǒng)分區(qū),可看作便準的塊設(shè)備,以容納文件系統(tǒng);

PE - Physical Extent 物理塊,劃分物理卷的數(shù)據(jù)塊;

LE - Logical Extent 邏輯塊,劃分邏輯卷的數(shù)據(jù)塊;

LVM 結(jié)構(gòu):

為了讓大家了解關(guān)于LVM的概念和結(jié)構(gòu).實現(xiàn)方式等.作者花了整整一天時間畫了一個圖.

突然發(fā)現(xiàn)自己的”設(shè)計”水準很前衛(wèi)很潮流. (誰說圖片不好看誰就不要看文章了! :-))

說明: /boot 這個掛載分區(qū)不能存在于VG卷組里.所以我們一般是建議單獨分區(qū).

使用LVM的基本步驟如下:

1. 安裝lvm2 (apt-get install lvm2)

2. 使用fdisk分區(qū)指定的物理硬盤

3. 使用lvm管理工具進行l(wèi)vm配置 (建立PV / VG / LV)

4. 格式化已經(jīng)設(shè)置好的LV邏輯卷.掛載到指定目錄.

5. 關(guān)于如何增加/刪除/修改LV邏輯卷大小.請期待第2季.

LVM 配置步驟:

// 查看物理磁盤狀態(tài) - 硬盤(容量1GB) /dev/sdb 已經(jīng)識別

Debian:/home/reistlin#fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0×0002db3a

Device Boot Start End Blocks Id System

/dev/sda1 1 1033 8297541 83 Linux

/dev/sda2 1034 1305 2184840 82 Linux swap / Solaris

Disk /dev/sdb: 1073 MB, 1073741824 bytes

128 heads, 32 sectors/track, 512 cylinders

Units = cylinders of 4096 * 512 = 2097152 bytes

Disk identifier: 0×00000000

Disk /dev/sdb doesn’t contain a valid partition table

// 使用 fdisk 對 /dev/sdb 分區(qū)

Debian:/home/reistlin#fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0×4e896764.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)

Command (m for help):new

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4):1

First cylinder (1-512, default1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-512, default512):

Using default value 512

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition’s system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help):w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

// 查看分區(qū)后的物理磁盤信息 - /dev/sdb1 狀態(tài)正常

Debian:/home/reistlin#fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0×0002db3a

Device Boot Start End Blocks Id System

/dev/sda1 1 1033 8297541 83 Linux

/dev/sda2 1034 1305 2184840 82 Linux swap / Solaris

Disk /dev/sdb: 1073 MB, 1073741824 bytes

128 heads, 32 sectors/track, 512 cylinders

Units = cylinders of 4096 * 512 = 2097152 bytes

Disk identifier: 0×4e896764

Device Boot Start End Blocks Id System

/dev/sdb1 1 512 1048560 83 Linux

#p#

// 進入 LVM 模式

Debian:/home/reistlin#lvm

// 查看 LVM 磁盤狀態(tài) - 目前沒有任何 LVM 磁盤信息

lvm>lvmdiskscan

/dev/ram0 [ 8.00 MB]

/dev/ram1 [ 8.00 MB]

/dev/root [ 7.91 GB]

/dev/ram2 [ 8.00 MB]

/dev/sda2 [ 2.08 GB]

/dev/ram3 [ 8.00 MB]

/dev/ram4 [ 8.00 MB]

/dev/ram5 [ 8.00 MB]

/dev/ram6 [ 8.00 MB]

/dev/ram7 [ 8.00 MB]

/dev/ram8 [ 8.00 MB]

/dev/ram9 [ 8.00 MB]

/dev/ram10 [ 8.00 MB]

/dev/ram11 [ 8.00 MB]

/dev/ram12 [ 8.00 MB]

/dev/ram13 [ 8.00 MB]

/dev/ram14 [ 8.00 MB]

/dev/ram15 [ 8.00 MB]

/dev/sdb [ 1.00 GB]

2 disks

17 partitions

0 LVM physical volume whole disks

0 LVM physical volumes

// 查看 LVM 配置文件 - dump 模式

lvm>dumpconfig

devices {

dir=”/dev”

scan=”/dev”

preferred_names=[]

filter=”a/.*/”

cache_dir=”/etc/lvm/cache”

cache_file_prefix=”"

write_cache_state=1

sysfs_scan=1

md_component_detection=1

ignore_suspended_devices=0

}

activation {

missing_stripe_filler=”/dev/ioerror”

reserved_stack=256

reserved_memory=8192

process_priority=-18

mirror_region_size=512

readahead=”auto”

mirror_log_fault_policy=”allocate”

mirror_device_fault_policy=”remove”

}

global {

umask=63

test=0

units=”h”

activation=1

proc=”/proc”

locking_type=1

fallback_to_clustered_locking=1

fallback_to_local_locking=1

locking_dir=”/var/lock/lvm”

}

shell {

history_size=100

}

backup {

backup=1

backup_dir=”/etc/lvm/backup”

archive=1

archive_dir=”/etc/lvm/archive”

retain_min=10

retain_days=30

}

log {

verbose=0

syslog=1

overwrite=0

level=0

indent=1

command_names=0

prefix=” ”

}

// 創(chuàng)建 Physical Volume (PV)

lvm> pvcreate

Please enter a physical volume path

lvm>pvcreate /dev/sdb1

Physical volume “/dev/sdb1″ successfully created

// 查看 Physical Volume (PV) 狀態(tài)

lvm>pvdisplay

CTRL-c detected: giving up waiting for lock

— Physical volume —

PV Name /dev/sdb1

VG Name vg_test

PV Size 1023.98 MB / not usable 3.98 MB

Allocatable yes (but full)

PE Size (KByte) 4096

Total PE 255

Free PE 0

Allocated PE 255

PV UUID SwfyW5-veGN-1Ptd-VIUo-0I3I-CdVB-QF7BwC

// 再次查看 LVM 磁盤狀態(tài)

lvm>lvmdiskscan

/dev/ram0 [ 8.00 MB]

/dev/ram1 [ 8.00 MB]

/dev/root [ 7.91 GB]

/dev/ram2 [ 8.00 MB]

/dev/sda2 [ 2.08 GB]

/dev/ram3 [ 8.00 MB]

/dev/ram4 [ 8.00 MB]

/dev/ram5 [ 8.00 MB]

/dev/ram6 [ 8.00 MB]

/dev/ram7 [ 8.00 MB]

/dev/ram8 [ 8.00 MB]

/dev/ram9 [ 8.00 MB]

/dev/ram10 [ 8.00 MB]

/dev/ram11 [ 8.00 MB]

/dev/ram12 [ 8.00 MB]

/dev/ram13 [ 8.00 MB]

/dev/ram14 [ 8.00 MB]

/dev/ram15 [ 8.00 MB]

/dev/sdb1 [ 1023.98 MB] LVM physical volume

1 disk

17 partitions

0 LVM physical volume whole disks

1 LVM physical volume

// 創(chuàng)建 Volume Group (VG)

lvm> vgcreate vg_test

Please enter physical volume name(s)

lvm>vgcreate vg_test /dev/sdb1

Volume group “vg_test” successfully created

// 查看 Volume Group (VG) 狀態(tài)

lvm>vgdisplay

— Volume group —

VG Name vg_test

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 1

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 0

Open LV 0

Max PV 0

Cur PV 1

Act PV 1

VG Size 1020.00 MB

PE Size 4.00 MB

Total PE 255

Alloc PE / Size 0 / 0

Free PE / Size 255 / 1020.00 MB

VG UUID Dbm7gQ-HDao-0z2Z-2u3q-XK9A-bmEv-ES3qC0

// 創(chuàng)建 Logical Volume (LV) - 如果需要使用全部VG空間. 輸入 -l 的值.

// 的值可以使用 vgdisplay 命令查看: Total PE = 255

lvm>lvcreate -l 255 vg_test -n lv_test

Logical volume “l(fā)v_test” created

// 查看 Logical Volume (LV) 狀態(tài)

lvm>lvdisplay

— Logical volume —

LV Name /dev/vg_test/lv_test

VG Name vg_test

LV UUID l3GUct-M3nG-m837-wOe2-4EWo-ZPU6-xskaq8

LV Write Access read/write

LV Status available

# open 0

LV Size 1020.00 MB

Current LE 255

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 254:0

// 輸入 exit 退出 LVM 配置模式. Ext3 格式化 lv_test 邏輯卷

Debian:/home/reistlin#mkfs -t ext3 -j /dev/vg_test/lv_test

mke2fs 1.41.3 (12-Oct-2008)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

65280 inodes, 261120 blocks

13056 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=268435456

8 block groups

32768 blocks per group, 32768 fragments per group

8160 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

Writing inode tables: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

// 掛載 lv_test 邏輯卷到 /mnt 目錄. 你也可以掛載到 /home 目錄

Debian:/home/reistlin#mount /dev/vg_test/lv_test /mnt

Debian:/home/reistlin# cd /mnt

// 測試文件讀寫. Reistlin.Com. OKay.

Debian:/mnt# vim Reistlin.Com

Debian:/mnt# cat Reistlin.Com

Welcome to Reistlin.Com

【編輯推薦】

  1. 實例解析:Linux系統(tǒng)下LVM擴充方法
  2. Linux下使用網(wǎng)站主機作為加密代理服務(wù)器
  3. linux下磁盤lvm掛在顯示容量問題
責(zé)任編輯:趙寧寧 來源: chinaitlab
相關(guān)推薦

2011-02-23 11:15:21

DebianProFTPd

2011-03-02 16:36:41

pureftpdLNMPDebian5

2020-10-09 11:15:14

LinuxLVM邏輯卷管理

2010-09-14 11:16:55

Debian Linu

2018-03-29 15:21:03

LinuxDebian網(wǎng)橋

2009-12-22 17:24:14

Linux配置Dual

2010-08-06 15:44:11

Linux服務(wù)器

2009-06-29 09:44:39

LinuxDebianGNU

2011-01-18 18:28:49

Thunderbird配置

2009-12-10 16:21:42

Fedora Linu

2009-09-07 09:36:34

2011-04-02 13:47:15

Debianmrtg配置

2014-06-20 10:51:35

Linux LVM邏輯卷

2013-10-22 16:03:00

LVM

2014-03-03 10:22:23

Linux Mint

2015-04-20 08:58:25

DHCPISC DHCP Se

2010-06-03 14:55:59

Hadoop配置

2011-03-21 16:30:42

CentOSLAMP

2011-08-10 14:51:46

LinuxLVM分區(qū)

2021-08-22 08:43:23

LVMLinux MintLinux
點贊
收藏

51CTO技術(shù)棧公眾號