Solved How do I mount a newly added disk in Linux using LVM?

Solved issue
Status
Not open for further replies.
Joined
Apr 16, 2023
Messages
149
Reaction score
16
Credits
1,460
I've been provided 500GB of hard disk by an enterprise and now I want to mount it in / partition using LVM, step by step guide to do it? I don't want to risk losing data but can't afford a backup :D
Any guides that is correct. I'm scared to try blogs from internet. I want your help really!!. I need no-nonsense guide.
 


Ask the syadmin at your work to do it for you.
 
Or ask the sysadmin at work to help you.
 
It doesn't matter if I know it or not. It seems you are asking how to do something for your job which you are getting paid for. It's pretty sad that you are you getting paid for that job and that you can't figure out how to do it yourself and that you are then asking for help on a forum to help complete your work assignment, so it seems you aren't actually qualified for the job because being a sysadmin is about solving problems and finding solutions independently. Go ask one of your colleagues to help you with this or use Google to find one of the many guides to help you with your problem.
 
So you guys don't know it lol.
There are a couple of really valuable resources already mentioned in this thread. They are not "blogs" to be fearful of, but resources compiled by thoughtful and knowledgeable people. It may be that they are not helpful to you. In that case, if you let the forum know about that, I believe it would certainly respond as best it can.

I guess if the issue you have opened up had some information about what has been tried and thought about, then some relevant responses to the issue may have been more forthcoming. For example, when the new disk is attached to the system, how does the kernel see it? What's its device name? What configuration of the filesystem is the one that is required, or preferred? Some detailed output of the currently configured filesystem would be helpful so that the commands that may be needed can be more accurately targeted.

Personally, I think a more sound approach to using forums is outlined here:
 
It doesn't matter if I know it or not. It seems you are asking how to do something for your job which you are getting paid for. It's pretty sad that you are you getting paid for that job and that you can't figure out how to do it yourself and that you are then asking for help on a forum to help complete your work assignment, so it seems you aren't actually qualified for the job because being a sysadmin is about solving problems and finding solutions independently. Go ask one of your colleagues to help you with this or use Google to find one of the many guides to help you with your problem.
1) You're the most saltiest person I've ever seen because someone got a job.
2) That's how a young professional starts their career. Don't gatekeep in linux.org. Why're you salty someone else got a job? And no, it's not my job. It's the job of senior engineers, I just want to learn it so when time comes, I'm able to do it. Again, don't gatekeep. I don't need your gatekeepign reply in every other posts. I don't care getting banned from place where people like you exist. The world will be better off with 1 less person like you anyway.
3) Get a life.
 
That's how a young professional starts their career.

Perhaps it's changing now? Back in "my day", we didn't have Google, or O'Reilly books for Dummies.
We researched stuff. There wasn't even a such a thing as "computer science" in most colleges.
I called Universities, developers, military bases, looked up RFCs, broke stuff, fixed stuff... got our hands dirty.

chatGPT can answer almost all the questions you ask and it's free. ( we didn't have that either ).
The point is, you can research and lookup stuff as easy as we can. It's a hundred times easier these days.
 
Learning about LVM is in my plan. But I want to finish other stuffs first. There's nothing wrong in trying to know a little bit to just get started then continue learning in depth. RHCSA is in my hitlist.
 
Don't gatekeep in linux.org.

They're not really gatekeeping. They're deciding for themselves how much information they'll share. Others can share as much as they want, and their answers were helpful.

I can see why you'd be frustrated, but this is your job. You should be doing the research. That's a part of your job. So, I can understand why they'd respond like that.

I highlighted your question entirely, right-clicked on it, and searched. There are a number of reliable sites with directions. You can compare and contrast a few of them and have a degree of trust in the processes outlined. Do it on company time, so that you're getting paid to learn.
 
Learning about LVM is in my plan. But I want to finish other stuffs first. There's nothing wrong in trying to know a little bit to just get started then continue learning in depth. RHCSA is in my hitlist.
If this drive is going to stay on the computer just add it to the /etc/fstab file and issue the command mount -a, always works for me.
 
