Create a filesystem on a file

From Define Wiki
Jump to navigation Jump to search

Hack to show the PCM installer a /depot directory after the OS paritioning has been completed.

Create the file for the FS

# 20GB file 
dd if=/dev/zero of=/home/depot.fs bs=1M count=20000

Create the file system on the file

You will get warned that the system is not a block device, just say 'y'

[root@icrhead home]# mkfs depot.fs 
mke2fs 1.41.12 (17-May-2010)
depot.fs is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
...

Mount the new filesystem

Include -o loop

[root@icrhead home]# mount -o loop depot.fs /depot/
[root@icrhead home]# df -h
Filesystem            Size  Used Avail Use% Mounted on
[snip]
/home/depot.fs         20G   44M   19G   1% /depot