4. The LVM: Management and Administration
4.1. How to enlarge the size of a file system?
The problem is as follows. I organized my file systems as follows:
Code:
test_vg 10GB: movies mounted on / eng / 20GB myfav: music on / eng / Color 30GB: freesp 20GB of free space unused.
But I have more space in / eng / myfav. Well yes, missing 1024 MB. The solution of yesteryear would have been to safeguard the movies, destroy / recreate the partition, remake the file system and copy the files. In our case, two commands are sufficient. Mind you the pattern of layers:
Code:
Partition (s) of Volume Group disk |----> |----> Logicals Volumes
|----> Filesystem
We have two layers to change: Logical Volume and Filesystem.
First step: disassembly
Code:
[Root @ test root] # umount / eng / myfav
The system file is removed, we can work.
Second operation: Enlarged and the LV.
Code:
[Root @ test root] # lvextend-L 1024 M / dev / test_vg / movies
Third operation: put the file system to the size of the LV.
Code:
[Root @ test root] # resize2fs / dev / test_vg / movies
Fourth operation: assembly
Code:
[Root @ test root] # mount / dev / test_vg / movies / eng / myfav
The second and third operation may be launched only once for formats via ext2/ext3 e2fsadm.
Code:
[Root @ test root] # L-1024 e2fsadm M / dev / test_vg / movies
4.2. How to reduce the size of a file system?
You can also reduce the LV and the filesystem. But the operation has some significant risks. The process is the same. I give you the control to reduce the LV (the file system does not change):
Code:
[Root @ test root] # lvreduce-L-1024m / dev / test_vg / movies
You can also remove an LV. It must first unmount the file system. All data will be lost.
Code:
[Root @ test root] # lvremove / dev / test_vg / music
4.3. Special case of LV stripping
The stripping is to write on alternate PV, then another, the data blocks. These blocks(k) are defined to create the LV, a power of 2.
Example:
Code:
lvccreate-i2-I10-L100M-lv lv_test test_vg
For the option "-i", 2 corresponds to the number of stripes you want.
For the option "-I", 4 is the stripe size (4KB)
Bookmarks