LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Loopback (bind) mount automatically mounting additional ext4 USB drive (https://www.linuxquestions.org/questions/linux-hardware-18/loopback-bind-mount-automatically-mounting-additional-ext4-usb-drive-4175526800/)

juliushibert 11-29-2014 05:01 AM

Loopback (bind) mount automatically mounting additional ext4 USB drive
 
I have a USB (ext4) drive connected and it's registered in /etc/fstab. It mounts at /media/Backup fine. I want to mount a specific directory on that drive using a bind / loopback mount (this is required for the backup software I'm using).

My /etc/fstab is as follows but whenever I
Code:

sudo mount -a /Volumes
gets mounted twice (viewing through webmin) once as a loopback (but not in use) and secondly as an additional ext4 mount with the same UID as the mount point for /media/Backup (mounted as in use).

Code:

$ cat /etc/fstab
proc            /proc          proc    defaults          0      0
/dev/mmcblk0p1  /boot          vfat    defaults          0      2
/dev/mmcblk0p2  /              ext4    defaults,noatime  0      1
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that
UUID=922878f3-259a-48f6-b9a6-69563389a354  /media/Backup  ext4    defaults    0  0
/media/Backup/_CrashPlan/Hackintosh-Pro/Volumes              /Volumes                none    bind    0 0

I'm sure I've had this working in the past without my debian automounting an ext4. I had to reinstall my system after crashing the boot and OS partitions.

Here's a copy of dmesg but I can't seem to find any useful info from it.

Code:

$ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.12.28+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #709 PREEMPT Mon Sep 8 15:28:00 BST 2014
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: BCM2708
[    0.000000] cma: CMA: reserved 8 MiB at 1d800000
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 122880
[    0.000000] free_area_init_node: node 0, pgdat c061dd90, node_mem_map c06cf000
[    0.000000]  Normal zone: 960 pages used for memmap
[    0.000000]  Normal zone: 0 pages reserved
[    0.000000]  Normal zone: 122880 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 121920
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xe bcm2708.serial=0xa634c3b9 smsc95xx.macaddr=B8:27:EB:34:C3:B9 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 472044K/491520K available (4498K kernel code, 242K rwdata, 1344K rodata, 143K init, 701K bss, 19476K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]    vector  : 0xffff0000 - 0xffff1000  (  4 kB)
[    0.000000]    fixmap  : 0xfff00000 - 0xfffe0000  ( 896 kB)
[    0.000000]    vmalloc : 0xde800000 - 0xff000000  ( 520 MB)
[    0.000000]    lowmem  : 0xc0000000 - 0xde000000  ( 480 MB)
[    0.000000]    modules : 0xbf000000 - 0xc0000000  (  16 MB)
[    0.000000]      .text : 0xc0008000 - 0xc05bca24  (5843 kB)
[    0.000000]      .init : 0xc05bd000 - 0xc05e0eac  ( 144 kB)
[    0.000000]      .data : 0xc05e2000 - 0xc061e8a0  ( 243 kB)
[    0.000000]        .bss : 0xc061e8ac - 0xc06ce080  ( 702 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:394
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Switching to timer-based delay loop
[    0.000000] Console: colour dummy device 80x30
[    0.000000] console [tty1] enabled
[    0.001171] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000)
[    0.001233] pid_max: default: 32768 minimum: 301
[    0.001752] Mount-cache hash table entries: 512
[    0.002568] Initializing cgroup subsys memory
[    0.002679] Initializing cgroup subsys devices
[    0.002717] Initializing cgroup subsys freezer
[    0.002749] Initializing cgroup subsys blkio
[    0.002897] CPU: Testing write buffer coherency: ok
[    0.003362] Setting up static identity map for 0xc04487f8 - 0xc0448854
[    0.005297] devtmpfs: initialized
[    0.021294] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.022872] NET: Registered protocol family 16
[    0.028149] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.028831] cpuidle: using governor ladder
[    0.028880] cpuidle: using governor menu
[    0.029280] bcm2708.uart_clock = 0
[    0.031364] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.031424] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.031459] mailbox: Broadcom VideoCore Mailbox driver
[    0.031556] bcm2708_vcio: mailbox at f200b880
[    0.031661] bcm_power: Broadcom power driver
[    0.031700] bcm_power_open() -> 0
[    0.031724] bcm_power_request(0, 8)
[    0.532443] bcm_mailbox_read -> 00000080, 0
[    0.532482] bcm_power_request -> 0
[    0.532740] Serial: AMBA PL011 UART driver
[    0.532915] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev3
[    0.891387] console [ttyAMA0] enabled
[    0.918512] bio: create slab <bio-0> at 0
[    0.924043] SCSI subsystem initialized
[    0.928045] usbcore: registered new interface driver usbfs
[    0.933750] usbcore: registered new interface driver hub
[    0.939311] usbcore: registered new device driver usb
[    0.945887] Switched to clocksource stc
[    0.950165] FS-Cache: Loaded
[    0.953329] CacheFiles: Loaded
[    0.969238] NET: Registered protocol family 2
[    0.975043] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.982456] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.989048] TCP: Hash tables configured (established 4096 bind 4096)
[    0.995496] TCP: reno registered
[    0.998790] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    1.004660] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    1.011434] NET: Registered protocol family 1
[    1.016421] RPC: Registered named UNIX socket transport module.
[    1.022380] RPC: Registered udp transport module.
[    1.027187] RPC: Registered tcp transport module.
[    1.031910] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.039245] bcm2708_dma: DMA manager at f2007000
[    1.043986] bcm2708_gpio: bcm2708_gpio_probe c05efef0
[    1.049558] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.059141] audit: initializing netlink socket (disabled)
[    1.064650] type=2000 audit(0.910:1): initialized
[    1.234986] VFS: Disk quotas dquot_6.5.2
[    1.239352] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.248321] FS-Cache: Netfs 'nfs' registered for caching
[    1.255230] NFS: Registering the id_resolver key type
[    1.260520] Key type id_resolver registered
[    1.264730] Key type id_legacy registered
[    1.269540] msgmni has been set to 937
[    1.275280] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.283145] io scheduler noop registered
[    1.287224] io scheduler deadline registered (default)
[    1.292706] io scheduler cfq registered
[    1.297923] BCM2708FB: allocated DMA memory 5dc00000
[    1.302967] BCM2708FB: allocated DMA channel 0 @ f2007000
[    1.310788] bcm2708_fb_pan_display(0,0) returns=0
[    1.313093] Console: switching to colour frame buffer device 82x26
[    1.313640] bcm2708_fb_pan_display(0,0) returns=0
[    1.336543] bcm2708-dmaengine bcm2708-dmaengine: Load BCM2835 DMA engine driver
[    1.345568] uart-pl011 dev:f1: no DMA platform data
[    1.352555] vc-cma: Videocore CMA driver
[    1.357922] vc-cma: vc_cma_base      = 0x00000000
[    1.363955] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.370708] vc-cma: vc_cma_initial  = 0x00000000 (0 MiB)
[    1.386998] brd: module loaded
[    1.396710] loop: module loaded
[    1.401419] vchiq: vchiq_init_state: slot_zero = 0xdd800000, is_master = 0
[    1.410729] Loading iSCSI transport class v2.0-870.
[    1.418279] usbcore: registered new interface driver smsc95xx
[    1.425829] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.633146] Core Release: 2.80a
[    1.637676] Setting default values for core params
[    1.643746] Finished setting default values for core params
[    1.850680] Using Buffer DMA mode
[    1.855291] Periodic Transfer Interrupt Enhancement - disabled
[    1.862454] Multiprocessor Interrupt Enhancement - disabled
[    1.869385] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.875042] Dedicated Tx FIFOs mode
[    1.880167] WARN::dwc_otg_hcd_init:1042: FIQ DMA bounce buffers: virt = 0xddc14000 dma = 0x5dc14000 len=9024
[    1.892656] FIQ FSM acceleration enabled for :
[    1.892656] Non-periodic Split Transactions
[    1.892656] Periodic Split Transactions
[    1.892656] High-Speed Isochronous Endpoints
[    1.914547] dwc_otg: Microframe scheduler enabled
[    1.914642] WARN::hcd_init:473: FIQ at 0xc0321550
[    1.920751] WARN::hcd_init:474: FIQ ASM at 0xc0321800 length 36
[    1.928068] WARN::hcd_init:500: MPHI regs_base at 0xde806000
[    1.935059] dwc_otg bcm2708_usb: DWC OTG Controller
[    1.941308] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    1.949957] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    1.956822] Init: Port Power? op_state=1
[    1.962013] Init: Power Port (0)
[    1.966856] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.974980] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.983547] usb usb1: Product: DWC OTG Controller
[    1.989578] usb usb1: Manufacturer: Linux 3.12.28+ dwc_otg_hcd
[    1.996730] usb usb1: SerialNumber: bcm2708_usb
[    2.003372] hub 1-0:1.0: USB hub found
[    2.008597] hub 1-0:1.0: 1 port detected
[    2.014269] dwc_otg: FIQ enabled
[    2.014287] dwc_otg: NAK holdoff enabled
[    2.014296] dwc_otg: FIQ split-transaction FSM enabled
[    2.014316] Module dwc_common_port init
[    2.014769] usbcore: registered new interface driver usb-storage
[    2.022521] mousedev: PS/2 mouse device common for all mice
[    2.030095] bcm2835-cpufreq: min=700000 max=700000 cur=700000
[    2.037317] bcm2835-cpufreq: switching to governor powersave
[    2.044226] bcm2835-cpufreq: switching to governor powersave
[    2.051236] sdhci: Secure Digital Host Controller Interface driver
[    2.058715] sdhci: Copyright(c) Pierre Ossman
[    2.064387] sdhci: Enable low-latency mode
[    2.106137] mmc0: SDHCI controller on BCM2708_Arasan [platform] using platform's DMA
[    2.116683] mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
[    2.124011] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.131194] ledtrig-cpu: registered to indicate activity on CPUs
[    2.140837] hidraw: raw HID events driver (C) Jiri Kosina
[    2.155191] usbcore: registered new interface driver usbhid
[    2.162274] usbhid: USB HID core driver
[    2.172153] TCP: cubic registered
[    2.178933] Initializing XFRM netlink socket
[    2.186679] NET: Registered protocol family 17
[    2.192677] Key type dns_resolver registered
[    2.206128] Indeed it is in host mode hprt0 = 00021501
[    2.216042] registered taskstats version 1
[    2.226654] Waiting for root device /dev/mmcblk0p2...
[    2.396020] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.416098] Indeed it is in host mode hprt0 = 00001101
[    2.427101] mmc0: could read SD Configuration register (SCR) at the 2th attempt
[    2.468192] mmc0: read SD Status register (SSR) after 2 attempts
[    2.489201] mmc0: new high speed SDHC card at address 0007
[    2.506584] mmcblk0: mmc0:0007 SD16G 14.4 GiB
[    2.517410]  mmcblk0: p1 p2
[    2.576747] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.587867] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    2.596717] devtmpfs: mounted
[    2.601690] Freeing unused kernel memory: 140K (c05bd000 - c05e0000)
[    2.656519] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[    2.665973] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.677305] hub 1-1:1.0: USB hub found
[    2.682790] hub 1-1:1.0: 3 ports detected
[    2.966211] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    3.076551] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.085121] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.099762] smsc95xx v1.0.4
[    3.175786] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:34:c3:b9
[    3.296256] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[    3.427385] usb 1-1.3: New USB device found, idVendor=1058, idProduct=1021
[    3.446087] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.455127] usb 1-1.3: Product: Ext HDD 1021
[    3.473952] usb 1-1.3: Manufacturer: Western Digital
[    3.486078] usb 1-1.3: SerialNumber: 57434156354B393330333835
[    3.501956] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[    3.515608] scsi0 : usb-storage 1-1.3:1.0
[    4.186424] udevd[158]: starting version 175
[    4.528764] scsi 0:0:0:0: Direct-Access    WD      Ext HDD 1021    2002 PQ: 0 ANSI: 4
[    4.556717] sd 0:0:0:0: [sda] 1953519616 512-byte logical blocks: (1.00 TB/931 GiB)
[    4.589888] sd 0:0:0:0: [sda] Test WP failed, assume Write Enabled
[    4.617007] sd 0:0:0:0: [sda] Asking for cache data failed
[    4.624185] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    4.655375] sd 0:0:0:0: [sda] Test WP failed, assume Write Enabled
[    4.685477] sd 0:0:0:0: [sda] Asking for cache data failed
[    4.716072] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    4.726316] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.134184]  sda: sda1
[    5.144177] sd 0:0:0:0: [sda] Test WP failed, assume Write Enabled
[    5.177015] sd 0:0:0:0: [sda] Asking for cache data failed
[    5.185504] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    5.232396] sd 0:0:0:0: [sda] Attached SCSI disk
[    6.453816] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory
[  10.936173] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  11.561156] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  17.880623] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[  20.349019] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[  21.880994] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[  26.334154] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SSFS
[ 1825.964304] bcm2708_fb_blank(1) returns=1 p[1]=0x80000000


