Migrating Data from One Storage Device to Another

Start course
Overview
Difficulty
Intermediate
Duration
40m
Students
32
Ratings
5/5
starstarstarstarstar
Description

The Logical Volume Manager introduces extra layers of abstraction between the disks or storage devices presented to a Linux system and the file systems placed on them. This course explores the service and its components. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.

Learning Objectives

  • Understand what the LVM is and how it works
  • Create and remove physical volumes (PVs), volume groups (VGs), and logical volumes (LVs)
  • Extend volume groups and extend and mirror logical volumes
  • Migrate Data from one storage device to another

Intended Audience

  • Anyone with basic knowledge of Linux who wants to learn more
  • Professionals who want to learn more about Linux to enhance their career prospects

Prerequisites

This is an intermediate-level course so some knowledge of Linux is expected. If you're just starting out, then try our Linux Fundamentals course first.

Transcript

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.

About the Author
Avatar
Jason Cannon
Founder, Linux Training Academy
Students
1926
Courses
60
Learning Paths
7

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics