tutorial - Create Linux Filesystem From An Ordinary File

Under Linux, you can create a regular file, format it as an ext2, ext3, or reiser file system, and then mount it just like a physical drive. It's then possible to read and write files to this newly-mounted device. You can also copy the complete file system, since it is just a file, to another computer.

First, you want to create a 20MB file or any size you want by executing the following command:

     $ dd if=/dev/zero of=disk-image count=40960

     40960+0 records in
     40960+0 records out

Next, to format this as an ext3 filesystem, you just execute the following command:

     $ /sbin/mkfs -t ext3 -q disk-image
     mke2fs 1.32 (09-Nov-2002)
     disk-image is not a block special device.
     Proceed anyway? (y,n) y

You are asked whether to proceed because this is a file, and not a block device. That is OK.

Next, you need to create a directory that will serve as a mount point for the loopback device.

      $ mkdir fs

You must do the next command as root, or with an account that has superuser privileges.

      # mount -o loop=/dev/loop0 disk-image fs

You can now create new files, write to them, read them, and do everything you normally would do on a disk drive. To make normal user to use this filesystem you need to give valid permission to the directory holding this filesystem.




Free, facebook, tips, Links, blogging, Downloads, Google, facebookTips, money, news, apps, Social, Media, Website, Tricks, games, Android, software, PIctures, Internet, Security, Web, codes, Review, bloggers, SAMSUNG, Worldwide, Contest, Exitic, Phones, facebookTricks, hacking, London, Olympics, SEO, Youtube, iOS, Adsense, gadgets, iPHONE, widgets, Doodle, twitter, video, Deals, technology, Aircel, Airtel, iPAD, Angry, Birds, BSNL, TechLife, GMAIL, Idea, Microsoft, SmartPhones, Stress, Buster, Windows, Yahoo, Infolinks, Nokia, Scam, Uninor, browsers, Amazon, Euro, CUP, Chat, IDM, JOBS, Modem, Music, Reliance, Results, SSC, Tata, Docomo, bing, freebie, mobile, placements, AIEEE, AlertPay, Chrome, College, Competetive, Exam, Dehradun, Extension, FireFox, GPRS, HTC, IMPACT, Info, MTS, Mark, Zukerberg, Paypal, Promotional, Post, Torrent, UTU, Unlocking, VodaFone, Wall, Paper, apple, books, engineering, iCAR, iTunes, pinterest, rovio, AVG, Admit, Card, Adobe, Affiliate, Marketing, Akhilesh, Amul, Girl, BlackBerry, ChromeBook, Clixsense, Coupon, Digitallife, Discovery, Emoticons, Festival, GATE, GIMP, Income, Tax, International, JSS, JailBreaking, Kindle, Linux, Local, MAX, PAYNE, Mac, Mango, Memory, Speed, Nexus, Online, Shopping, Raakhi, Report, Rising, Stars, Sample, Science, Sony, Syllabus, TabletBooK, Teamviewer, Templates, Dark, Knight, Rises, USA, UPMT, Virgin, Xperia, ZTE, challan, counselling, course, btech, funny, iMOVE, registration

source:http://linuxpoison.blogspot.com/2007/10/13578175802184.html