Link to home
Start Free TrialLog in
Avatar of Rambl
Rambl

asked on

VMware - redhat 6, properly removing a mounted drive, and remounting

/extra is 40GB. I need /extra to be /700GB

This is on a server running as a virtual.

I'm going to umount /extra
remove the entry in fstab

/dev/extra/extra                    /extra                    ext4    defaults        0 0

Then I'm going to shutdown the VM. Delete the 40GB drive. Recreate the drive with the new size 700GB

Then I'll turn back on the VM, and recreate /extra

The question is, are there other caveats to look out for, before I recreate /extra. Is there other things I need to remove in other locations on the redhat OS, before recreating /extra again?
Avatar of Seth Simmons
Seth Simmons
Flag of United States of America image

i assume that you don't need the data on /extra since you are creating a new one

not sure what virtualization you are using but in most cases shouldn't need to shutdown the guest to add/remove the disk
unmount, comment out fstab entry, remove the drive at the hypervisor level then add a new one, check fdisk as to the device name, partition, mount, modify fstab (if the name is the same, just uncomment)

alternatively, you can expand the virtual disk instead of removing and creating a new one and should be able to do hot (without unmounting or changing fstab)
Have a read here:

http://serverfault.com/questions/509468/how-to-extend-an-ext4-partition-and-filesystem



You must begin with the partition unmounted. If you can't unmount it (e.g. it's your root partition or something else the system needs to run), use something like System Rescue CD instead.

Run parted, or gparted if you prefer a GUI, and resize the partition to use the extra space. I prefer gparted as it gives you a nice graphical representation, very similar to the one you've drawn in your question.

resize2fs /dev/whatever

e2fsck /dev/whatever (just to find out whether you are on the safe side)

Remount your partition.

While I've never seen this fail, do back up your data first!

-------------------------------
               
The resize2fs man page says: If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 and ext4.). However, resizing a mounted filesystem is a more dangerous operation, since the kernel could easily freeze or crash while running rarely exercised code, leaving your filesystem in a bad state. –  200_success May 21 '13 at 15:12

-------------------------------
               
True -- but you don't want to be messing around with your partition table with the filesystem mounted. That's why I started with the fs unmounted. –  Flup May 21 '13 at 15:15
               
-------------------------------

For ext4, might be resize4fs instead on RHEL 5. –  Zac Thompson Sep 4 '14 at 20:04
ASKER CERTIFIED SOLUTION
Avatar of Seth Simmons
Seth Simmons
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
First you need to add some physical partitions to to VG named "extra", then you can expand the volumes.
Extending existing disk is quite useless as you must unmount anything on that disk (and use mini installer DVD to partition where /root and /boot are) to add new space to a VG in form of LVM-type partitions.

Only thing that works on the flu is = add new disk, make LVM partition, add to VG, expand.
Rest involves unmounts.