# mtab and chroot?

## Gentree

How can I correctly set up mounting in a chroot, is it necessary to boot it directly every time I make a change to the main systems fstab?

eg, I set up a new partition , add it to fstab , add a bind in fstab for the chroot system , reboot main system and verify the mount and the bind are effective.

however these changes are not transmitted to the chroot system and that systems /etc/mtab retains the old device mapping. Deleteing that mtaband it fails to be recreated I reboot to that "chroot" system directly.

PS is there a clean way with init and runlevels to force new bindings added to my fstab to take effect without rebooting? I thought of restarting localmount but was not sure that was sensible.

TIA Gentree  :Cool: 

----------

## NeddySeagoon

Gentree,

Does less /proc/mounts return the information you want?

To make root ro it is sometimes nessacary to make /etc/mtab a symbolic link to /proc/mounts.

----------

## Gentree

zorro:

```
bash-3.00# less /proc/mounts

/proc/mounts: No such file or directory

```

same on the main system.

I'm obviously tying this in knots because I dont know what I am doing.

I now have these added lines in the boot system's fstab. Oddly only the entry for portage comes out correctly on chroot /devsys.

```
## bind in needed for chroot devsys

/boot             /devsys/boot          ext3  noatime,bind 0 0

/usr/portage      /devsys/usr/portage   auto  defaults,bind 0 0

/iso              /devsys/iso           reiserfs notail,bind 0 0

/zic              /devsys/zic           reiser4  noatime,bind 0 0

/win_C            /devsys/win_C         ntfs  noauto,noatime,ro,usr,umask=000,b$

/win_D            /devsys/win_D         vfat  noauto,user,umask=000,bind 0 0

/dev/cdrom        /devsys/mnt/cdrom     iso9660     noauto,ro,user,unhide,bind $

```

in the chrooted shell:

```
bash-3.00#df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/hda10             7785064   1895012   5890052  25% /

proc                   7785064   1895012   5890052  25% /proc

sysfs                  7785064   1895012   5890052  25% /sys

udev                   7785064   1895012   5890052  25% /dev

devpts                 7785064   1895012   5890052  25% /dev/pts

/dev/hda3                54444     52614         0 100% /boot

/dev/hda6              5113708   4324128    789580  85% /usr/portage

none                   7785064   1895012   5890052  25% /dev/shm

df: `/proc/bus/usb': No such file or directory

```

so much of this is /proc is not even mounting correctly but I dont see why portage is mounting and the rest not.

Thanks for your help.

 :Cool: 

----------

## Headrush

Can you explain what it is you are trying to accomplish?

Are you changing/adding mount points and you want to to appear in your chroot also?

Or are the mount points the same every time you boot?

----------

## NeddySeagoon

Gentree,

Have you been bind mounting /proc so it shows in the chroot?

/proc is kernel memory space, so it should be the same everywhere.

----------

## Gentree

 *NeddySeagoon wrote:*   

> Gentree,
> 
> Have you been bind mounting /proc so it shows in the chroot?
> 
> /proc is kernel memory space, so it should be the same everywhere.

 

no bind, just the classic /proc mount in both fstab.

```
none      /proc   proc    defaults    0 0
```

 *Quote:*   

> Are you changing/adding mount points and you want to to appear in your chroot also? Or are the mount points the same every time you boot?

 

Yes I have new mount points that I did not originally have but the central issue is that /proc  is not there 

```

bash-3.00#ls /proc -l

total 0
```

Thanks for the replies. 

 :Cool: 

----------

## NeddySeagoon

Gentree,

If you want /proc to be in the chroot, you need to mount it there.

e.g. 

```
mount proc -t proc /mnt/gentoo/proc 
```

(or something similar) is what you will have done 

for a gentoo install. Then when you do chroot /mnt/gentoo /bin/bash, you can see /proc.

----------

