Creating a new filesystem within a file


/ Published in: Bash
Save to your folder(s)

Basic file system manipulation in Linux (some commands require sudo).


Copy this code and paste it in your HTML
  1. dd if=/dev/zero of=myfsys bs=512M count=1 # creating a 512M zeros file
  2. mke2fs myfilesys # creating a file system out of the file
  3.  
  4. mount myfilesys /mnt -o loop=/dev/loop0 # mounting it as a loop device
  5.  
  6. mkdir /mnt/point1 # creating a mount point
  7. mount /dev/loop0 /mnt/point1 # mounting
  8.  
  9. df /mnt/point1/ # its alive!
  10.  
  11. # results with:
  12. # Filesystem 1K-blocks Used Available Use% Mounted on
  13. # /dev/loop0 516040 400 489428 1% /mnt/point1

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.