What is lvm2




















As I start backing up more servers or the data changes more frequently I need more space. I want to tell Ubuntu to use the larger space but I can't use resize2fs to increase the partition size and fdisk doesn't let me change the partition size either.

Instead it only lets me delete the partition, create a new one at the larger size and then I have to Rsync the files across with the correct command line to also copy hardlinks. That's a lot of work, so I recently set it up using LVM and now I can take the new, larger EBS disk and easily increase the LVM volume on it, then a quick resize2fs to tell the EXT4 filesystem that it's got some new space and bam, problem solved without having to copy hundreds of gigabytes of data.

LVM is a saviour. Alternatively I could just mount another EBS volume extend the LVM to that and now it's spread over multiple disks but it's seen as only one partition, sweet! The main benefit from using LVM is if you have more than one harddrive. With LVM you can group the hardrives into one huge one. Also you can add more space to this group if you add more harddrives. With LVM you can simple work like you have only one single huge harddrive.

Despite that LVM supports a lot expert features. What kind of applications or content are you planning to host? If it is a personal server or something for a small organization, you probably can get by without using LVM. LVMs are useful if you need partitions etc across multiple disks. I doubt you would need it, given that you're asking here regarding it :. Without answering your question directly which the other posters already did , there is an easy answer about whether or not you need LVM: If you don't know some feature during installation in detail, leave it at its default setting.

The default configuration will be fine for most users including me and probably you. Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. What is LVM and what is it used for?

Ask Question. Asked 11 years, 2 months ago. Active 4 years, 10 months ago. Viewed k times. In terms of a web server installation, what benefits does it provide? Would you recommend using it? What is LVM? LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes.

LVM physical volumes can be placed on other block devices which might span two or more disks. Now you want to create a Logical Volume from some of the free space in foo : sudo lvcreate -n bar -L 5g foo This creates a Logical Volume named bar in Volume Group foo using 5 GB of space. I currently have a Logical Volume for a Lucid install, and one for a Maverick install, so that is what I named those volumes. You might also want to try the lvs and pvs commands, which list the Logical Volumes and Physical Volumes respectively, and their more detailed variants; lvdisplay and pvdisplay.

If you are doing this from the desktop livecd, once you have created your Logical Volumes from the terminal, you can run the installer, and use manual partitioning to select how to use each Logical Volume , and then install. The space is allocated from any free space anywhere in the bar Volume Group. If you have multiple Physical Volumes you can add the names of one or more of them to the end of the command to limit which ones should be used to satisfy the request.

After extending the Logical Volume you need to expand the filesystem to use the new space. If you only have one other Physical Volume , then that is where it will be moved to, or you can add the name of one or more specific Physical Volumes that should be used to satisfy the request, instead of any Physical Volume in the Volume Group with free space.

This process can be resumed safely if interrupted by a crash or power failure, and can be done while the Logical Volume s in question are in use. You can also add -b to perform the move in the background and return immediately, or -i s to have it print how much progress it has made every s seconds.

If you background the move, you can check its progress with the lvs command. Snapshots When you create a snapshot, you create a new Logical Volume to act as a clone of the original Logical Volume. The snapshot volume initially does not use any space, but as changes are made to the original volume, the changed blocks are copied to the snapshot volume before they are changed, in order to preserve them.

This means that the more changes you make to the origin, the more space the snapshot needs. If the snapshot volume uses all of the space allocated to it, then the snapshot is broken and can not be used any more, leaving you only with the modified origin. The lvs command will tell you how much space has been used in a snapshot Logical Volume. If it starts to get full, you might want to extend it with the lvextend command.

Since the snapshot volume only stores the ares of the disk that have changed since it was created, it can be much smaller than the original volume. While you have the snapshot, you can mount it if you wish and will see the original filesystem as it appeared when you made the snapshot. You can modify the snapshot without affecting the original, and the original without affecting the snapshot.

If you take a snapshot of your root Logical Volume , and then upgrade some packages, or to the next whole distribution release, and then decide it isn't working out, you can merge the snapshot back into the origin volume, effectively reverting to the state at the time you made the snapshot. If this is the root volume, then you will need to reboot for this to happen. At the next boot, the volume will be activated and the merge will begin in the background, so your system will boot up as if you had never made the changes since the snapshot was created, and the actual data movement will take place in the background while you work.



0コメント

  • 1000 / 1000