Or ask the sysadmin at work to help you.

Good advice, and the Gatekeeper has a name ... Maarten ... he has been with us coming up on 3 years, and provided invaluable service to thousands. If we had an MVP award he would rank in the Top 10.

Asking the people at work and saying you are looking to get a better understanding may be looked favourably upon by your employers.

@f33dm3bits also has credentials in Red Hat as long as your arm I have read his C-V), so the link he provided you in #5 could be invaluable.

You owe him a thank you, rather than immature comments such as

Again, don't gatekeep. I don't need your gatekeepign reply in every other posts. I don't care getting banned from place where people like you exist. The world will be better off with 1 less person like you anyway.
3) Get a life.

If you don't like being in the friendliest and most knowledgeable Linux forum on the planet, you have the inalienable right to try your luck elsewhere.

Think about it.

Chris Turner
wizardfromoz
 
1) You're the most saltiest person I've ever seen because someone got a job.
I have a job too so I'm not jealous of your job, I'm actually happy for you that you have a job.
2) That's how a young professional starts their career. Don't gatekeep in linux.org. Why're you salty someone else got a job? And no, it's not my job. It's the job of senior engineers, I just want to learn it so when time comes, I'm able to do it. Again, don't gatekeep. I don't need your gatekeepign reply in every other posts. I don't care getting banned from place where people like you exist. The world will be better off with 1 less person like you anyway.
No it's not when I started out as a junior sysadmin and ran into a problem I would either figure it out myself by using what I already knew and then using Google to find an answer to the part I don't know. If I still wasn't able to figure it out then I would ask a colleague to give me an idea of what to do next. Senior sysadmins are supposed to guide the junior sysadmin so the junior can learn from working on the job and ask the senior for guidance when running into something. So if the senior engineer asked you to do it, ask them to give you a basic idea of what to do and then try working it out until you get stuck and then repeat the process. Being a sysadmin means you are able to find solutions to problems to things you already know and to things you don't know, better start learning that sooner than later.

You are asking for a step by step guide of how to do something, you don't learning anything by blindly following step by step guides. Why would you be scared to use one of the many step by step guides already available and not be scared if someone here wrote you a step by step guide. You could at least have shared what you had already tried and what problems you ran into, that way it would have shown that you had already tried something yourself.

Many of your posts I have seen where it seems you just want an answer and not want to do any of the research or hard work yourself.

I'll give you some real advice though, here's what I would have done in your situation. I would have setup virtual machine to simulate what you are trying to do with that 500G disk.
1. Install a vm with centos7 and give it a unique hostname
2. Install a second vm, also with a unique hostname.
3. Shut off the second vm and attach the hard disk of the second vm to the first vm.
4. You now have a lab setup and can try figuring out how to do it without being a afraid to lose data.

From your first post it seems the disk that got sent to you already has an existing installation on it because you want it mounted at /. There's a chance that if you remove the first disk and connect the second disk that the system will just boot and if not you will have to figure out the grub part by being chrooted into that installation from the rescue cd.

It might be useful to just first attach that second disk to a system, Linux will then pickup on the lvm setup and then you can just check what logical volumes are on the lvm setup on that disk. After that just shutoff the system, remove the first the and boot into rescue mode and chroot into the installation of the second disk and check how grub is configured to which volume name or id it's supposed to boot from. I hope you get the idea now?

You could have also typed your question into ChatGPT and it would have written out a step by step guide for you.
Take hard disk with a RHEL installation from one system and put it into a new system and have the system boot from the new hard disk that has an existing RHEL installation. Can you write out steps of how to do that?


Moving a hard disk with a RHEL (Red Hat Enterprise Linux) installation from one system to another can be done, but it requires careful steps to ensure a smooth transition and to avoid hardware compatibility issues. Here are the steps to move a RHEL installation to a new system:

Note: Before proceeding, please make sure you have a backup of your important data, and be aware that this process may not work in all cases, especially if the hardware differences between the two systems are significant.
  1. Backup Your Data: It's crucial to back up all your data on the old system, as there is a risk of data loss during this process.
  2. Shut Down the Old System: Properly shut down the old system and disconnect the power source.
  3. Install the Hard Disk in the New System:
    • Open the new system's case or access the drive bay.
    • Carefully connect the hard disk containing the RHEL installation to the new system. Ensure it's securely attached to both data and power cables.
  4. Power On the New System: Turn on the new system with the old hard disk installed.
  5. Access BIOS/UEFI Settings: During boot-up, you may need to access the BIOS/UEFI settings of the new system. The specific key to press to enter BIOS/UEFI varies (common keys include F2, F10, F12, Del, or Esc). Consult your system's manual or boot screen for guidance.
  6. Check Boot Order: In BIOS/UEFI settings, check the boot order to ensure that the hard disk with the RHEL installation is set as the first boot device.
  7. Save and Exit BIOS/UEFI: Save your changes in the BIOS/UEFI settings and exit. The system should attempt to boot from the RHEL hard disk.
  8. Hardware Detection: When RHEL boots on the new hardware, it will attempt to detect and load the necessary drivers for the new hardware components. This process may take some time.
  9. Update Drivers (if necessary): After booting into RHEL, you may need to update or install additional drivers to ensure compatibility with the new hardware. You can use the yum or dnf package manager to do this.
  10. Update Configuration (if necessary): Depending on the hardware differences between the old and new systems, you might need to update configuration files, such as those related to network settings, to match the new hardware.
  11. Test and Verify: After completing the steps above, thoroughly test the new system to ensure that all hardware components are functioning correctly and that your data is intact.
  12. Backup and Further Configurations: Create a backup of your RHEL installation on the new system, and make any additional configurations or adjustments needed for the new hardware.
Please be aware that moving a RHEL installation to new hardware can be complex, and success may depend on the specific hardware involved. It's essential to have backups and be prepared for the possibility of troubleshooting issues that may arise during the transition. Additionally, ensure that you have valid licenses for RHEL, as licensing may be tied to specific hardware configurations.
As ChatGPT shows, all you may have to do is connect the second disk to the system and select it as primary boot device. It also tells you that you may run into something and have to do some troubleshooting, that would then be done by booting off the cd into rescue mode and chrooting into the system and then fixing grub or something like that. Try that in you test vm setup first, that way you will have done and you will actually now ahead of time what to do with the enterprise disk with the already existing installation on it.
3) Get a life.
I'm on vacation and still taking the time to answer your posts. So I am having a life.

Good luck!
 
Last edited:
@Brief-Wishbone9091 :-

Believe it or not, folks here ARE trying to help you.......even if you can't see it that way.

Obviously, you must have SOME interest in computing to go into the type of job you have. But the responses here ARE correct; in your position, you're the one who's supposed to be providing support & solutions to others. It kind of goes without saying that figuring out the answers to problems & issues is "your bag".

Admitting you don't know it all isn't a crime. Colleagues will look more favourably upon you IF you can demonstrate that you have at least some idea of how to troubleshoot things.......and like all others, it's a skill that only comes with practice, because there's a learning-curve to everything in this life.

~~~~~~~~~~~~~~~~~
I've never wanted to do this kinda stuff for a job; although I've been messing around with these things, on and off, for the best part of 45 years, to me it's only ever been a hobby. But the same principles apply at the end of the day.

I'm one of those individuals that's always been used to being "self-sufficient". I would far sooner try things out for myself & figure out solutions to my own problems. I only ever ask for help as a last resort because, as others have pointed out, the research resources available to anyone nowadays are astronomical in scale compared to what was around, say, 40 years ago.

Your work is no different to anyone learning Linux for the first time. To use @KGIII 's oft-quoted aphorism, t's called "learning by breaking". Ok, so you try something for the first time, and it goes pear-shaped. Do you give up at the first hurdle? Of course you don't; you set things up again, and try something else. Experimentation, and trying things out for yourself - and most importantly, learning from your mistakes - is the key factor here.

