Linux Administration Bootcamp
Installing and Connecting to a Linux System
Intermediate Linux Skills
Linux Boot Process and System Logging
Disk Management in Linux
LVM - The Logical Volume Manager
User Management in Linux
Networking With Linux
Shell Scripting with Linux
Command Line Kung Fu
In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows.
Earlier I mentioned how easy it is to move data from one storage device to another with LVM. Let's say that the storage device attached to our system at forward slash dev forward slash STE is a faster and has more space. Let's say we want to move the data that currently resides on dev SDB to that new desk. To do that we'll just add dev STE to the volume group and then migrate the data over. So of course we run PV create to initialize our desk dev STE. And then now we add that to our volume group with the VG extend command and give it the path here.
So now, if we run the PVS command we have three physical volumes and this one volume group. Finally, to perform the data migration we just use the PV move command to move all that data from dev SDB to dev STE. And that's exactly how you use the command. You just give it the source, physical volume and then the destination physical volume. So here it's starting to do its work. It'll be 0%, 1% and so on. This is going to take a while. So I'll just edit the waiting out for you.
Once the PV move command is complete, all the data that used to live on dev SDB now lives on dev STE. And the whole time this was happening, any logical volumes and file systems that were on dev SDB remained online and available throughout this entire process. There's no need to take an outage for this migration of data. Okay, the PV move command completed. Then it shows that the data was moved at a hundred percent. And so now let's look at the PVs with our PVs command.
So here we can see on the very first line dev SDB that we have the entire disc free. So it's P size 50 and P free is 50 gigabytes. So it looks like that our data has been moved off that volume. But let's take a closer look with PV display. Here we can see that the allocated PE is zero. There are no physical extents in use. Now that we're done with this disc, we can remove it from the volume group with VG reduce. And finally we can PV remove it.
Notice that our physical volumes are of different sizes. You don't have to use the exact same underlying devices with the same sizes and the same volume group. For example, you can mix and match your storage as you want, or as you need. Okay. Before we wrap things up, let's review what you've learned.