I have a script that requires knowing the file system type by using df /.

I'm running this script in a chroot centos7 environment running in a opensuse host, and it is failing because the file system type cannot be identified. The output of df / is:

Filesystem     1K-blocks     Used Available Use% Mounted on
-               83873280 33613180  50260100  41% /

I've read that in order to chroot to work properly the following steps are needed:

mount -t proc proc <target chroot>/proc
mount -o bind dev <target chroot>/dev

chroot <target chroot>
grep -v rootfs /proc/mounts > /etc/mtab

However, after these steps, the script still fails.

The actual content of /proc/mounts is

proc /proc proc rw,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,size=16286476k,nr_inodes=4071619,mode=755 0 0

I also tried just linking /proc/mounts to /etc/mtab, but the same result.

  • What do you want to achieve? To know which FS is there? To modify script that it'll be able to figure that out? To fool the sript so it will be presented with some good-looking data and pass through that faulty step? Jun 27 '19 at 11:40
  • Modifying the script is not an option. Thanks. Jun 27 '19 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.