<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Moving an existing BackupPC partition to LVM</title>
	<atom:link href="http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/</link>
	<description>When the going gets tough, the tough sniff packets.</description>
	<lastBuildDate>Fri, 03 Feb 2012 05:29:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: tyler</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/comment-page-1/#comment-193</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Mon, 10 May 2010 08:02:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.tolaris.com/?p=796#comment-193</guid>
		<description>I&#039;d love to see some steps for doing this, with commands. I&#039;m sure I&#039;ll face this problem again.</description>
		<content:encoded><![CDATA[<p>I&#8217;d love to see some steps for doing this, with commands. I&#8217;m sure I&#8217;ll face this problem again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/comment-page-1/#comment-192</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Mon, 10 May 2010 06:57:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.tolaris.com/?p=796#comment-192</guid>
		<description>IMHO, LVM is just that, a couple of extra blocks at the beginning of the partition. So I would have thought it should be simple enough to:
1) reduce the fs by a couple of blocks (say 4M or whatever)
2) move the entire fs to the &#039;end&#039; of the partition (move the second last block to the last block and so on until the first block is free)
3) create the LVM headers/etc at the beginning of the partition

All done... even if the filesystem was originially 99% full, and only one complete copy of the data. I&#039;ve certainly managed to successfully complete the reverse of the above (recovering a filesystem from a corrupted LVM, where there was only a single filesystem on a single PV, etc... using mount -o loop .... and telling losetup to skip the first few blocks... don&#039;t see why it couldn&#039;t work in reverse.

PS, if your data is important, don&#039;t do it, it isn&#039;t worth it :)</description>
		<content:encoded><![CDATA[<p>IMHO, LVM is just that, a couple of extra blocks at the beginning of the partition. So I would have thought it should be simple enough to:<br />
1) reduce the fs by a couple of blocks (say 4M or whatever)<br />
2) move the entire fs to the &#8216;end&#8217; of the partition (move the second last block to the last block and so on until the first block is free)<br />
3) create the LVM headers/etc at the beginning of the partition</p>
<p>All done&#8230; even if the filesystem was originially 99% full, and only one complete copy of the data. I&#8217;ve certainly managed to successfully complete the reverse of the above (recovering a filesystem from a corrupted LVM, where there was only a single filesystem on a single PV, etc&#8230; using mount -o loop &#8230;. and telling losetup to skip the first few blocks&#8230; don&#8217;t see why it couldn&#8217;t work in reverse.</p>
<p>PS, if your data is important, don&#8217;t do it, it isn&#8217;t worth it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/comment-page-1/#comment-189</link>
		<dc:creator>Philip</dc:creator>
		<pubDate>Sat, 08 May 2010 13:05:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.tolaris.com/?p=796#comment-189</guid>
		<description>It did work, though it was sheer dumb luck that none of the many, many dd invocations went horribly wrong.

But, seriously: why is this so difficult? My impression is ext[234]fs is pretty good at not using certain areas of the disk (historically, for badblocks). In theory, it should be as easy as this:
0. unmount as file system
1. create an extent-sized file of zeroes, and make sure it is extent-aligned: thus, you&#039;ll have a free extent to shift things to.
2. copy the first file system extent into the zeroed extent
3. mark the duplicate extent as bad, preventing the file system from using it. delete the zeroes file.
4. overwrite the first file system extent with LVM header data, remapping the first extent to the new copy, the other extents 1:1, and the bad extent to an error/zeroes entry
5. mount as LVM

That would take 10 seconds, it would reduce your file system size by one extent (though you could always resize2fs and use the last extent to avoid the 4M marked as bad artifact), and it would actually be safer than anything that involves rewriting everything twice (obviously, any file system-modifying code should be considered extremely dangerous for the first few hundred times you run it). Also note that it splits nicely into stuff that only involves the file system and a pure LVM operation that turns a partition into an LVM pv containing the partition.

I&#039;m afraid my point is that I&#039;m a grumpy old man, and it&#039;s 2010 and we still have exciting new features added in a way that makes migration unbelievably difficult. A file system that you want to turn into, essentially, a bunch of files on a new file system you create around it isn&#039;t the exception, it&#039;s the rule for any exciting migration.

Want your file system encrypted? Essentially, you&#039;ve got to go through the same thing again, because some more metadata wants to be stored at the beginning of the image.

Want your LVM layout encrypted? Your best bet is LVM over crypto over LVM, so that&#039;s the same procedure again (and another extent lost, but that&#039;s hardly an issue).

