Cómo extender particiones en Linux: Guía paso a paso para aumentar el espacio de tus VMs VMware
- How to Extend Linux Partitions in Zenoss VMware Appliances
- 1. Shutdown the VM
- 2. Edit VM Settings
- 3. Choose the Hard Disk
- 4. Adjust Provisioned Size
- 5. Click Okay
- 6. Power on the VM
- 7. Connect to the Command Line
- 8. Log in as Root
- 9. List Disk Partitions
- 10. Note the Disk Size
- 11. Modify the Disk Partition
- 12. Print the Partition Table
- 13. Add a New Partition
- 14. Make it a Primary Partition
- 15. Set the First Cylinder
- 16. Set the Last Cylinder
- 17. Save the Changes
- 18. Restart the VM
- 19. Log back in as Root
- 20. List Disk Partitions (Again)
- 21. Initialize the New Partition
- 22. Add the Physical Volume to the Volume Group
- 23. Check Free Space
- 24. Extend the Logical Volume
- 25. Expand the File System
- 26. Verify the Additional Space
How to Extend Linux Partitions in Zenoss VMware Appliances
I had a couple of Zenoss VMware appliances that run Linux and needed to allocate more space to them. Adding another hard drive wouldn't solve the issue, so I set out to find the least intrusive way to extend the partitions without breaking the whole VM appliance. If you've ever used Zenoss, you know that reconfiguring all the settings again is something you'd want to avoid.
Although there is some information available on this topic, most of it is hard to understand and doesn't provide clear step-by-step instructions. If you're not familiar with working with Linux, changing these settings can be quite challenging. So, here are the steps I followed to extend my Linux partitions. Please note that this process only applies to ext3 disks that use the logical volume manager and is compatible with Linux distros such as RedHat, CentOS, and others.
1. Shutdown the VM
2. Edit VM Settings
Right-click the VM and select "Edit Settings".
3. Choose the Hard Disk
Select the hard disk that you want to extend.
4. Adjust Provisioned Size
On the right side, increase the provisioned size to the desired amount.
5. Click Okay
Save the changes by clicking "Okay".
Cómo utilizar Isearch para buscar archivos de texto en Linux6. Power on the VM
Turn on the VM to apply the changes.
7. Connect to the Command Line
Connect to the Linux VM's command line via the console or a putty session.
8. Log in as Root
Enter the root login credentials.
9. List Disk Partitions
Use the fdisk command with the -l switch to list information about disk partitions. Type "fdisk -l" in the command prompt.
10. Note the Disk Size
Make a note of the disk size displayed in response to the previous command (e.g., "Disk /dev/sda: xxGB").
11. Modify the Disk Partition
Type "fdisk /dev/sda" in the command prompt, replacing "dev/sda" with the disk identifier from the previous step.
Guía para entender y gestionar los permisos de archivos y directorios en Linux12. Print the Partition Table
Type "p" and press Enter to print the partition table.
13. Add a New Partition
Type "n" to add a new partition.
14. Make it a Primary Partition
Type "p" again to make the new partition a primary partition.
15. Set the First Cylinder
Choose the first cylinder for the new partition. This is typically the end of the last partition. For example, if "/dev/sda3" ends at 2610, you can set "2611" as the first cylinder for the new partition.
16. Set the Last Cylinder
If you want the new partition to take up the remaining available space, choose the default value for the last cylinder.
17. Save the Changes
Type "w" to save the changes you've made.
Cómo configurar un servidor Linux como puerta de enlace para una red local18. Restart the VM
Restart the VM to apply the partition changes.
19. Log back in as Root
After the restart, log in as root again.
20. List Disk Partitions (Again)
Use the "fdisk -l" command to list disk partitions once more. You should see an additional partition present.
21. Initialize the New Partition
Initialize the new partition as a physical volume so that it can be manipulated using the Logical Volume Manager (LVM).
22. Add the Physical Volume to the Volume Group
Use the "vgextend" command to add the physical volume to the existing volume group. First, type "df -h" to find the name of the volume group. Then, type "vgextend [volume group] /dev/sdaX" (e.g., "vgextend vg_root /dev/sda4").
23. Check Free Space
Find out the amount of free space available on the physical volume by typing "vgdisplay [volume group] | grep 'Free'".
Windows al alcance de Linux: Accede a recursos con smbmount y smbclient24. Extend the Logical Volume
Extend the logical volume by the amount of free space shown in the previous step. Type "lvextend -L+[freespace]G /dev/volgroup/volume" (e.g., "lvextend -L+20G /dev/vg_root/lv_root").
25. Expand the File System
Finally, expand the ext3 file system in the logical volume using the command "resize2fs /dev/volgroup/volume" (e.g., "resize2fs /dev/vg_root/lv_root").
26. Verify the Additional Space
Run the "df -h" command to verify that you now have more space available.
Although this may seem like a lengthy process, it is actually quick and easy if you can afford to restart your server. So far, I haven't encountered any issues with dynamically extending the partitions, and the number of Zenoss notifications regarding free space has significantly reduced.
Cómo configurar y utilizar logrotate para la gestión de archivos de registro en LinuxEn Newsmatic nos especializamos en tecnología de vanguardia, contamos con los artículos mas novedosos sobre Código abierto, allí encontraras muchos artículos similares a Cómo extender particiones en Linux: Guía paso a paso para aumentar el espacio de tus VMs VMware , tenemos lo ultimo en tecnología 2023.
Artículos Relacionados