[plug] ext2 filesystem on a file?

Bernard Blackham bernard at blackham.com.au
Sat May 17 00:58:09 WST 2003


On Sat, May 17, 2003 at 12:45:43AM +0800, Luke Dudney wrote:
> I have a 30gb vfat filesystem some of which I'd like to reclaim for use 
> with linux. I need features of ext2 such as modes and links. I am sure I 
> can create a zero'ed file with dd, and then being able to make an ext2 
> filesystem within that file, and mount it as normal. Google's not 
> helping much, can someone remember the commands required?

Well assuming you don't want to use the umsdos filesystem, which was
designed for that reason more or less, it goes something along the
lines of:

1) dd if=/dev/zero of=/path/to/file bs=1M count=1024
   (maybe a modprobe loop needed)
2) losetup /dev/loop0 /path/to/file
3) mke2fs /dev/loop0
4) losetup -d /dev/loop0
5) mount -o loop -t ext2 /path/to/file /mnt
6) *cross fingers*

I'm not entirely certain about the differences in speed between
this method, and using umsdos. The alternative is to use fips and
make a native ext2/3 partition, which I'm nearly certain will be
faster :)

HTH,

Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au



More information about the plug mailing list