<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Conversion_from_Ext3</id>
	<title>Conversion from Ext3 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Conversion_from_Ext3"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Conversion_from_Ext3&amp;action=history"/>
	<updated>2026-04-19T21:56:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=Conversion_from_Ext3&amp;diff=27883&amp;oldid=prev</id>
		<title>Onnowpurbo: New page: == Btrfs Conversion from Ext3 or Ext4==  Btrfs has very few pieces of metadata that live in fixed locations, making it relatively easy to implement an in place conversion utility from othe...</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Conversion_from_Ext3&amp;diff=27883&amp;oldid=prev"/>
		<updated>2011-08-28T03:06:50Z</updated>

		<summary type="html">&lt;p&gt;New page: == Btrfs Conversion from Ext3 or Ext4==  Btrfs has very few pieces of metadata that live in fixed locations, making it relatively easy to implement an in place conversion utility from othe...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Btrfs Conversion from Ext3 or Ext4==&lt;br /&gt;
&lt;br /&gt;
Btrfs has very few pieces of metadata that live in fixed locations, making&lt;br /&gt;
it relatively easy to implement an in place conversion utility from other&lt;br /&gt;
filesystems.  Copy on write algorithms allow Btrfs to preserve an unmodified&lt;br /&gt;
copy of the original FS, and allow administrator to undo the conversion,&lt;br /&gt;
even after making changes in the resulting Btrfs filesystem.&lt;br /&gt;
&lt;br /&gt;
The conversion program [[Btrfs-convert|btrfs-convert]] uses libe2fs to read the Ext3/4 metadata, and&lt;br /&gt;
uses the free blocks in the Ext3 filesystem to hold the new Btrfs.  The basic&lt;br /&gt;
conversion algorithm works like this:&lt;br /&gt;
&lt;br /&gt;
* Duplicate the first 1MB of the device&lt;br /&gt;
* Duplicate directories and inodes, creating copies in Btrfs&lt;br /&gt;
* Take references on Ext3 file data blocks from the Btrfs files&lt;br /&gt;
&lt;br /&gt;
This does create copies of all the Ext3 metadata, but the Btrfs files&lt;br /&gt;
simply point to the same blocks used by the Ext3 files.  This shares the&lt;br /&gt;
bulk of the blocks in use between the two filesystems.  Because Btrfs&lt;br /&gt;
uses copy on write for all file modifications, the original Ext3 version&lt;br /&gt;
of the file data blocks is preserved.&lt;br /&gt;
&lt;br /&gt;
The first 1MB of the device is copied to an alternate location so that&lt;br /&gt;
Btrfs metadata may be written there.  Undoing the conversion simply involves&lt;br /&gt;
restoring these blocks.&lt;br /&gt;
&lt;br /&gt;
The result of the conversion looks something like this:&lt;br /&gt;
&lt;br /&gt;
[[Image:Converter-description.png]]&lt;br /&gt;
&lt;br /&gt;
The conversion program creates a snapshot in Btrfs that references all of&lt;br /&gt;
the blocks used by Ext3, allowing the administrator to control how long the&lt;br /&gt;
original Ext3 filesystem is preserved.  If the admin wishes to recover the&lt;br /&gt;
space used by Ext3, the snapshot can be deleted and the conversion will be&lt;br /&gt;
permanent.&lt;br /&gt;
&lt;br /&gt;
Until the snapshot is deleted, only blocks that were marked as free in Ext3&lt;br /&gt;
are used to hold new Btrfs modifications.  This means the conversion can be&lt;br /&gt;
undone at any time, restoring the original Ext3 FS.  The converter creates a&lt;br /&gt;
sparse file to hold all of the references to the original Ext3 filesystem, and&lt;br /&gt;
the offsets in this file correspond to offsets on the block device.  This&lt;br /&gt;
allows the admin to mount the image file via readonly loopback and see the&lt;br /&gt;
original Ext3 filesystem and the converted Btrfs filesystem at the same&lt;br /&gt;
time.&lt;br /&gt;
&lt;br /&gt;
Example Usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Always run fsck first&lt;br /&gt;
fsck.ext3 -f /dev/xxx&lt;br /&gt;
&lt;br /&gt;
# Convert from Ext3/4-&amp;gt;Btrfs&lt;br /&gt;
btrfs-convert /dev/xxx&lt;br /&gt;
&lt;br /&gt;
# Mount the resulting Btrfs filesystem&lt;br /&gt;
mount -t btrfs /dev/xxx /btrfs&lt;br /&gt;
&lt;br /&gt;
# Mount the ext3/4 snapshot&lt;br /&gt;
mount -t btrfs -o subvol=ext2_saved /dev/xxx /ext2_saved&lt;br /&gt;
&lt;br /&gt;
# Loopback mount the image file&lt;br /&gt;
mount -t ext3 -o loop,ro /ext2_saved/image /ext3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the example above, the files in /ext3 and in /btrfs will be identical.&lt;br /&gt;
Any modifications made in /btrfs will not show up in /ext3.  If you wish&lt;br /&gt;
to roll back the conversion:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Completely unmount the Btrfs filesystem&lt;br /&gt;
umount /ext3&lt;br /&gt;
umount /ext2_saved&lt;br /&gt;
umount /btrfs&lt;br /&gt;
&lt;br /&gt;
# roll back the conversion&lt;br /&gt;
btrfs-convert -r /dev/xxx&lt;br /&gt;
&lt;br /&gt;
# use the original filesystem&lt;br /&gt;
mount -t ext3 /dev/xxx /ext3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, if you wish to recover the space used by the original Ext3/4 FS and make&lt;br /&gt;
the conversion permanent, simply delete /ext2_saved/image.  Once the image is&lt;br /&gt;
deleted, the disk will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Image:Converter-post.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>