LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Installing packages to a mounted filesystem (https://www.linuxquestions.org/questions/linux-newbie-8/installing-packages-to-a-mounted-filesystem-760610/)

chethanzmail 10-08-2009 01:23 PM

Installing packages to a mounted filesystem
 
I have mounted a root filesystem (debian 4.0) to /mnt/new-image/.

I am trying to understand if I can install new software/packages to this root filesystem mounted at this location (/mnt/new-image). If I am allowed to do this, how/where do I specify the installation path so that the installed files are in the mounted partition itself?

Also, when I unmount this image after installing additional packages, I am assuming that the changes are automatically saved to the original image. Hopefully this is the way it works :confused: Please advise on this.

BTW, The host system is running Debian too.

Your suggestions are much appreciated.

Thanks,
Chethan

NightHorse 10-08-2009 01:26 PM

You can chroot into the mounted file system like this "chroot /mnt/new-image"
After chrooting you are actually working on the mounted file system on that terminal. If you do apt-get install *packagename* you are installing it into the mounted file system.

pljvaldez 10-08-2009 01:28 PM

I haven't tried this, but I think you can just chroot /mnt/new-image and then from there install packages using aptitude. chroot changes the root environment to the mount point (at least this is how it works when fixing a grub installation).

chethanzmail 10-08-2009 01:32 PM

Thanks for the quick reply
 
Thanks a tonne!

Are the packages I install automatically saved when I umount the image? Is this taken care of by the -o loop option that is used along with the mount command?

Thanks,
Chethan

NightHorse 10-08-2009 01:50 PM

Why are you using -o loop??? Is it an iso image???

If it was just a hard disk partition then it's saved. but if so I don't know why are you using -o loop with it??

chethanzmail 10-08-2009 02:10 PM

No, it is not an ISO image. It is just seen as a "file" on a different location in the hard disk.

I am using the -o loop to apparently "loop mount" the file. Pardon me, but I am not sure how -o loop helps here either.

NightHorse 10-08-2009 11:24 PM

I never tried -o loop with anything but iso images. Anyway as long as you have the file system mounted you can chroot to it work like you are working on that system. It's very useful when you are testing software. Install whatever you want or modify whatever you want then exit and it all saved.

chethanzmail 10-09-2009 06:46 AM

Thanks for your replies. Has worked for me without issues!

Chethan


All times are GMT -5. The time now is 05:21 AM.