cbagger01
Group: Members
Posts: 4264
Joined: Oct. 2003 |
|
Posted: Dec. 08 2004,05:29 |
|
OK,
Here is a quick explanation from memory. You might need to play around with things a little bit to gain a better understanding or fix my mistakes.
In Linux, storage devices are treated like files, so you can directly access the data on your hard drive by performing operations on /dev/hda for example.
The same is true in reverse. It is possible to create a file located somewhere (on an existing C:\ drive or a USB storage device) and then manipulate this file as if it were another hard drive.
First, you should mount your destination device. For example, here is a command for the first IDE hard drive partition that exists on a Windows98 system:
sudo su mkdir /mnt/windrive mount -t vfat /dev/hda1 /mnt/windrive
You can now create or delete files on this drive. The contents are located in the /mnt/windrive directory (aka the "mountpoint").
Next, create an empty 100MB file on this drive using the dd command:
dd if=/dev/zero of=/mnt/windrive/my_fake_hd.img bs=100M count=1
Next, format the file as a virtual EXT2 filesystem:
mkfs -t ext2 /mnt/windrive/my_fake_hd.img
Now, using the "loop" device, we will mount this file as a virtual hard drive:
mkdir /mnt/fakehd mount -t ext2 -o loop /mnt/windrive/my_fake_hd.img /mnt/fakehd
And you can now read or write files into your fake 100MB hard drive located at mountpoint "/mnt/fakehd". When you reboot into windows, you will see a 100MB file named "my_fake_hd.img" that is sitting in your C:\ directory.
If you need to unmount the virtual hard drive, just type:
umount /mnt/fakehd
Now in clivesay's case, he would also need to create a symlink that points the "/home/dsl/" directory location over to the "/mnt/fakehd" mountpoint.
Hopefully, I didn't forget anything and this will be of help to you. At least it should help you understand the concepts at work here.
Good Luck.
|