No Account Yet?

You are not logged in.

Add to: JBookmarks Add to: Facebook Add to: Windows Live Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Blogmarks Add to: Technorati Add to: Newsvine Add to: Google Information
Creating a virtual loopback device E-mail
Linux HowTo's - Beginner Linux HowTo's
Written by dexxtreme dexxtreme   
Saturday, 24 May 2008 06:55

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



 

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 ( Sunday, 25 May 2008 00:06 )