Sorry for ranting. It&#039;s good to have readable instructions for the common, using-less-than-49% case, and thanks for going to the trouble of writing those.</description>
		<content:encoded><![CDATA[<p>It did work, though it was sheer dumb luck that none of the many, many dd invocations went horribly wrong.</p>
<p>But, seriously: why is this so difficult? My impression is ext[234]fs is pretty good at not using certain areas of the disk (historically, for badblocks). In theory, it should be as easy as this:<br />
0. unmount as file system<br />
1. create an extent-sized file of zeroes, and make sure it is extent-aligned: thus, you&#8217;ll have a free extent to shift things to.<br />
2. copy the first file system extent into the zeroed extent<br />
3. mark the duplicate extent as bad, preventing the file system from using it. delete the zeroes file.<br />
4. overwrite the first file system extent with LVM header data, remapping the first extent to the new copy, the other extents 1:1, and the bad extent to an error/zeroes entry<br />
5. mount as LVM</p>
<p>That would take 10 seconds, it would reduce your file system size by one extent (though you could always resize2fs and use the last extent to avoid the 4M marked as bad artifact), and it would actually be safer than anything that involves rewriting everything twice (obviously, any file system-modifying code should be considered extremely dangerous for the first few hundred times you run it). Also note that it splits nicely into stuff that only involves the file system and a pure LVM operation that turns a partition into an LVM pv containing the partition.</p>
<p>I&#8217;m afraid my point is that I&#8217;m a grumpy old man, and it&#8217;s 2010 and we still have exciting new features added in a way that makes migration unbelievably difficult. A file system that you want to turn into, essentially, a bunch of files on a new file system you create around it isn&#8217;t the exception, it&#8217;s the rule for any exciting migration.</p>
<p>Want your file system encrypted? Essentially, you&#8217;ve got to go through the same thing again, because some more metadata wants to be stored at the beginning of the image.</p>
<p>Want your LVM layout encrypted? Your best bet is LVM over crypto over LVM, so that&#8217;s the same procedure again (and another extent lost, but that&#8217;s hardly an issue).</p>
<p>Sorry for ranting. It&#8217;s good to have readable instructions for the common, using-less-than-49% case, and thanks for going to the trouble of writing those.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tyler</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/comment-page-1/#comment-188</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Sat, 08 May 2010 11:09:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.tolaris.com/?p=796#comment-188</guid>
		<description>That is insane.  It would work, though.  :)</description>
		<content:encoded><![CDATA[<p>That is insane.  It would work, though.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip</title>
		<link>http://www.tolaris.com/2010/05/06/moving-an-existing-backuppc-partition-to-lvm/comment-page-1/#comment-187</link>
		<dc:creator>Philip</dc:creator>
		<pubDate>Fri, 07 May 2010 18:39:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.tolaris.com/?p=796#comment-187</guid>
		<description>I&#039;m going to confess to a horrible thing I did.

I converted to LVM. In place. Without first reducing disk usage to 49%. It was a bit of a Zen exercise, and the data wasn&#039;t at all valuable, obviously, because no one should expect that sort of thing to work.

Tools:
1. a script to reverse a block device in 4M chunks (included with linux kernel documentation, needs adjustment)
2. dd
3. cp --sparse=always
4. losetup

I&#039;m sure you can figure out the process (free last extent of disk. set up reversed lvm device at end of disk. copy the last extent of the file system into the reversed lvm device, then grow the reversed lvm device at its logical end, and its physical beginning. repeat. set up a normal lvm device at the start of the disk, migrating extents there from the reversed lvm device, which will shrink to zero and leave you, ideally, with something you could have done in ten minutes with a backup disk.

The cp --sparse=always comes in if you have to use intermediate file systems because a file system was unshrinkable - you can still effectively shrink it by separating it out into chunks stored in sparse files in another file system and keeping it as zeroed-out as possible.

Forgive me father, for I have sinned.</description>
		<content:encoded><![CDATA[<p>I&#8217;m going to confess to a horrible thing I did.</p>
<p>I converted to LVM. In place. Without first reducing disk usage to 49%. It was a bit of a Zen exercise, and the data wasn&#8217;t at all valuable, obviously, because no one should expect that sort of thing to work.</p>
<p>Tools:<br />
1. a script to reverse a block device in 4M chunks (included with linux kernel documentation, needs adjustment)<br />
2. dd<br />
3. cp &#8211;sparse=always<br />
4. losetup</p>
<p>I&#8217;m sure you can figure out the process (free last extent of disk. set up reversed lvm device at end of disk. copy the last extent of the file system into the reversed lvm device, then grow the reversed lvm device at its logical end, and its physical beginning. repeat. set up a normal lvm device at the start of the disk, migrating extents there from the reversed lvm device, which will shrink to zero and leave you, ideally, with something you could have done in ten minutes with a backup disk.</p>
<p>The cp &#8211;sparse=always comes in if you have to use intermediate file systems because a file system was unshrinkable &#8211; you can still effectively shrink it by separating it out into chunks stored in sparse files in another file system and keeping it as zeroed-out as possible.</p>
<p>Forgive me father, for I have sinned.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