~~~~~~~~~~~~~~~~~~~​

Ultimately, remember this. While there are always technically "nicer" ways of achieving many outcomes in Linux, there IS no hard-and-fast, right or wrong way of attaining your goal. There are literally 100s of ways of doing the same thing, and of getting the desired outcome; only experience will tell you, after a time, what works best & most effectively for any given scenario.

I agree whole-heartedly with others; blindly following step-by-step instructions is not the way to learn, because you never get to properly understand the mechanisms behind what you're doing. Having faith in your own abilities, and the confidence to experiment without worrying about the outcome, will stand you in good stead in the years to come.


Mike. ;)
 
Last edited:
I've been provided 500GB of hard disk by an enterprise and now I want to mount it in / partition using LVM, step by step guide to do it? I don't want to risk losing data but can't afford a backup :D
Any guides that is correct. I'm scared to try blogs from internet. I want your help really!!. I need no-nonsense guide.
The issue with questions like these, is that most tech people, wont respond to you in the way that you want them to, or might not even respond at all.

You might be asking, why would someone ignore your post or respond to you in a certain way? Well, in tech, there is this hidden rule, where when people ask for help, they should also include what they've attempted themselves before coming on and asking for help. This will save yourself and the people who are trying to help you, a lot of time, and you will most likely get better engagement.

Next time you ask a question, please try to provide al the necessary steps you took to try and figure things out, no one wants to walk you through basics steps when you can just look it up, especially if you say you are an IT professional.
 
Even senior egrs are having 0 idea on how to extend LVM, and here I've people belittling a 3 month newbie lol. :D internett moment.
 
I guess you're right, we're all all a bunch of dummies. Maybe by insulting us, we will be encouraged to help you?
In any case....

From chatGPT
To add another disk to an existing Logical Volume Management (LVM) setup in Linux, you can follow these steps. I'll assume you have already added the physical disk to your system, and you want to extend an existing volume group with this new disk:

  1. Identify the New Disk: Use the fdisk, lsblk, or lsscsi command to identify the new disk that you've added to your system. It might be something like /dev/sdb. Make sure the new disk is not in use and doesn't have any important data on it, as these steps will wipe the disk.
  2. Create a Physical Volume (PV): Initialize the new disk as an LVM physical volume using the pvcreate command. Replace /dev/sdb with the actual device name of your new disk:

    sudo pvcreate /dev/sdb
  3. Extend the Volume Group (VG): You need to extend the existing volume group by adding the new physical volume to it. Replace vg_name with the name of your existing volume group, and /dev/sdb with the actual device name of the new disk:

    sudo vgextend vg_name /dev/sdb
  4. Extend the Logical Volume (LV): Now that you've extended the volume group, you can extend the logical volume itself. Replace lv_name with the name of your existing logical volume, and specify the desired size (e.g., +10G to add 10 gigabytes):

    sudo lvextend -l +100%FREE /dev/vg_name/lv_name
    Alternatively, you can specify a specific size instead of using all available space:

    sudo lvextend -L +10G /dev/vg_name/lv_name
  5. Resize the Filesystem:Finally, you need to resize the filesystem to make use of the newly allocated space. The command you'll use depends on the filesystem type. Here are some examples:
    • For ext2/ext3/ext4 filesystems (common on many Linux distributions):

      sudo resize2fs /dev/vg_name/lv_name
    • For XFS filesystems:
      arduinoCopy code
      sudo xfs_growfs /mount/point
    • Replace /mount/point with the actual mount point of the filesystem.
That's it! Your existing LVM should now be extended to include the new disk, and your filesystem should be able to use the additional space. Remember to take proper backups before making any significant changes to your storage configuration, as there is always a risk of data loss when working with disks and partitions.

... this is likely the last help you'll be getting from me.
 
Last edited:
I am telling MY SENIOR ENGINEERS IN MY COMPANY. I don't need your help though. You can keep your valuable linux knowledge to yourself dear.
 
Status
Not open for further replies.

Members online


Latest posts

Top