Jason (jcreed) wrote,
Jason
jcreed

Continuing in the vein of ever-so-slightly-obscure but useful facts that I am discovering for various ancillary reasons stemming from trying to re-immerse myself in the C-hacker/unix-weenie mindset, I discovered (thanks to spoons answering a vague question) that you can view any file in your typical linux filesystem as a block device, by using the so-called loop device. I thought you had to muck around with ramdisks (whose sizes are irritatingly are usually configured at kernel load time, requiring a reboot to change them) and dd and stuff.

The executive summary from wikipedia is that (assuming example.img is a disk image) you do this:
losetup /dev/loop0 example.img
mount /dev/loop0 /home/you/dir


and then /home/you/dir is a mounted peephole into example.img. I find this cute, and very much In The Unix Spirit somehow.
Tags: unix
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 7 comments