Create Filesystem on Sparse Files

Create an ext4 filesystem on a file.


[root@server ~]# truncate -s 1G foo
[root@server ~]# losetup --find --show ./foo
/dev/loop3
[root@server ~]# mkfs -t ext4 /dev/loop3
[root@server ~]# mount /dev/loop3 /mnt
[root@server ~]# ls /mnt
lost+found
[root@server ~]# df -h |grep loop3
/dev/loop3 976M 1.3M 908M 1% /mnt
Advertisements

One thought on “Create Filesystem on Sparse Files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s