![]() The vgscan command can be used to list all the volume groups. A volume group can also span multiple hard disks: vgcreate home4 /dev/sda /dev/sdb will create a volume group spanning two hard disks. For example, vgcreate home3 /dev/sda3 /dev/sda5 will create a volume group comprising the sda3 and the sda5 physical volumes. You can also use multiple physical volumes to make up a volume group. The command vgcreate home2 /dev/sda3 will create a volume group called home2 that comprises /dev/sda3. You need to provide a unique name to your volume group. We will now create a volume group that uses this physical volume. Then open a terminal window and run this command as root, or with sudo: First you’ll need to reboot to ensure the new partition is used. Before we create a volume group, we need to initialize our physical volumes. Remember what I said about physical volumes and volume groups? A volume group comprises one or more physical volumes. The new partition table will be used after you restart the computer. Type w and then press Enter to save the partition table. Of course, the actual information will differ for you. Press p to print the partition table:ĭisk /dev/sda: 16.1 GB, 16106127360 bytesĢ55 heads, 63 sectors/track, 1958 cylinders You can check the partition table to ensure the change in the system id. After you hit Enter, fdisk will confirm the partition type (Linux LVM). Use t to tell fdisk you want to change the system ID, then select the partition number you want and enter type 8e as the partition type. That is, we need to change the partition’s system id value to 8e, instead of the default 83 assigned to new partitions: The next step is to change the partition type to LVM. Then, enter p to create a primary partition, and then give it a partition number, and you’ll probably want to accept the default values for the first and last cylinder. You’ll want to enter n as the command to create a new partition. Note that the number of cylinders will vary. There is nothing wrong with that, but this is larger than 1024,Īnd could in certain setups cause problems with:ġ) software that runs at boot time (e.g., old versions of LILO)Ģ) booting and partitioning software from other OSs The number of cylinders for this disk is set to 1958. You’ll see a message like this, with a prompt for a command: You could also use GParted, if you are more comfortable with a graphical tool. ![]() To start partitioning, run fdisk on the target disk - in this case, /dev/sda. If you already have a spare partition, you can simply change its system ID to LVM using fdisk (or another partitioning tool) and then move on to creating the volume group. I also have some unused space available on my disk, which will be used to create a partition. My root partition (/) is sda1, and sda2 is swap. In this article, I will focus on how you can create a LVM layout and then mount it under your home directory, so as to use it in future. Also, some distributions such as Fedora and SUSE offer graphical tools to manage your LVM layout. Several distributions, like Fedora and Debian, allow you to use LVM when partitioning during the installation itself. LVM was added to the Linux kernel in the 2.4.x branch, so almost all Linux distributions support it. Debian and Fedora users can use apt-get and yum respectively to install lvm2. You need to install the lvm2 package before you can start with LVM. A logical volume is thus a virtual partition on your virtual hard disk. You can think of the volume group as a virtual hard disk. Each volume group must be divided into Logical Volumes (LV).Ī logical volume functions like a normal partition - they have a filesystem such as Ext3, and a mount point. A Volume Group (VG) comprises one or more physical volumes. LVM refers to a typical partition as a Physical Volume (PV). Understanding LVMīefore jumping into the details of setting up LVM, you need to familiarize yourself with LVM terminology. However, using the Logical Volume Manager (LVM) tools, you can grow, shrink, and manage disk space with very little hassle. Running out of disk space often meant reinstalling Linux or spending a few hours with tools like Parted to resize partitions. Managing disk space used to be a royal pain for admins and users.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |