[FS#1215] `/sbin/block` is not able to mount logical volumes over the `/overlay` directory.

LEDE Bugs lede-bugs at lists.infradead.org
Thu Dec 14 17:09:41 PST 2017


The following task has a new comment added:

FS#1215 - `/sbin/block` is not able to mount logical volumes over the `/overlay` directory. 
User who did this - Tomás Abad (tabad)

----------
Hello Mathias,

Yes, you are right but as I wrote the topic like it was a bug report I thought it was a valid start point; I apologize.

Well, I'm going to include here all the information and the steps to reproduce the error.

==== Hardware & LEDE Firmware ====

  * Hardware
    * [[https://goo.gl/91Mh4X| Linksys WRT160NL]]
    * [[https://goo.gl/wKJqGS|Sandisk Cruzer Fit 16GB]]
  * LEDE Firmware
    * [[https://goo.gl/91Mh4X|[LEDE Reboot 17.01.4 r3560-79f57e422d]]

> **Note:** LEDE Reboot 17.01.4 start with its default configuration.

==== How to reproduce the bug ====

  * Installation of packages


root at LEDE:~# opkg -V0 update
root at LEDE:~# opkg -V0 install kmod-usb-storage usbutils
root at LEDE:~# opkg -V0 install block-mount
root at LEDE:~# opkg -V0 install gdisk
root at LEDE:~# opkg -V0 install lvm2
root at LEDE:~# opkg -V0 install f2fs-tools kmod-fs-f2fs
root at LEDE:~# opkg -V0 install swap-utils


  * Preparation of USB storage device


root at LEDE:~# gdisk /dev/sda
Command (? for help): x
Expert command (? for help): z
Blank out MBR? (Y/N): Y

root at LEDE:~# gdisk /dev/sda
Command (? for help): o
Proceed? (Y/N): Y
Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-31266782, default = 2048) or {+-}size{KMGTP}: 2048
Last sector (2048-31266782, default = 31266782) or {+-}size{KMGTP}: 31266782
Hex code or GUID (L to show codes, Enter = 8300): 8e00
Command (? for help): w
Do you want to proceed? (Y/N): Y

root at LEDE:~# lvm pvcreate -y -ff /dev/sda1
root at LEDE:~# lvm vgcreate -y -s 16M sandisk /dev/sda1
root at LEDE:~# lvm lvcreate -L 64M -n swap -y sandisk
root at LEDE:~# lvm lvcreate -L 128M -n overlay -y sandisk
root at LEDE:~# lvm lvcreate -L 2048M -n cifs -y sandisk


  * Preparation of file systems


root at LEDE:~# mkswap -L swap /dev/sandisk/swap
root at LEDE:~# mkfs.f2fs -q -l cifs /dev/sandisk/cifs
root at LEDE:~# mkfs.f2fs -q -l overlay /dev/sandisk/overlay

root at LEDE:~# block info
/dev/mtdblock2: UUID="b9987b6c-6483eae0-ddc9a928-146c8265" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock3: MOUNT="/overlay" TYPE="jffs2"
/dev/sda1: UUID="yqu58H-4vkv-9diC-scUc-skXn-UbDp-S1x8zf" TYPE="LVM2_member"
/dev/mapper/sandisk-cifs: UUID="d3121a1b-0afb-4519-aab3-6f524fc143d7" VERSION="1.8" TYPE="f2fs"
/dev/mapper/sandisk-overlay: UUID="5a5c2088-d3ef-4a1b-9f31-2dc814b1097c" VERSION="1.8" TYPE="f2fs"
/dev/mapper/sandisk-swap: UUID="54b4f904-3f8d-42df-bf0e-714e807c2320" LABEL="swap" VERSION="1" TYPE="swap"


  * Preparation of //fstab// section of configuration


root at LEDE:~# block detect > /etc/config/fstab
root at LEDE:~# uci show fstab
fstab. at global[0]=global
fstab. at global[0].anon_swap='0'
fstab. at global[0].anon_mount='0'
fstab. at global[0].auto_swap='1'
fstab. at global[0].auto_mount='1'
fstab. at global[0].delay_root='5'
fstab. at global[0].check_fs='0'
fstab. at mount[0]=mount
fstab. at mount[0].target='/mnt/sda1'
fstab. at mount[0].uuid='yqu58H-4vkv-9diC-scUc-skXn-UbDp-S1x8zf'
fstab. at mount[0].enabled='0'
fstab. at mount[1]=mount
fstab. at mount[1].target='/mnt/sandisk-cifs'
fstab. at mount[1].uuid='d3121a1b-0afb-4519-aab3-6f524fc143d7'
fstab. at mount[1].enabled='0'
fstab. at mount[2]=mount
fstab. at mount[2].target='/mnt/sandisk-overlay'
fstab. at mount[2].uuid='5a5c2088-d3ef-4a1b-9f31-2dc814b1097c'
fstab. at mount[2].enabled='0'
fstab. at swap[0]=swap
fstab. at swap[0].uuid='54b4f904-3f8d-42df-bf0e-714e807c2320'
fstab. at swap[0].enabled='0'

root at LEDE:~# mkdir /mnt/sandisk-cifs
root at LEDE:~# mkdir /mnt/sandisk-overlay

root at LEDE:~# uci delete fstab. at mount[0]
root at LEDE:~# uci set fstab. at mount[0].enabled='1'
root at LEDE:~# uci set fstab. at mount[1].enabled='1'
root at LEDE:~# uci set fstab. at swap[0].enabled='1'
root at LEDE:~# uci set fstab. at mount[1].target='/overlay'
root at LEDE:~# uci commit fstab


  * Preparation of ///dev/mapper/sandisk-overlay//


root at LEDE:~# mount /dev/mapper/sandisk-overlay /mnt/sandisk-overlay/
root at LEDE:~# tar -C /overlay -cf - . | tar -C /mnt/sandisk-overlay  -xf -
root at LEDE:~# umount /dev/mapper/sandisk-overlay


  * Reboot


root at LEDE:~# reboot


==== The proof ====

Once the router has rebooted:

  - ///dev/mapper/sandisk-cifs// is mounted successfully.
  - ///dev/mapper/sandisk-swap// is activated successfully.
  - ///dev/mapper/sandisk-overlay// is mounted **unsuccessfully**.


root at LEDE:~# df -hP | grep '/dev/mapper'
/dev/mapper/sandisk-cifs      2.0G    188.0M      1.8G   9% /mnt/sandisk-cifs

root at LEDE:~# swapon -s
Filename				Type		Size	Used	Priority
/dev/mapper/sandisk-swap                partition	65532	0	-1


> **Note:** ///sbin/block mount// doesn't work even after the system has waked up.


root at LEDE:~# block mount
block: /dev/mtdblock2 is already mounted on /rom
block: /dev/mtdblock3 is already mounted on /overlay
block: /dev/mapper/sandisk-cifs is already mounted on /mnt/sandisk-cifs

root at LEDE:~# df -hP | grep '/dev/mapper'
/dev/mapper/sandisk-cifs      2.0G    188.0M      1.8G   9% /mnt/sandisk-cifs


It seems like ///dev/mapper/sandisk-overlay// doesn't exsist. But whether ///dev/mapper/sandisk-overlay// is mounted over whatever other directory, it works perfectly.


root at LEDE:~# uci set fstab. at mount[1].target='/mnt/sandisk-overlay'
root at LEDE:~# uci commit fstab

root at LEDE:~# block mount
block: /dev/mtdblock2 is already mounted on /rom
block: /dev/mtdblock3 is already mounted on /overlay
block: /dev/mapper/sandisk-cifs is already mounted on /mnt/sandisk-cifs

root at LEDE:~# df -hP | grep '/dev/mapper'
/dev/mapper/sandisk-cifs      2.0G    188.0M      1.8G   9% /mnt/sandisk-cifs
/dev/mapper/sandisk-overlay    126.0M     56.9M     55.1M  51% /mnt/sandisk-overlay


And it workd even when the system is rebooted.

Best regards,
----------

More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=1215#comment3993



More information about the lede-bugs mailing list