On Feb 11, 2009 12:18 -0800, Xiang Wang wrote: > Since we are thinking of switching into using the ext4 file systems on > some of our machines with purely ext2 partitions, we face the problem > of how to migrate all those existing files on ext2 partitions. Seems > like there are two major directions to go: > > 1) do a backup, umount, mke2fs into ext4, and restore > In this approach, we may actually take advantage of the layout changes > so as to benefit from some features of ext4. > > 2) umount, tune2fs to add the 'extent' feature, mount back using type > ext4, Note that you can really stop at this point - new files will be created with extents, old ones will be left alone. > migrate the existing files(directories) one by one through the > ioctl EXT4_IOC_MIGRATE Note that you don't really need to do this. If the filesystem is offline to users you can just do "cp file file.tmp; mv file.tmp file" and it will do the same thing, with exception of getting a new inode number and requiring that files are not being modified at the time. > Motivated by the ext4 ioctl interface for migration, we are also > looking into this in-place approach. But we are mostly concerned with > the fact that if the existing files are highly fragmented, will we > still get benefit from the extents? Or will we even get hurt by > turning the files into being extents-based? The mballoc allocator is pretty good in conjunction with delalloc, so I expect you would get mostly defragmented files as you migrate. This would depend on having some decent amount of free space in the filesystem so that it is likely that there is enough contiguous free space for some number of the >= average size files. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html