Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2015-01-02
4
Medium Priority
?
228 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 36

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:Chris H
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 36

Accepted Solution

by:
Seth Simmons earned 1500 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 62

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

876 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