Solved

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

Posted on 2015-01-02
4
182 Views
Last Modified: 2015-02-20
/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?
0
Comment
Question by:Rambl
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40527973
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)
0
 
LVL 16

Expert Comment

by:choward16980
ID: 40527975
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
0
 
LVL 34

Accepted Solution

by:
Seth Simmons earned 500 total points
ID: 40527981
oops, just noticed the title again with vmware
in that case, you can extend the disk then continue as i mentioned earlier with unmounting and resizing with resize2fs (though it can be done while mounted)

here is the RHEL 6 documentation:

Resizing an Ext4 File System
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ext4grow.html
0
 
LVL 61

Expert Comment

by:gheist
ID: 40528162
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.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now