Find the answer to your Linux question:
Results 1 to 5 of 5
I have the following problem. I want to reduce the size of my hard disk on which the Logical Volumes exist. I do the following steps Boot from my Red ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4

    Question Shrinking the disk partition with Logical Volumes on it problem

    I have the following problem. I want to reduce the size of my hard disk on which the Logical Volumes exist.
    I do the following steps
    Boot from my Red Hat disk, and choose Linux Rescue mode.
    then i do following
    (on Logical volumes there is not yet any filesystem, they are empty)
    1. Shrink the Logical Volume by the command:
    lvm lvresize -LNewSize Generalgroup/LogVolVar
    2. Shrink the Physical volume:
    lvm pvresize --setphysicalvolumesize newSize /dev/hda2
    3. Shrink the partition with fdisk:
    delete the partition:
    Command :d
    Partition number (1-4) 2
    --------------------------
    create new partition
    Command:n
    Command action
    e extend
    p primary partition (1-4)
    p
    Partition number (1-4)2
    First cylinder (229-17753 ,default 229) 229
    Last cylinder (229-17753, default 17753) NewSize
    --------------------------------------
    change type of partition from Linux to LVM partition
    command :t
    partition number (1-4):2
    Hex code (type L to list codes):8e
    Changed system type of partition 2 to 8e (Linux LVM)
    ----------------------------------------
    and last save the changes by rewriting the partition table
    Command: w
    The partition table has been altered!

    Calling ioctl() to re-read partition table
    Syncing disks.

    Then i run reboot

    and then make the volumes available:
    lvm vgchange -ay
    device-mapper: reload ioctl failed: Invalid argument
    4 logical volume(s) in volume group "GeneralGroup" now active
    after that i see no LogVolVar Logical volume in the group

    and if run
    dmsetup table
    i see that table LogVolVar is empty
    We can see the Volome in the group only if run
    lvm vgscan --mknodes.
    However that is not fix the problem.

    Have any any ideas how to fix the problem, what was incorrect in my operations, write please.

  2. #2
    Just Joined!
    Join Date
    Jul 2008
    Location
    Kenya
    Posts
    26
    Hi Vofka,
    To rectify your partition table use testdisk. It is a very good software. In fact a download bootable systemrescuecd. It contains test disk and gparted. You can always use gparted to shrink your partition safely.

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4
    Thank! I'll try to rectify partition table with testdisk and to use gparted instead of fdisk. Is a fdisk have some problems working with partitions, on which Logical Volumes exists? And gparted works correct with them?

  4. #4
    Just Joined!
    Join Date
    Jul 2008
    Location
    Kenya
    Posts
    26
    Gparted doesnt work on Logical Volumes but works excellent on others. I always use the rescue disk to shrink my Logical volumes This thread will help. Click here.

    You use the systemrescuecd to do all this work at once.

  5. #5
    Just Joined!
    Join Date
    Jun 2009
    Posts
    4
    Thanks! I resolved the problem. The problem was that i want create partition with fdisk with the size: 7170MB, but it is true if it were calculate using normal as 1024 representation. But fdisk uses multiple of 1073 representation of . So when i try to create 7170 Mb partition it was only 6682.2 partition, that is why the device-mapper raised the partition table error. So when i set real partition as 7513= ((7170/1.024)*1.073). The problem was resolved the partition table was not corrupted! Also we must rounded to the full size of extend. We must calculate this value to extents, rounded to the integer number, and then calculate again to Mb, to have the exact number.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...