LVM - Anleitung für Anfänger - Seite 3

vgscan


server1:~# vgscan
Reading all physical volumes. This may take a while...

Wir erstellen unsere Volume Group fileserver erneut:

vgcreate fileserver /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1


server1:~# vgcreate fileserver /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Volume group "fileserver" successfully created

Als Nächstes erstellen wir unsere Logical Volumes share (40GB), backup (5GB) und media (1GB) in der Volume Group fileserver. Zusammen benötigen sie etwas weniger als 50% des verfügbaren Speicherplates (so können wir später RAID1 verwenden):

lvcreate --name share --size 40G fileserver


server1:~# lvcreate --name share --size 40G fileserver
Logical volume "share" created

lvcreate --name backup --size 5G fileserver


server1:~# lvcreate --name backup --size 5G fileserver
Logical volume "backup" created

lvcreate --name media --size 1G fileserver


server1:~# lvcreate --name media --size 1G fileserver
Logical volume "media" created

Wir verschaffen uns nun einen Überblick über unsere Logical Volumes:

lvdisplay


server1:~# lvdisplay
--- Logical volume ---
LV Name /dev/fileserver/share
VG Name fileserver
LV UUID 280Mup-H9aa-sn0S-AXH3-04cP-V6p9-lfoGgJ
LV Write Access read/write
LV Status available
# open 0
LV Size 40.00 GB
Current LE 10240
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/fileserver/backup
VG Name fileserver
LV UUID zZeuKg-Dazh-aZMC-Aa99-KUSt-J6ET-KRe0cD
LV Write Access read/write
LV Status available
# open 0
LV Size 5.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

--- Logical volume ---
LV Name /dev/fileserver/media
VG Name fileserver
LV UUID usfvrv-BC92-3pFH-2NW0-2N3e-6ERQ-4Sj7YS
LV Write Access read/write
LV Status available
# open 0
LV Size 1.00 GB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:2

lvscan


server1:~# lvscan
ACTIVE '/dev/fileserver/share' [40.00 GB] inherit
ACTIVE '/dev/fileserver/backup' [5.00 GB] inherit
ACTIVE '/dev/fileserver/media' [1.00 GB] inherit

Aus Übungszwecken bennen wir unser Logical Volume media in films um:

lvrename fileserver media films


server1:~# lvrename fileserver media films
Renamed "media" to "films" in volume group "fileserver"

lvdisplay


server1:~# lvdisplay
--- Logical volume ---
LV Name /dev/fileserver/share
VG Name fileserver
LV UUID 280Mup-H9aa-sn0S-AXH3-04cP-V6p9-lfoGgJ
LV Write Access read/write
LV Status available
# open 0
LV Size 40.00 GB
Current LE 10240
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/fileserver/backup
VG Name fileserver
LV UUID zZeuKg-Dazh-aZMC-Aa99-KUSt-J6ET-KRe0cD
LV Write Access read/write
LV Status available
# open 0
LV Size 5.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

--- Logical volume ---
LV Name /dev/fileserver/films
VG Name fileserver
LV UUID usfvrv-BC92-3pFH-2NW0-2N3e-6ERQ-4Sj7YS
LV Write Access read/write
LV Status available
# open 0
LV Size 1.00 GB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:2

lvscan


server1:~# lvscan
ACTIVE '/dev/fileserver/share' [40.00 GB] inherit
ACTIVE '/dev/fileserver/backup' [5.00 GB] inherit
ACTIVE '/dev/fileserver/films' [1.00 GB] inherit

Lass uns als Nächstes das Logical Volume films löschen:

lvremove /dev/fileserver/films


server1:~# lvremove /dev/fileserver/films
Do you really want to remove active logical volume "films"? [y/n]: <-- y
Logical volume "films" successfully removed

Wir erstellen das Logical Volume media erneut:

lvcreate --name media --size 1G fileserver


server1:~# lvcreate --name media --size 1G fileserver
Logical volume "media" created

Lass uns nun media von 1GB auf 1.5GB vergrößern:

lvextend -L1.5G /dev/fileserver/media


server1:~# lvextend -L1.5G /dev/fileserver/media
Extending logical volume media to 1.50 GB
Logical volume media successfully resized

Lass es uns wieder auf 1GB verkleinern:

lvreduce -L1G /dev/fileserver/media


server1:~# lvreduce -L1G /dev/fileserver/media
WARNING: Reducing active logical volume to 1.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce media? [y/n]: <-- y
Reducing logical volume media to 1.00 GB
Logical volume media successfully resized

Bis jetzt haben wir drei Logical Volumes, aber noch keine Dateisysteme und ohne Dateisysteme können wir nichts in ihnen speichern. Daher erstellen wir ein ext3 Dateisystem in share, ein xfs Dateisystem in backup und ein reiserfs Dateisystem in media:

mkfs.ext3 /dev/fileserver/share


server1:~# mkfs.ext3 /dev/fileserver/share
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5242880 inodes, 10485760 blocks
524288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
320 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,
4096000, 7962624

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

Dieses Dateisystem wird aller 23 Mounts oder 180 Tagen automatisch überprüft, je nach dem, was zuerst eintritt. Verwende tune2fs -c oder -i um dies zu ändern.

mkfs.xfs /dev/fileserver/backup


server1:~# mkfs.xfs /dev/fileserver/backup
meta-data=/dev/fileserver/backup isize=256 agcount=8, agsize=163840 blks
= sectsz=512 attr=0
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=1
naming =version 2 bsize=4096
log =internal log bsize=4096 blocks=2560, version=1
= sectsz=512 sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0

mkfs.reiserfs /dev/fileserver/media


server1:~# mkfs.reiserfs /dev/fileserver/media
mkfs.reiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:
Alexander Lyamin keeps our hardware running, and was very generous to our
project in many little ways.

Chris Mason wrote the journaling code for V3, which was enormously more useful
to users than just waiting until we could create a wandering log filesystem as
Hans would have unwisely done without him.
Jeff Mahoney optimized the bitmap scanning code for V3, and performed the big
endian cleanups.

Guessing about desired format.. Kernel 2.6.17-2-486 is running.
Format 3.6 with standard journal
Count of blocks on the device: 262144
Number of blocks consumed by mkreiserfs formatting process: 8219
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 2bebf750-6e05-47b2-99b6-916fa7ea5398
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
ALL DATA WILL BE LOST ON '/dev/fileserver/media'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/fileserver/media.

1 Kommentar(e)

Zum Posten von Kommentaren bitte

Kommentare

Von: T-Roc

Also, ganz dickes Lob. Das HOWTO is echt ma geil. Vielen Dank.