Showing posts with label yum. Show all posts
Showing posts with label yum. Show all posts

Friday 24 August 2018

Does RHEL 7 support online resize of disk partitions?

Environment

  • Red Hat Enterprise Linux 7

Issue

  • Both Xen and KVM support online resize of the virtual block devices that the virtual machines use.
  • Unfortunately, since the partitions in the boot virtual block device are already in use, those can't be modified online and the virtual machine won't pick up the changes on the boot virtual block device without a reboot.
  • We are looking for ability to dynamically increase a partitioned volume, is it possible to resize the disk partitions online in RHEL 7?
  • We are unable to dynamically increase a SAN attached volume without taking the volume offline. When will this feature to Support online resize of disk partitions be available?

Resolution

The ability to resize a Logical Volume and filesystem has long been provided by Logical Volume Manager (LVM) by simply using the entire block device (/dev/sdx for example) as a Physical Volume in the LVM Volume Group. There is no need for the old style of partition. This would allow the Logical Volume and filesystem to easily be expanded.
As to older style partitions, this feature has been added in RHEL 7 current release with a feature request (RFE has been filed to add support for online resize of disk partitions to RHEL 7 in private Red Hat Bugzilla 853105). With this feature, it's possible to resize the disk partitions online in RHEL 7.

Warning: Online partition table resizing is not a recommended process mostly because the underlying layer of an active logical volume or filesystem that relies on that information is being modified. While it is possible to perform online partition resize operation, it is not recommended simply from a data integrity standpoint and not because it's not possible.

  • In order to resize online a partition which is in use please observe the following steps:
# fdisk -l /dev/vda

Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000db7e6

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    28289023    13631488   8e  Linux LVM

# cat /proc/partitions 
major minor  #blocks  name

 252        0   31457280 vda
 252        1     512000 vda1
 252        2   13631488 vda2
  11        0    1048575 sr0
 253        0   10240000 dm-0
 253        1    2129920 dm-1

# pvs
  PV         VG          Fmt  Attr PSize  PFree
  /dev/vda2  rhel_vm-205 lvm2 a--  13.00g 1.20g
  • Modify the on-disk partition table as usual (e.g. by using fdisk command).
    • Delete the partition:
      Command (m for help): d
      Partition number (1,2, default 2): 2
      Partition 2 is deleted
      
    • Re-create the partition with the new size:
      Command (m for help): n
      Partition type:
         p   primary (1 primary, 0 extended, 3 free)
         e   extended
      Select (default p): p
      Partition number (2-4, default 2): 2
      First sector (1026048-62914559, default 1026048): 
      Using default value 1026048
      Last sector, +sectors or +size{K,M,G} (1026048-62914559, default 62914559): +18G
      Partition 2 of type Linux and of size 18 GiB is set
      
      Command (m for help): t
      Partition number (1,2, default 2): 2
      Hex code (type L to list all codes): 8e
      Changed type of partition 'Linux' to 'Linux LVM'
      
      Command (m for help): p
      
      Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk label type: dos
      Disk identifier: 0x000db7e6
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/vda1   *        2048     1026047      512000   83  Linux
      /dev/vda2         1026048    38774783    18874368   8e  Linux LVM
      
    • Commit changes to on-disk partition table:
      Command (m for help): w
      The partition table has been altered!
      
      Calling ioctl() to re-read partition table.
      
      WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
      The kernel still uses the old table. The new table will be used at
      the next reboot or after you run partprobe(8) or kpartx(8)
      Syncing disks.
      
    • While on-disk partition table has been updated, observe that on-memory kernel partition table has not:
      # partprobe 
      Error: Partition(s) 2 on /dev/vda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
      
      # cat /proc/partitions | grep vd
       252        0   31457280 vda
       252        1     512000 vda1
       252        2   13631488 vda2
      
  • Execute partx (provided by util-linux package) with --update option on the block device to update the in-memory kernel partition table from the on-disk partition table:
    # partx -u /dev/vda
    
  • Verify that in-memory kernel partition table has been updated with the new size:
    # cat /proc/partitions | grep vd
     252        0   31457280 vda
     252        1     512000 vda1
     252        2   18874368 vda2
    
  • Proceed with any further steps, in this example by extending the PV on the partition:
    # pvresize /dev/vda2
      Physical volume "/dev/vda2" changed
      1 physical volume(s) resized / 0 physical volume(s) not resized
    
    # pvs
      PV         VG          Fmt  Attr PSize  PFree
      /dev/vda2  rhel_vm-205 lvm2 a--  18.00g 6.20g
    

Root Cause

  • Changes to allow online resizing of in-use partitions are required in both kernel and userland.
    • RHEL7 kernels include the required changes to BLKPG ioctl from block: add partition resize function to blkpg ioctl to support BLKPG_RESIZE_PARTITION operation.
    • RHEL7 util-linux package includes partx and resizepart binaries, currently the only userland commands that support BLKPG_RESIZE_PARTITION operation of BLKPG ioctl.

Friday 12 July 2013

How to get Fedore 17 to upgrade to Fedore 18 Using Yum !!


Hi Guys !!!

I am using Fedora 17 for quite a while on VMware I decide to give it a go because my older brother advice me to do so.. Since here, most of time I've using  CentOS, RedHat, Debian Kali and uBuntu mainly... 



But I decided to give it a go on Fedora 17, after some months into it I realize that a new release was launched, therefore I decide to upgrade my machine ... And here is the workout ...

Here are some WORDS of RECOMMENDATION BEFORE YOU DO THIS ...

Upgrading using the yum method described here is not recommended for new users. Use FedUp instead 
 
For upgrades to Fedora 18 and later, the recommended upgrade method is the FedUp tool. This section has instructions on using FedUp to upgrade. 


For upgrades to Fedora 17 and earlier, the recommended installation method is with a boot media with the Anaconda installer as detailed in the Installation Guide or via PreUpgrade. PreUpgrade is a slightly different upgrade method where all the packages are downloaded before the system is rebooted into the Anaconda installer. 

Although upgrades with yum do work, they are not explicitly tested as part of the release process by the Fedora QA and are not documented in the Fedora installation guide. If you are not prepared to resolve issues on your own if things break, you should probably use the recommended installation methods instead
 Extracted from: https://fedoraproject.org/wiki/Upgrading_Fedora_using_yum

2 Upgrading To Fedora 18 (Desktop & Server)

First we must upgrade the rpm package:

# sudo yum clean-all

yum upgrade yum
yum install fedup
yum -y upgrade
fedup-cli --network 18 --debuglog fedup-to-18.log


Than when the install finished .. run on terminal the command " # reboot "
Let the machine boot up and then look into the Grub menu and choose the option that says "fedora fedup upgrade"


Press "Enter" and let the system upgrade start ! When it finish's the system will reboot again and then if all goes well you will boot up on the Fedora 18 ...

For more help  here are some links : http://fedoraproject.org/wiki/FedUp , http://tech.saos.co.in/post/2013/02/16/upgrade-fedora-17-to-18-using-yum.aspx

To download Fedora : go here http://fedoraproject.org/get-fedora

Hope this article help you guys somehow .. If you guys got any query please drop me some questions  I will very happy to answer them ..

:-) Enjoy

This is another posting showing "how to do computing" for everyday computer usages... For a general public 

Secure Your Azure DevOps Pipeline: GitHub Advanced Security to the Rescue

  Stop Shipping Your Passwords to Production: How GitHub Advanced Security for Azure DevOps Saves the Day (and Your Reputation) Let's fa...