# Check content of a directory before its mounted ###### tags: `linux` I have a all-in-one OpenStack VM created by devstack. It has a all-in-one Ceph cluster which has single OSD device. ``` root@node:~# ceph -s cluster: id: 38171196-1c8b-47f6-8b8a-fed82a18237d health: HEALTH_WARN no active mgr application not enabled on 1 pool(s) services: mon: 1 daemons, quorum node mgr: no daemons active osd: 1 osds: 1 up, 1 in data: pools: 4 pools, 32 pgs objects: 6 objects, 12.1MiB usage: 271MiB used, 9.73GiB / 9.99GiB avail pgs: 32 active+clean root@node:~# ceph --version ceph version 12.2.12 (1436006594665279fe734b4c15d7e08c13ebd777) luminous (stable) ``` A loop device assoicate to **/var/lib/ceph/drives/images/ceph.img** for storing Ceph data. ``` root@node:~# losetup -a /dev/loop1: [64514]:3541952 (/var/lib/snapd/snaps/core_8592.snap) /dev/loop2: [64514]:3542852 (/var/lib/ceph/drives/images/ceph.img) /dev/loop0: [64514]:3543235 (/var/lib/snapd/snaps/core_8689.snap) ``` But the image file is not found. ``` root@node:~# ls -l /var/lib/ceph/drives/images/ceph.img ls: cannot access '/var/lib/ceph/drives/images/ceph.img': No such file or directory ``` It is because "loop2" is mounted to **/var/lib/ceph** ``` root@node:~# df -h | grep loop2 /dev/loop2 10G 2.5G 7.6G 25% /var/lib/ceph root@node:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 91.4M 1 loop /snap/core/8689 loop1 7:1 0 91.3M 1 loop /snap/core/8592 loop2 7:2 0 10G 0 loop /var/lib/ceph vda 252:0 0 64G 0 disk ├─vda1 252:1 0 1M 0 part └─vda2 252:2 0 64G 0 part / ``` To get content of **/var/lib/ceph** before its mounted, mount / to a temp directory, the temp directory will show root partition without their mounts. ``` root@node:~# mkdir /mnt/tmproot root@node:~# mount --bind / /mnt/tmproot/ ``` ``` root@node:~# ls -l /mnt/tmproot/ total 4038764 drwxr-xr-x 2 root root 4096 Feb 15 2020 bin drwxr-xr-x 3 root root 4096 Mar 20 2020 boot drwxr-xr-x 4 root root 4096 Feb 14 2019 dev drwxr-xr-x 120 root root 4096 Oct 18 14:37 etc drwxr-xr-x 4 root root 4096 Feb 15 2020 home lrwxrwxrwx 1 root root 33 Mar 19 2020 initrd.img -> boot/initrd.img-4.15.0-91-generic lrwxrwxrwx 1 root root 33 Mar 19 2020 initrd.img.old -> boot/initrd.img-4.15.0-88-generic drwxr-xr-x 23 root root 4096 Feb 16 2020 lib drwxr-xr-x 2 root root 4096 Feb 14 2019 lib64 drwx------ 2 root root 16384 Feb 13 2020 lost+found drwxr-xr-x 2 root root 4096 Feb 14 2019 media drwxr-xr-x 3 root root 4096 Nov 5 14:24 mnt drwxr-xr-x 3 root root 4096 Feb 16 2020 opt drwxr-xr-x 2 root root 4096 Apr 24 2018 proc drwx------ 6 root root 4096 Oct 25 15:09 root drwxr-xr-x 13 root root 4096 Feb 14 2019 run drwxr-xr-x 2 root root 12288 Mar 19 2020 sbin drwxr-xr-x 4 root root 4096 Feb 13 2020 snap drwxr-xr-x 2 root root 4096 Feb 14 2019 srv -rw------- 1 root root 4135583744 Feb 13 2020 swap.img drwxr-xr-x 2 root root 4096 Apr 24 2018 sys drwxrwxrwt 16 root root 4096 Nov 5 14:42 tmp drwxr-xr-x 10 root root 4096 Feb 14 2019 usr drwxr-xr-x 14 root root 4096 Feb 16 2020 var lrwxrwxrwx 1 root root 30 Mar 19 2020 vmlinuz -> boot/vmlinuz-4.15.0-91-generic lrwxrwxrwx 1 root root 30 Mar 19 2020 vmlinuz.old -> boot/vmlinuz-4.15.0-88-generic ``` ``` root@node:~# ls -l /mnt/tmproot/var/lib/ceph total 36 drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 bootstrap-mds drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 bootstrap-mgr drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 bootstrap-osd drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 bootstrap-rgw drwxr-xr-x 3 root root 4096 Feb 16 2020 drives drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 mgr drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 mon drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 osd drwxr-xr-x 2 ceph ceph 4096 Nov 28 2019 tmp root@node:~# ls -l /mnt/tmproot/var/lib/ceph/drives/images/ total 2536992 -rw-r--r-- 1 root root 10737418240 Nov 5 14:43 ceph.img ``` #### Reference https://superuser.com/questions/977056/how-do-i-access-contents-of-mountpoint-directory-before-mount-without-unmounting