3

I have a weird situation:

I had a disk on a Debian 9 server that had one partition with an ext4 filesystem mounted to /opt/foobar. I then unmounted the partition and deleted it using fdisk.

I then

  1. Created a PV on that disk
  2. Added it to a VG
  3. Created an LV
  4. Created an ext4 filesystem

which I now want to mount to the old mountpoint /opt/foobar. The command finishes without error, but when I check with df or lsblk I can see that the mount is not there.

Update: I just realized, that mounting the LV to another mountpoint, say /mnt works.

Here are some outputs:

root:~/ # grep optsdc /etc/fstab
/dev/mapper/vg1-lvoptsdc  /opt/sdc  ext4  defaults  0  0

root:~/ # mount /dev/mapper/vg1-lvoptsdc /opt/sdc
root:~/ # echo $?
0
root:~/ # dmesg
[Thu Oct 17 16:34:54 2019] EXT4-fs (dm-9): mounted filesystem with ordered data mode. Opts: (null)
root:~/ # lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb                8:16   0   50G  0 disk
└─vg1-lvoptsdc   254:9    0    5G  0 lvm
root:~/ # lvdisplay -m /dev/mapper/vg1-lvoptsdc
--- Logical volume ---
LV Path                /dev/vg1/lvoptsdc
LV Name                lvoptsdc
VG Name                vg1
LV UUID                ol90ME-v6Tv-fpUC-8cb6-NwlZ-0UjF-l2c7d8
LV Write Access        read/write
LV Creation host, time hostname, 2019-10-17 09:02:07 +0200
LV Status              available
# open                 0
LV Size                5.00 GiB
Current LE             1280
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:9

--- Segments ---
Logical extents 0 to 1279:
  Type                linear
  Physical volume     /dev/sdb
  Physical extents    9722 to 11001
Thorian93
  • 733
  • 2
  • 6
  • 17
  • This is perfectly normal. Your LV doesn't start at the same offset your former partition did. Volume Groups allocates extents to logical volumes, which may not be consecutive, nor on the same disks, ... what you're trying to do can't work. You can mkfs your LV, you've most likely lost your data. – SYN Oct 17 '19 at 07:54
  • Sorry for the confusion, I backed up the data, I did not intend to keep it magically from the partition into the LV. I wanted to do a clean wipe and move the data back afterwards. – Thorian93 Oct 17 '19 at 08:02
  • Oh, my mistake. Then you'll want to mkfs your LV prior mounting `mkfs.ext4 /dev//`, or `mkfs.xfs`, or `mkfs -t `, ... – SYN Oct 17 '19 at 08:17
  • Okay, another confusion: I did that too - updated the question accordingly. I have everything set up as usual, a `mount` should work and it does not complain, but it does not do anything either. – Thorian93 Oct 17 '19 at 09:48
  • 1
    allright, can you tell us how do you mount that volume, and what's in your `/etc/fstab`? After executing your mount command, run `echo $?`: can you confirm it prints a 0? Outputs from `lsblk` welcome as well. – SYN Oct 17 '19 at 12:29
  • See my updated question. Exitcode is 0. – Thorian93 Oct 17 '19 at 13:09
  • That's quite unusual indeed ... Maybe try some `strace mount /dev/mapper/xxx /yyy`, trying to figure out what's that mount even doing under the hood? – SYN Oct 17 '19 at 13:32
  • 2
    The `ext4` filesystem driver is a kernel module. If it has something to complain about, the most descriptive messages are likely to be found in the `dmesg` listing. Also, what is the output of `lvdisplay -m /dev/mapper/vg1-lvoptsdc`? – telcoM Oct 17 '19 at 13:40
  • Thanks for the hints @telcoM. I appended the asked outputs in the question. – Thorian93 Oct 17 '19 at 14:39
  • Update: I just realized, that mounting the LV to another mountpoint, say /mnt works. Could it be /etc/mtab or something like that? – Thorian93 Oct 17 '19 at 15:30
  • 1
    I've had this case before, it's a case of successfully mounting, but some background watchdog (systemd?) immediately umounting it after so "it's not there and no error message". It might be an fstab entry but I don't quite remember the specifics atm. If you check the filesystem with `tune2fs -l` the last mount time should have updated regardless so you know it was mounted. Check your system logs (not just dmesg) if there's anything about it – frostschutz Oct 17 '19 at 15:40
  • 2
    perhaps https://unix.stackexchange.com/q/459969/30851 or maybe https://github.com/systemd/systemd/issues/1741 – frostschutz Oct 17 '19 at 17:37
  • Hi @frostschutz, nice name by the way. You did it! Your first link solved my isse. SystemD was to blame. If you want to go ahead and formulate a short answer to my question I will mark it as the solution, otherwise I would do so myself. – Thorian93 Oct 18 '19 at 05:41
  • glad it was the same issue, in that case it should probably be marked as duplicate question instead – frostschutz Oct 18 '19 at 09:39
  • I marked the question as duplicate. Thanks for your help folks! – Thorian93 Oct 18 '19 at 14:10

0 Answers0