Frugal /home simlink to another partition


Forum: Other Help Topics
Topic: Frugal /home simlink to another partition
started by: clivesay

Posted by clivesay on Dec. 06 2004,16:42
I am experimenting with my first frugal install and was trying to figure out how to place things in a /home dir without eating up a bunch of memory at restore. I think this will work for that but again, I don't know what the heck I am doing.  :p

With a little forum searching and experimentation, I came up with this method. Thought I would share as it seems to work.

Q: How do I store all my misc files on a separate partition using a frugal install and access them from /home/dsl automagically?

A: I installed Frugal on /hda1, mounted /hda5 and created a folder called /MyDocuments. After that, I opened the /opt/bootlocal.sh file and added:

Code Sample

sudo mount /dev/hda5
ln -s /mnt/hda5/MyDocuments /home/dsl


Now when I reboot, I have a symlink to /mnt/hda5/MyDocuments in my /home/dsl directory.

If there is a better way, I am open to suggestions!

Thanks

Chris

Posted by cbagger01 on Dec. 06 2004,17:50
Your approach will work fine if your hda5 parititon is a Linux (EXT2/3, reiser etc) partition.

If it is a FAT/FAT32 partition, then some information will be lost in translation.

A solution is to make a loopfile on your FAT/FAT32 partition, format the file as a virtual EXT2 hard drive and then mount it.  Then link it to /home/dsl like you just did with hda5.

Posted by clivesay on Dec. 06 2004,18:39
hmmm didn't know that. Once again you are a wealth of info, CB.

I'll have to read up on your suggestion. It's currently over my head.

Take care

Chris

Posted by Numenor on Dec. 08 2004,04:40
Quote (cbagger01 @ Dec. 06 2004,12:50)
A solution is to make a loopfile on your FAT/FAT32 partition, format the file as a virtual EXT2 hard drive and then mount it.  Then link it to /home/dsl like you just did with hda5.

I knew about using loop to mount devices etc but this intrigues me...how is this done..I've read a little on the web but it doesnt seem to address this...everytime I read this board I am humbled... :p

Posted by cbagger01 on 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.

Posted by Numenor on Dec. 11 2004,04:55
ahhhh I understand now..I got confused by the terminology you were using...I've done the similar with iso and image files created with dd(not the symlink but the loop mounting to view image contents)

thanks much for your comments...brillliant.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.