Generate an EXT2 image without being root

Hi all,

I'd like to be able to generate an ext2 filesystem image for a ramdisk. I can do that at the moment by mounting an ext2 image on a loopback device, but that requires me to be root. Are there any ways of generating an image without using this mechanism ?

Reply to
Geronimo W. Christ Esq
Loading thread data ...

I'm not aware of any other method, however you can do this without being root (man mount, man fstab). If you apply the following to a loop back device, you should be able to get mount to mount an ext2 file system as a mortal user.

see manual pages for ... losetup, fstab, and mount

(iii) Normally, only the superuser can mount file systems. However, when fstab contains the user option on a line, then anybody can mount the corresponding system.

CB

Reply to
Craig Bergren

But if the file-system needs to contain special files (device nodes, e.g., /dev/ttyS0 et all), you'll still need to be root unless I'm missing something. Of course, not all EXT2 file systems need nodes owned by someone other than yourself but if it's a bootable filesystem, I don't think you have much choice. Root is it.

Reply to
Ed Skinner

Look at the following links:

formatting link
formatting link

I have not tried these, but appear to be the type of program with the characteristics you want.

Also, the ext2 utility program debugfs has all the tools needed to populate a ramdisk, using the commands mkdir, mknod, and write. The filesystem needs to have been created first by using the traditional dd if=null of=filesys count=4k, and mke2fs filesys method.

--
John Haller
Reply to
John Haller

John, you're a genius. Those are exactly what I need, thanks.

Cheers to everyone else who replied.

I may take a look at this.

Reply to
Geronimo W. Christ Esq

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.