Keith Hedger 11-30-2014 05:57 PM

This is correct the -a option to mount is mount all in fstab, so you would expect all 4 entries in your fstab to be mounted if you just want to mount /Voulume use your command without the -a switch

juliushibert 12-01-2014 07:30 AM

Quote:

This is correct the -a option to mount is mount all in fstab, so you would expect all 4 entries in your fstab to be mounted if you just want to mount /Voulume use your command without the -a switch
I don't think I explained the problem that well...

Everything in fstab looks correct and the drives that I want to be mounting at the correct mount points using the correct mount type. These two being the main ones...

Code:

UUID=922878f3-259a-48f6-b9a6-69563389a354  /media/Backup  ext4
/media/Backup/_CrashPlan/Hackintosh-Pro/Volumes              /Volumes                none    bind

However the issue is, whenever I have that final bind / loopback mount type in fstab and use mount -a to mount all the fstab drives then for some unknown reason to me, /Volumes gets mounted as an ext4 mount type as well as a bind / loopback mount type. This is in correct and want to just get it mounted as a bind / loopback as the whole drive is already mounted as ext4 at /media/Backup.

This should hopefully illustrate the problem clearer:

Code:

$ sudo mount -l
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=236020k,nr_inodes=59005,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=48040k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=96060k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro) [boot]
/dev/sda1 on /media/Backup type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /media/Backup/_CrashPlan/Hackintosh-Pro/Volumes type ext4 (rw,relatime,data=ordered)

In doing so it's causing my backup software errors as it thinks there should be files at /Volumes. And it can't find that without the bind / loopback mount point.

Does that make more sense?

Keith Hedger 12-01-2014 07:48 AM

As far as I can see this is correct I put this line:
Code:

/home/keithhedger /tmp/xx none bind 0 0
into my fstab and run
Code:

sudo mount -a
/home/keithhedger was then mounted at /tmp/xx as expected and the mount command gives
Code:

/dev/sda11 on / type ext2 (rw,relatime,errors=continue,user_xattr,acl)
...
/dev/sda11 on /tmp/xx type ext2 (rw,relatime,errors=continue,user_xattr,acl)

Which implies there is a mounted ext2 filesystem at /tmp/xx, this is the same behavior as you are getting and seems to be correct for the mount command.

Keith Hedger 12-01-2014 07:51 AM

Maybe try parsing the output of blkid instead of mount as blikid doesn't report the bound folder as a mounted filesystem?

juliushibert 12-10-2014 05:45 AM

Don't know what I've done but everything seems to be sorted now. I suspect I've restored an old backup config file at somepoint and just missed it. Doh.

Thanks for the help!


All times are GMT -5. The time now is 08:28 PM.