Creating very large mirrored lvols quickly

Q. I have to create some enormous (dozens of Gb) logical volumes with mirroring. The mirroring takes a very long time. Is there some way to speed up this process? A. Yes, it can be done with one command in just a second or two. When you create a logical volume, all the extents are undefined as to content. And if you mirror this new volume, it doesn’t make much sense to actually copy the undefined data to the mirror. So you combine the creation and mirroring into one command like this: lvcreate -L 64000 -m 1 vg02 [ optionally, specific PVs as mirrors ] The -L 64000 means 64,000 megs or 64 Gb. The -m 1 establishes a mirror relationship. The default for allocating mirror extents is to never use the same disk(s) where the lvol is created. The strict option -s y does the same thing and is the default. Once this command completes, you can run newfs (if you need a filesystem on this lvol). Now you might ask: Are the extents synced? Yes, they are all marked synced even though the individual extents and mirrors are not equal. It doesn’t matter what data is on either extent since they have never been written, but once a write is done (such as the newfs command), the newly written extents will be automatically mirrored as they now contain defined data. – See more at: http://serviceitdirect.com/blog/creating-very-large-mirrored-lvols-quickly#sthash.D3JqftOK.dpuf


Tags: