Find the answer to your Linux question:
Results 1 to 7 of 7
Hi On a Debian squeeze HP Proliant with Smartarray four disk RAID 1+0 135GB my client's /var volume was in the mid ninety percent full so I proposed that we ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2013
    Posts
    4

    LVM lvreduce & lvextend


    Hi

    On a Debian squeeze HP Proliant with Smartarray four disk RAID 1+0 135GB
    my client's /var volume was in the mid ninety percent full so I proposed that we reduce /home

    I executed the following commands :

    umount /home
    lvreduce -L-20G /dev/LVM/home
    lvextend -L+20G /dev/LVM/var
    mount /home

    the mount didn't go well and I realised that I had omitted a command, so I ran:

    resize2fs /dev/LVM/home

    Which requested that I run :

    e2fsck -f /dev/LVM/home

    which produced the following error:

    Error reading block 2655233 (Invalid argument). Ignore error<y>?

    I ran through the various repair steps that this utility handles and yet the /home volume still won't mount - I get the same result if I run e2fsck again

    I don't mind losing the /home volume, but I'd hate (ok worse than hate) to lose the /var
    volume

    Is there any way to undo these commands or at least to cancel the lvextend on /var ?

    I haven't rebooted the server yet.

    thanks for your help
    yann

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    910
    Oh man, you've botched it big time. You have to shrink the file system BEFORE you shrink the partition!
    As long as you haven't messed with /var, everything should be fine in that file system.

  3. #3
    Just Joined!
    Join Date
    Oct 2013
    Posts
    4
    Quote Originally Posted by mizzle View Post
    Oh man, you've botched it big time. You have to shrink the file system BEFORE you shrink the partition!
    As long as you haven't messed with /var, everything should be fine in that file system.
    Thanks Mizzle, I actually feel a little more hopeful having read your response.

    In fact /var is still running fine. I'm a little afraid of what to expect when I next have to reboot the server

    I haven't done anything else than what was specified in my post

    My ultimate fear is losing /var which hasn't been backed up yet, for unpardonable reasons.

    I guess I could plug a USB drive to run an ad'hoc backup
    Any suggestions on this issue ?

    Can I simply run:

    lvextend -L-20G /dev/LVM/var

    to put things back the way they were for /var ?

    I don't care about /home since this is a mail server only and the user's mailboxes are on var

    yann

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    910
    You should not make any more file system operations if you do not have good backups of your important data. That is rule number 1, especially if you're dealing with a client's data and you could potentially be on the hook for damages.

    /var should be fine after reboot.

    Yeah, USB drive would be a good place to start. Extending a lv is easy, it's the shrinking business that you absolutely need to run resize2fs BEFORE messing with.

    Rebooting may fail due to /home being unmountable. You can simple comment out the /home line in /etc/fstab and Linux will use the empty /home directory upon next boot.
    Anyway, backup your files.
    Then, unmount /var and run e2fsck -f for the lv /var is on. Then run resize2fs on the lv /var is on. Then you should be just fine.

    I would NEVER shrink a file system before backing up files if you care about those files. Just too risky as a single typo can destroy your date. Do not reshrink /var.

  6. #5
    Just Joined!
    Join Date
    Oct 2013
    Posts
    4
    Quote Originally Posted by mizzle View Post
    You should not make any more file system operations if you do not have good backups of your important data. That is rule number 1, especially if you're dealing with a client's data and you could potentially be on the hook for damages.

    /var should be fine after reboot.

    Yeah, USB drive would be a good place to start. Extending a lv is easy, it's the shrinking business that you absolutely need to run resize2fs BEFORE messing with.

    Rebooting may fail due to /home being unmountable. You can simple comment out the /home line in /etc/fstab and Linux will use the empty /home directory upon next boot.
    Anyway, backup your files.
    Then, unmount /var and run e2fsck -f for the lv /var is on. Then run resize2fs on the lv /var is on. Then you should be just fine.

    I would NEVER shrink a file system before backing up files if you care about those files. Just too risky as a single typo can destroy your date. Do not reshrink /var.
    cheers Mizzle, I think I'll rest easier tonight, after the tension that has been mounting all afternoon...no pun intended

  7. #6
    Just Joined!
    Join Date
    Oct 2013
    Posts
    4
    Ok, a final question and then I'm clear on the issue:

    Let's just say that I don't care at all about /home and its contents

    All I really want is to end up with a healthy functional /var

    Would I be able to dismount /var and run [resize2fs /dev/LVM/]
    in order for the added 20Go to be taken into account ?
    Or is this categorically the wrong way to go ?

    thanks
    yann

  8. #7
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    910
    yeah, all that's correct. Just run resize2fs with no arguments and it will fill up the space.

Posting Permissions

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