You could do this exercise on a floppy or other removable drive, but if you want ample
room to play in, working off a hard drive is a better way.
Step 1??”Make a Blank Image File
Use the dd command to create a file with a block size of 1,024 bytes (a megabyte) and
create a file that is 10MB in size. You should have enough free space on your drive to
accommodate a file that size, of course. You need 10,000 blocks of 1KB (1,024 bits) in this
10MB file, so here??™s what you type:
Dd if=/dev/zero of=/tmp/test-img bs=1024 count=10000
The shell responds with
10000+0 records in
10000+0 records out
Step 2??”Make a File System
Now we need to make the system think the file is a block device instead of an ASCII file,
so we use losetup, a utility that associates loop devices with regular files or block devices.
You will use the loopback device /dev/loop0. losetup /dev/loop0 /tmp/test-img.
Then format the file with an ext3 file system:
mkfs -t ext3 -q /tmp/test-img
If prompted that test.img is not a block device, enter y to proceed anyway.
CHAPTER 18 Managing Files, Volumes, and Drives 396
Step 3??”Mount the Test File System
Your test file system is ready to go, except that you can??™t do much with it until it is
mounted on your system.
Pages:
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806