Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a rhel 6.10 system, and I have a useless /dev/sdc disk, that I would like to add to /dev/sdb.
This system in virtual, running on vmware. There are 2 separate disks in the server config. I'd like to merge sdc into sdb.
I'm not sure the terminology that I should be using, so the answer is likely here, but I can't find it.
How would I go about doing this? Would it be best to delete sdc in vmware, then just add space to sdb?
Thanks! Let me know if you need more info, but I think I conveyed the basic gist, hopefully!
Most RHEL systems use LVM, so you would make /dev/sdc a PV, then add it to the volume group, then extend the logical volume onto the new space. See this thread:
Presumably you're already using /dev/sdb1 as your root (/) filesystem mount and any files/subdirectories are part of that.
To expand that you'd have to do what you suggested, delete the underlying /dev/sdc then add its space to /dev/sdb then tell the OS to use see the resized sdb then expand sdb1 to use the new space sdb had.
Rather than go through all that you might consider using /dev/sdc (either with partitions or LVM) for separate filesystems then copy files from out of your existing subdirectories into those file systems. Me, I'd use LVM because of its flexibility.
That would add all of sdc to a new volume group named, vg01, then layout a new logical volume named, lvtmp, of 1024 extents on it using the new volume group.
You could then layout a filesystem on the new LV device, /dev/mapper/vg01-lvtmp, with mkfs. You could then mount that new device temporarily as /mnt, copy everything from /tmp into /mnt, mv /tmp to /tmp.old, mkdir /tmp to create empty mount point, unmount /mnt then mount /dev/mapper/vg01-lvtmp as /tmp. You would then remove tmp.old. You could do similar with other filesystems instead or in addition to /tmp. (e.g. /var, /home, /opt, /database). You would only have to create the VG before creating the first LV. Other LVs would be on the same VG.
Note that I used /tmp as an example. Often you can't remove it (or /tmp.old if you renamed it as noted above) because some process may be holding it or a file within it "open". However, on reboot it would know to use the new /tmp.
Ideally you would have used LVM on installation and put both disks into a single VG. The beauty of VGs is you can add/remove disks (PVs) and/or add/remove LVs without respect to other things that are already there. With partitioning you often end up having to resize earlier partitions to free up room for later ones. Since you are already apparently using a partition on sdb you'd have to blow that away to add it to the VG but there is no reason you can't have just a single disk like sdc in your VG.
Well, I think in this case, the admin for the software running on this server wants to keep it as physical volumes. Lucky me. So, how would I go about deleting the /dev/sdc, and then adding that space to /dev/sdb? I've done plently of VGs, but this is the first disk that is "physical", as much as a virtual server can be physical!
Ok, I figured it out. The drive in question was raw. I removed the mount point from fstab and rebooted.
I had previously increased the space of the drive and after the reboot, I deleted and recreated the partition and resized it.
Added the mount point back into fstab and another reboot, and things are good.
I was running into the issue of a umount -l deleting data.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.