Creating a virtual loopback device
Linux HowTo's - Beginner Linux HowTo's
Written by dexxtreme dexxtreme   
Saturday, 24 May 2008 06:55
Tags:

Sometimes you will need to create a virtual loopback device for whatever reason. One possible need would be for a temporary filesystem to do some quick testing, or maybe to set up a larger /tmp partition on a server where /tmp is too small. To initially create the loopback device, run:

 # dd if=/dev/zero of=/usr/local/tmpfs bs=50M count=10
dd if=<file to read from> of=<file to write to> bs=<byte size> count=<count to loop>

# losetup /dev/loop0 /usr/local/tmpfs
losetup <loopback device> <file>

# mkfs -t ext3 /dev/loop0
mkfs -t <file system type> <file system>

# mount /dev/loop0 /path/to/dir
mount <file system> <dir to mount filesystem>

You should now have a 500MB loopback filesystem (minus the standard filesystem overhead) mounted under /path/to/dir. You can change the size of the device by modifying the "bs" and "count" arguments in the "dd" command. On every reboot,you will need to do the following to make the device available again:

# losetup /dev/loop0 /usr/local/tmpfs

# mount /dev/loop0 /path/to/dir



 



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Tags:
Comments
Search RSS
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Sunday, 25 May 2008 00:06