Search code examples
linuximagefilesystemsmountmount-point

Create a mountable image with the newfs file system


I want to create a mountable image with the newfs file system which can be mounted with newfs file system. How can I do that?

I have tried to create an image with the command

dd if=localfiles.tar.gz of=/root/upload/test.img

but I could not creat a newfs file system. How can I do that?


Solution

  • Something along the lines:

    $ dd if=/dev/zero bs=8M count=<depends on the size of the fs you need> of=/root/upload/test.img
    $ mkfs.newfs /root/upload/test.img
    # mount -o loop /root/upload/test.img /mnt
    $ cd /mnt
    $ tar xzf /path/to/localfiles.tar.gz
    $ cd
    # umount /mnt