Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReaR Recover Issue - Unrecognized mount option, wrong fs type, bad option #555

Closed
bbeaver opened this issue Mar 2, 2015 · 57 comments · Fixed by #559
Closed

ReaR Recover Issue - Unrecognized mount option, wrong fs type, bad option #555

bbeaver opened this issue Mar 2, 2015 · 57 comments · Fixed by #559
Assignees
Milestone

Comments

@bbeaver
Copy link

bbeaver commented Mar 2, 2015

Hi All:

Running current rear-1.16.1-1.git201502200825, and had both a Centos6.6 and RHEL6.5 box experience recover problems that had to be manually corrected. Both had very similar problems, but with different invalid options built within a mount command. My Centos6.6 box attempted a 'mount -o rw,relatime,barrier=1,data /dev/mapper/vg_centos02-LogVol00 /mnt/local/" command, and my RHEL6.5 box attempted a "mount -o rw,relatime,barrier=1,strip /dev/mapper/vg00-LogVol00 /mnt/local/" command. Both failed and had to be manually tweaked using the "Edit restore script" option. In the Centos case, had to remove the "data" option that had been added, in the case of RHEL had to remove the "strip" option that had been added. How are these invalid mount options landing in the restore script? Thanks for your help.

@gdha gdha added this to the Rear v1.17 milestone Mar 2, 2015
@gdha gdha self-assigned this Mar 2, 2015
@gdha
Copy link
Member

gdha commented Mar 2, 2015

@bbeaver Could you attach the disklayout.conf file? There were recent some changes in the script /usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh - could be related?

@bbeaver
Copy link
Author

bbeaver commented Mar 2, 2015

Yes, thanks - please see disklayout.conf below. You can see it was created with an invalid "data" option within the mount_options:

disk /dev/cciss/c0d0 587127480320 msdos
part /dev/cciss/c0d0 524288000 1048576 primary boot /dev/cciss/c0d0p1
part /dev/cciss/c0d0 565628108800 525336576 primary lvm /dev/cciss/c0d0p2
part /dev/cciss/c0d0 10485760000 566153445376 primary none /dev/cciss/c0d0p3
part /dev/cciss/c0d0 1024 576639205376 extended lba /dev/cciss/c0d0p4
part /dev/cciss/c0d0 10485760000 576641302528 logical lvm /dev/cciss/c0d0p5
lvmdev /dev/VG00 /dev/cciss/c0d0p5 DqSgVf-IPJs-lW6z-VMVQ-3sbO-AoH0-iMSBgL 20480000
lvmdev /dev/vg_centos02 /dev/cciss/c0d0p2 a4Cutt-6Gnv-eeVp-5mQC-32oV-p8Fk-5Nqj71 1104742400
lvmgrp /dev/VG00 4096 2499 10235904
lvmgrp /dev/vg_centos02 4096 134856 552370176
lvmvol /dev/VG00 LVTEST01 1280 10485760
lvmvol /dev/vg_centos02 LogVol01 8000 65536000
lvmvol /dev/vg_centos02 LogVol00 12500 102400000
lvmvol /dev/vg_centos02 LogVol02 114356 936804352
# Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]
fs /dev/cciss/c0d0p1 /boot ext4 uuid=964edbd0-3eb2-4caa-9704-3fca7540ba71 label= blocksize=1024 fragmentsize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=4063 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
fs /dev/drbd0 /home/test01 ext4 uuid=5eac3567-ad8d-48d6-b519-1276f20b4ad2 label= blocksize=4096 fragmentsize=4096 reserved_blocks=4% max_mounts=21 check_interval=180d bytes_per_inode=16383 options=rw,relatime,barrier=1,data
fs /dev/mapper/vg_centos02-LogVol00 / ext4 uuid=7f82e34c-b22b-4d09-b30e-f1010a3f4b80 label= blocksize=4096 fragmentsize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16304 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
fs /dev/mapper/vg_centos02-LogVol02 /home ext4 uuid=d70d94e8-30b2-4651-8648-6984e8a4e787 label= blocksize=4096 fragmentsize=4096 reserved_blocks=2% max_mounts=-1 check_interval=0d bytes_per_inode=16318 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
swap /dev/mapper/vg_centos02-LogVol01 uuid=6d15bf48-4298-488d-99a3-c698b4392570 label=
drbd /dev/drbd0 test01data /dev/mapper/VG00-LVTEST01

@gdha
Copy link
Member

gdha commented Mar 2, 2015

@bbeaver ok thanks - and could you also post the mount output?

@bbeaver
Copy link
Author

bbeaver commented Mar 2, 2015

Sure - plesae see mount output below:

mount

/dev/mapper/vg_centos02-LogVol00 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/cciss/c0d0p1 on /boot type ext4 (rw)
/dev/mapper/vg_centos02-LogVol02 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/drbd0 on /home/test01 type ext4 (rw)

@gdha
Copy link
Member

gdha commented Mar 2, 2015

# diff disklayout.conf disklayout.conf.old
11,16c11,14
< # Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
< # Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]
< fs /dev/mapper/vg_noc-lv_home /home ext4 uuid=42fc2968-51b8-4f0a-89a0-f4faeffe72c2 label= blocksize=4096 fragmentsize=4096 reserved_blocks=4% max_mounts=-1 check_interval=0d bytes_per_inode=16377 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
< fs /dev/mapper/vg_noc-lv_root / ext4 uuid=9dcfc861-9895-4456-89cd-8aab887900f8 label= blocksize=4096 fragmentsize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
< fs /dev/sda1 /boot ext4 uuid=8bfe951c-ad1c-464a-86a6-72f65f3833f4 label= blocksize=1024 fragmentsize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=4095 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
---
> fs /dev/mapper/vg_noc-lv_root / ext4 uuid=9dcfc861-9895-4456-89cd-8aab887900f8 label= blocksize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw
> fs /dev/sda1 /boot ext4 uuid=8bfe951c-ad1c-464a-86a6-72f65f3833f4 label= blocksize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=4095 default_mount_options=user_xattr,acl options=rw
> fs /dev/mapper/vg_noc-lv_home /home ext4 uuid=42fc2968-51b8-4f0a-89a0-f4faeffe72c2 label= blocksize=4096 reserved_blocks=4% max_mounts=-1 check_interval=0d bytes_per_inode=16377 default_mount_options=user_xattr,acl options=rw

The difference is coming from:

/bin/findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs

before applying the patch of @jsmeix we just used mount

Alright, between rw and rw,relatime,seclabel,barrier=1,data=ordered - what should be keep (rw), but what about the rest?

@bbeaver
Copy link
Author

bbeaver commented Mar 2, 2015

I manually edited the restore script in both my cases where rear recover failed. On the CentOS box related to the info above, I changed the mount command from:

"mount -o rw,relatime,barrier=1,data /dev/mapper/vg_centos02-LogVol00 /mnt/local/"

to:

"mount -o rw,relatime,barrier=1 /dev/mapper/vg_centos02-LogVol00 /mnt/local/"

On the RHEL system, I basically did the same thing, but removed a "strip" option instead of the "data" option. After doing this, I chose to continue the recovery, and it succeeded.

@jsmeix
Copy link
Member

jsmeix commented Mar 3, 2015

@bbeaver

What are the exact outputs for your CentOS6.6 and RHEL6.5 systems for each of the commands

findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs

versus

mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs

@jsmeix
Copy link
Member

jsmeix commented Mar 3, 2015

@gdha

at a first glange I currenly guess that the findmnt output that results entries like

fs  ...  options=rw,relatime,barrier=1,data=ordered

is probably correct but I guess some other script might fail to correctly process that kind of options value (in particular options of the form keyword=value)?

I guess this because bbeaver reported

mount -o rw,relatime,barrier=1,data /dev/...

which shows that the mount options have been clipped at the last '='.

I assume with the whole mount options as reported by findmnt

mount -o rw,relatime,barrier=1,data=ordered /dev/...

mounting would have worked.

@jsmeix
Copy link
Member

jsmeix commented Mar 3, 2015

Phew!
It seems this issue here is only about fstype "ext4" which means it should not be caused by my new btrfs code :-)

@jsmeix
Copy link
Member

jsmeix commented Mar 3, 2015

I think in 13_include_mount_filesystem_code.sh the following is wrong:

    # Extract mount options.
    local option mountopts
    for option in $options ; do
        name=${option%%=*}     # options can contain more '=' signs
        value=${option#*=}

because:

$ options=rw,relatime,barrier=1,data=ordered ; echo $options ; for option in $options ; do name=${option%%=*} ; value=${option#*=} ; echo name=$name value=$value ; done

outputs

rw,relatime,barrier=1,data=ordered
name=rw,relatime,barrier value=1,data=ordered

@bbeaver
Copy link
Author

bbeaver commented Mar 3, 2015

Gdha is exactly right, the "=" is getting clipped out. Here is the output from findmnt and mount:

[root@centos02]]# findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/vg_centos02-LogVol00 / ext4 rw,relatime,barrier=1,data=ordered
/dev/cciss/c0d0p1 /boot ext4 rw,relatime,barrier=1,data=ordered
/dev/mapper/vg_centos02-LogVol02 /home ext4 rw,relatime,barrier=1,data=ordered
/dev/drbd0 /home/test01 ext4 rw,relatime,barrier=1,data=ordered

[root@centos02]# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/vg_centos02-LogVol00 on / type ext4 (rw)
/dev/cciss/c0d0p1 on /boot type ext4 (rw)
/dev/mapper/vg_centos02-LogVol02 on /home type ext4 (rw)
/dev/drbd0 on /home/test01 type ext4 (rw)

@jsmeix
Copy link
Member

jsmeix commented Mar 3, 2015

My previous comment is wrong because the options entry is not

rw,relatime,barrier=1,data=ordered

but instead it is

options=rw,relatime,barrier=1,data=ordered

and with the latter it works because

$ options="options=rw,relatime,barrier=1,data=ordered" ; echo $options ; for option in $options ; do name=${option%%=*} ; value=${option#*=} ; echo name=$name value=$value ; done

outputs

options=rw,relatime,barrier=1,data=ordered
name=options value=rw,relatime,barrier=1,data=ordered

Somewhere else it happens that the mount options are clipped at the last '='.

@gdha
Copy link
Member

gdha commented Mar 3, 2015

@bbeaver @jsmeix I think problem is not the code but the length of the output. In bbeaver example I counted 274 characters before it was cut off. Could be wrong of course, but it looks we also need to investigate this path

@gdha
Copy link
Member

gdha commented Mar 3, 2015

@bbeaver could you run rear -vD savelayout and check the code around the line fs /dev/mapper/vg_centos02-LogVol02 /home?
Please paste only that part as we should be able to see what happens with the line (being truncated or what).

@bbeaver
Copy link
Author

bbeaver commented Mar 3, 2015

The "savelayout" shows proper mount options, but running "mkbackup" does not, and cuts off the string.

Here's the output, First, run "rear -vD savelayout" and check disklayout.conf:

[root@centos02] # cat /var/lib/rear/layout/disklayout.conf
disk /dev/cciss/c0d0 587127480320 msdos
part /dev/cciss/c0d0 524288000 1048576 primary boot /dev/cciss/c0d0p1
part /dev/cciss/c0d0 565628108800 525336576 primary lvm /dev/cciss/c0d0p2
part /dev/cciss/c0d0 10485760000 566153445376 primary none /dev/cciss/c0d0p3
part /dev/cciss/c0d0 1024 576639205376 extended lba /dev/cciss/c0d0p4
part /dev/cciss/c0d0 10485760000 576641302528 logical lvm /dev/cciss/c0d0p5
lvmdev /dev/VG00 /dev/cciss/c0d0p5 DqSgVf-IPJs-lW6z-VMVQ-3sbO-AoH0-iMSBgL 20480000
lvmdev /dev/vg_centos02 /dev/cciss/c0d0p2 a4Cutt-6Gnv-eeVp-5mQC-32oV-p8Fk-5Nqj71 1104742400
lvmgrp /dev/VG00 4096 2499 10235904
lvmgrp /dev/vg_centos02 4096 134856 552370176
lvmvol /dev/VG00 LVTEST01 1280 10485760
lvmvol /dev/vg_centos02 LogVol01 8000 65536000
lvmvol /dev/vg_centos02 LogVol00 12500 102400000
lvmvol /dev/vg_centos02 LogVol02 114356 936804352
# Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]
fs /dev/cciss/c0d0p1 /boot ext4 uuid=964edbd0-3eb2-4caa-9704-3fca7540ba71 label= blocksize=1024 fragmentsize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=4047 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
fs /dev/drbd0 /home/test01 ext4 uuid=5eac3567-ad8d-48d6-b519-1276f20b4ad2 label= blocksize=4096 fragmentsize=4096 reserved_blocks=3% max_mounts=21 check_interval=180d bytes_per_inode=16351 options=rw,relatime,barrier=1,data=ordered
fs /dev/mapper/vg_centos02-LogVol00 / ext4 uuid=7f82e34c-b22b-4d09-b30e-f1010a3f4b80 label= blocksize=4096 fragmentsize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16272 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
fs /dev/mapper/vg_centos02-LogVol02 /home ext4 uuid=d70d94e8-30b2-4651-8648-6984e8a4e787 label= blocksize=4096 fragmentsize=4096 reserved_blocks=1% max_mounts=-1 check_interval=0d bytes_per_inode=16286 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data=ordered
swap /dev/mapper/vg_centos02-LogVol01 uuid=6d15bf48-4298-488d-99a3-c698b4392570 label=
drbd /dev/drbd0 testdata01 /dev/mapper/VG00-LVTEST01

Then, run "rear -v mkbackup" and check disklayout.conf:

[root@centos02] # cat disklayout.conf
disk /dev/cciss/c0d0 587127480320 msdos
part /dev/cciss/c0d0 524288000 1048576 primary boot /dev/cciss/c0d0p1
part /dev/cciss/c0d0 565628108800 525336576 primary lvm /dev/cciss/c0d0p2
part /dev/cciss/c0d0 10485760000 566153445376 primary none /dev/cciss/c0d0p3
part /dev/cciss/c0d0 1024 576639205376 extended lba /dev/cciss/c0d0p4
part /dev/cciss/c0d0 10485760000 576641302528 logical lvm /dev/cciss/c0d0p5
lvmdev /dev/VG00 /dev/cciss/c0d0p5 DqSgVf-IPJs-lW6z-VMVQ-3sbO-AoH0-iMSBgL 20480000
lvmdev /dev/vg_centos02 /dev/cciss/c0d0p2 a4Cutt-6Gnv-eeVp-5mQC-32oV-p8Fk-5Nqj71 1104742400
lvmgrp /dev/VG00 4096 2499 10235904
lvmgrp /dev/vg_centos02 4096 134856 552370176
lvmvol /dev/VG00 LVTEST01 1280 10485760
lvmvol /dev/vg_centos02 LogVol01 8000 65536000
lvmvol /dev/vg_centos02 LogVol00 12500 102400000
lvmvol /dev/vg_centos02 LogVol02 114356 936804352
# Filesystems (only ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs are supported).
# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]
fs /dev/cciss/c0d0p1 /boot ext4 uuid=964edbd0-3eb2-4caa-9704-3fca7540ba71 label= blocksize=1024 fragmentsize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=4047 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
fs /dev/drbd0 /home/test01 ext4 uuid=5eac3567-ad8d-48d6-b519-1276f20b4ad2 label= blocksize=4096 fragmentsize=4096 reserved_blocks=3% max_mounts=21 check_interval=180d bytes_per_inode=16351 options=rw,relatime,barrier=1,data
fs /dev/mapper/vg_centos02-LogVol00 / ext4 uuid=7f82e34c-b22b-4d09-b30e-f1010a3f4b80 label= blocksize=4096 fragmentsize=4096 reserved_blocks=5% max_mounts=-1 check_interval=0d bytes_per_inode=16272 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
fs /dev/mapper/vg_centos02-LogVol02 /home ext4 uuid=d70d94e8-30b2-4651-8648-6984e8a4e787 label= blocksize=4096 fragmentsize=4096 reserved_blocks=1% max_mounts=-1 check_interval=0d bytes_per_inode=16286 default_mount_options=user_xattr,acl options=rw,relatime,barrier=1,data
swap /dev/mapper/vg_centos02-LogVol01 uuid=6d15bf48-4298-488d-99a3-c698b4392570 label=
drbd /dev/drbd0 testdata01 /dev/mapper/VG00-LVTEST01

@gdha
Copy link
Member

gdha commented Mar 3, 2015

@bbeaver that is interesting, but I don't get it as the disklayout.conf file is written only once (during the savelayout workflow)
Could you add the rear.log file when you run rear -vD mkbackup as a gist?

@bbeaver
Copy link
Author

bbeaver commented Mar 3, 2015

The dksklayout.conf file definitely gets updated when running the "rear mkbackup" command. Please see below. Anything specific you are wanting to see from the rear.log? Thanks for your help

[root@centos02 tmp]# ls -ltr /var/lib/rear/layout
total 20
drwxr-xr-x 2 root root 4096 Jan 11 13:03 config
-rw-r--r-- 1 root root 2188 Mar 3 09:53 disklayout.conf
-rw-r--r-- 1 root root 598 Mar 3 09:53 disktodo.conf
-rw-r--r-- 1 root root 824 Mar 3 09:53 diskdeps.conf
drwxr-xr-x 2 root root 4096 Mar 3 09:53 lvm

[root@centos02 tmp]# date
Tue Mar 3 10:29:21 EST 2015

root@centos02 tmp]# nohup rear -vD mkbackup &

[root@centos02 tmp]# ls -ltr /var/lib/rear/layout
total 20
drwxr-xr-x 2 root root 4096 Jan 11 13:03 config
-rw-r--r-- 1 root root 2188 Mar 3 10:29 disklayout.conf
-rw-r--r-- 1 root root 598 Mar 3 10:29 disktodo.conf
-rw-r--r-- 1 root root 824 Mar 3 10:29 diskdeps.conf
drwxr-xr-x 2 root root 4096 Mar 3 10:29 lvm

@gdha
Copy link
Member

gdha commented Mar 3, 2015

@bbeaver that is normal as sudo rear -s mkbackup will tell you that script layout/save/GNU/Linux/23_filesystem_layout.sh will get sourced. To verify type: sudo rear -s savelayout.
I still would like to get the full debugging output - thanks.

@bbeaver
Copy link
Author

bbeaver commented Mar 3, 2015

Sure - looking to see how I upload the file...

@bbeaver
Copy link
Author

bbeaver commented Mar 3, 2015

Please see if this gets you there - full rear-centos02.log debug:

https://gist.github.com/bbeaver/f736f9e80c3bd0b04017

@gdha
Copy link
Member

gdha commented Mar 3, 2015

@bbeaver thanks for the logging:

+ . /usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh
++ Log 'Begin saving filesystem layout'
....
+++ tune2fs -l /dev/cciss/c0d0p1
+++ grep -i 'Default mount options:'
+++ cut -d : -f 2
+++ awk '{$1=$1};1'
+++ grep -v none
+++ tr ' ' ,
++ default_mount_options=user_xattr,acl
++ [[ -n user_xattr,acl ]]
++ echo -n ' default_mount_options=user_xattr,acl'
++ options=rw,relatime,barrier=1,data
++ options=rw,relatime,barrier=1,data
++ options=rw,relatime,barrier=1,data
++ echo -n ' options=rw,relatime,barrier=1,data'

I'll dig into the code tomorrow and see what it is causing it.

@jsmeix
Copy link
Member

jsmeix commented Mar 4, 2015

At #545 I found

OS_VENDOR=RedHatEnterpriseServer
OS_VERSION=6.4

and

+++ mount -o rw,relatime,seclabel,barrier=1,dat /dev/mapper/vg_lsrs0vio-lv_root /mnt/local/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg_lsrs0vio-lv_root,

It is the same issue there:
There the mount options are cut at "...dat".

Because there it is cut in between the "data=ordered" (and not at the '=' character) it now seems there is really some obscure length limit somewhere.

But if it is a length limit it is not a fixed length limit.

Very strange.

@gdha
Copy link
Member

gdha commented Mar 4, 2015

@bbeaver @jsmeix I noticed it happens on centos 6.6 at random - let's say 1/10 it is bad and 9/10 it is ok - makes it even worse to debug

@jsmeix
Copy link
Member

jsmeix commented Mar 4, 2015

@gdha

do the 1/10 bad happen also with "rear savelayout" or do the 1/10 bad happen only with "rear mkbackup"?

@bbeaver
Copy link
Author

bbeaver commented Mar 4, 2015

I'm seeing RedHat/Fedora/CentOS servers behave the same with this issue. Not too surprising, since these distros are all RedHat based.

@jsmeix
Copy link
Member

jsmeix commented Mar 4, 2015

Only a blind guess:

Perhaps it is not rear that sometimes cuts the mount options.

Perhaps it is the findmnt command itself that sometimes reports clipped mount options?

On my SLES12 system "man findmnt" reads in particular:

-u, --notruncate
Do not truncate text in columns. The default is to not truncate
the TARGET, SOURCE, UUID, LABEL, PARTUUID, PARTLABEL
columns. This option disables text truncation also in all other columns.

and 23_filesystem_layout.sh contains

read_filesystems_command="$findmnt_command -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS ...

wich means without '-u' the FSTYPE and OPTIONS could be truncated.

@bbeaver
Copy link
Author

bbeaver commented Mar 4, 2015

That might explain why I just started seeing this issue recently. A few months ago I had not come accross this problem. I understand that ReaR recently changed from using "mount" to using "findmnt". If there are problems with "findmnt", then ReaR is just now seeing those issues.

@bbeaver
Copy link
Author

bbeaver commented Mar 4, 2015

I've made it back as far as Fedora 14, (which supports findmnt), but don't have easy access to a box with an older rhel5'ish o/s. I will continue looking though.

In the meantime, will this "-u" option to the findmnt command be added to the latest rear code?

gdha added a commit that referenced this issue Mar 4, 2015
…ere options was sometimes truncated on older RHEL 5/6
@bbeaver
Copy link
Author

bbeaver commented Mar 4, 2015

Thank you much for your help and quick response

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

On RHEL 5.1 there is no findmnt command (at least not by default):

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.1 (Tikanga)
# findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS
-bash: findmnt: command not found
# type -a findmnt
-bash: type: findmnt: not found

In this case rear falls back using "mount" in 23_filesystem_layout.sh as follows:

# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1,3,5,6
/dev/mapper/VolGroup00-LogVol00 / ext3 (rw)
/dev/hda1 /boot ext3 (rw)

@schlomo
Copy link
Member

schlomo commented Mar 5, 2015

The we should probably use this fallback code for all cases where
"findmount -u" will not work.

Are there any downsides to using mount instead of findmount? If yes, then
we should warn the user about them, e..g

WARNING: On your system ReaR cannot determine XYZ because findmnt is not
available.

On 5 March 2015 at 11:48, Johannes Meixner notifications@github.com wrote:

On RHEL 5.1 there is no findmnt command (at least not by default):

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 5.1 (Tikanga)

findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS

-bash: findmnt: command not found

type -a findmnt

-bash: type: findmnt: not found

In this case rear falls back using "mount" in 23_filesystem_layout.sh as
folows:

mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1,3,5,6

/dev/mapper/VolGroup00-LogVol00 / ext3 (rw)
/dev/hda1 /boot ext3 (rw)


Reply to this email directly or view it on GitHub
#555 (comment).

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

One downside to using mount instead of findmount is documented in 23_filesystem_layout.sh:

# If the findmnt command is available use it instead of the traditional mount command
# because (since SLE12) "man 8 mount" reads:
#   The listing mode is maintained for backward compatibility only.
#   For more robust and customizable output use findmnt(8), especially in your scripts.

Another downside seems to be shown here in this issue:
findmnt reports more mount options compared to mount which means with findmnt rear could recreate the system more exactly as it was originally.

Finally findmnt is basically required for btrfs subvolumes to get the mounted btrfs subvolume path (i.e. the subvolume name), see "Mounted btrfs subvolumes" in 23_filesystem_layout.sh - if findmnt is not available it falls back using awkward hacks to determine the mounted btrfs subvolume path.

In practice I think on old systems without findmnt there will be no btrfs used and then the old systems get recreated as all the time before by plain "mount".

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

On RHEL 5.9 it is (at least by default) the same as on RHEL 5.1:

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
# findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS
-bash: findmnt: command not found
# type -a findmnt
-bash: type: findmnt: not found
# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1,3,5,6
/dev/mapper/VolGroup00-LogVol00 / ext3 (rw)
/dev/hda1 /boot ext3 (rw)

@schlomo
Copy link
Member

schlomo commented Mar 5, 2015

I guess systems without findmnt won't notice much difference then?

On 5 March 2015 at 12:31, Johannes Meixner notifications@github.com wrote:

On RHEL 5.9 it is (at least by default) the same as on RHEL 5.1:

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 5.9 (Tikanga)

findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS

-bash: findmnt: command not found

type -a findmnt

-bash: type: findmnt: not found

mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1,3,5,6

/dev/mapper/VolGroup00-LogVol00 / ext3 (rw)
/dev/hda1 /boot ext3 (rw)


Reply to this email directly or view it on GitHub
#555 (comment).

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

I did my changes in 23_filesystem_layout.sh so that on systems without findmnt everything should work as before.

But on systems with findmnt it now uses findmnt and then issues like this one appear.

@schlomo
Copy link
Member

schlomo commented Mar 5, 2015

That is why I suggest that we use findmnt only if it supports the -u option.

On 5 March 2015 at 12:41, Johannes Meixner notifications@github.com wrote:

I did my changes in 23_filesystem_layout.sh so that on systems without
findmnt everything should work as before.

But on systems with findmnt it now uses findmnt and then issues like this
one appear.


Reply to this email directly or view it on GitHub
#555 (comment).

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

@schlomo
do you know a Linux distribution with findmnt where findmnt does not support the 'u' option?

@schlomo
Copy link
Member

schlomo commented Mar 5, 2015

No, but I find it simpler to require that findmnt can handle -u than to
worry about the case of meeting a findmnt that does not.

Actually, before this thread I was not consciously aware of findmnt, so
thanks a lot for that.

On 5 March 2015 at 12:49, Johannes Meixner notifications@github.com wrote:

@schlomo https://github.com/schlomo
do you know a Linux disrtibution with findmnt where findmnt does not
support the 'u' option?


Reply to this email directly or view it on GitHub
#555 (comment).

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

@schlomo
how would you implement a test to find out whether or not findmnt can handle the '-u' option?

I am currently installing RHEL 6 to find out about findmnt there...

FYI, regarding findmnt in general:
With btrfs and subvolumes everyone basically must use it because plain mount reports insufficient/misleading information because mount only reports the plain device like /dev/sda2 mounted multiple times at various mount points but not what subvolume of the btrfs on /dev/sda2 is mounted cf. #497 in particular #497 (comment)

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

On RHEL 6.5:

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)
# findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' '
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered
# findmnt -alnuv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' '
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered
# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1,3,5,6
/dev/mapper/VolGroup-lv_root / ext4 (rw)
/dev/sda1 /boot ext4 (rw)

Currently I don't know how to trigger that findmnt truncates FSTYPE or OPTIONS output.

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

It depends on the width of the terminal wherein findmnt is run whether or not it truncates output.

On RHEL 6.5 in a smaller-width xterm:

# findmnt -alnv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' '
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=o
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=o
# findmnt -alnuv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' '
/dev/mapper/VolGroup-lv_root
 / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered
# findmnt -alnuv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | tr -s '[:blank:]' ' ' | od -a
0000000   /   d   e   v   /   m   a   p   p   e   r   /   V   o   l   G
0000020   r   o   u   p   -   l   v   _   r   o   o   t  nl  sp   /  sp
0000040   e   x   t   4  sp   r   w   ,   r   e   l   a   t   i   m   e
0000060   ,   s   e   c   l   a   b   e   l   ,   b   a   r   r   i   e
0000100   r   =   1   ,   d   a   t   a   =   o   r   d   e   r   e   d
0000120  nl   /   d   e   v   /   s   d   a   1  sp   /   b   o   o   t
0000140  sp   e   x   t   4  sp   r   w   ,   r   e   l   a   t   i   m
0000160   e   ,   s   e   c   l   a   b   e   l   ,   b   a   r   r   i
0000200   e   r   =   1   ,   d   a   t   a   =   o   r   d   e   r   e
0000220   d  nl
0000222

Scaring!

With '-u' findmnt inserts a newline character when the output is too long for one line.

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

@gdha
the issue is not yet fixed!

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

I think using the '-r' option alone helps - at least on RHEL 6.5:

# findmnt -nrv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

Also on SLE12 "findmnt -nrv -o .." seems to output the right thing:

# findmnt -nrv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/sda2 / btrfs rw,relatime,space_cache
/dev/sda2 /.snapshots btrfs rw,relatime,space_cache
/dev/sda2 /var/tmp btrfs rw,relatime,space_cache
/dev/sda2 /var/spool btrfs rw,relatime,space_cache
/dev/sda2 /var/opt btrfs rw,relatime,space_cache
/dev/sda2 /var/log btrfs rw,relatime,space_cache
/dev/sda2 /var/lib/named btrfs rw,relatime,space_cache
/dev/sda2 /var/lib/pgsql btrfs rw,relatime,space_cache
/dev/sda2 /var/lib/mailman btrfs rw,relatime,space_cache
/dev/sda2 /usr/local btrfs rw,relatime,space_cache
/dev/sda2 /var/crash btrfs rw,relatime,space_cache
/dev/sda2 /opt btrfs rw,relatime,space_cache
/dev/sda2 /tmp btrfs rw,relatime,space_cache
/dev/sda2 /srv btrfs rw,relatime,space_cache
/dev/sda2 /boot/grub2/x86_64-efi btrfs rw,relatime,space_cache
/dev/sda2 /home btrfs rw,relatime,space_cache
/dev/sda2 /boot/grub2/i386-pc btrfs rw,relatime,space_cache
# findmnt -nrv -o SOURCE,TARGET,OPTIONS,FSROOT -t btrfs
/dev/sda2 / rw,relatime,space_cache /@
/dev/sda2 /.snapshots rw,relatime,space_cache /@/.snapshots
/dev/sda2 /var/tmp rw,relatime,space_cache /@/var/tmp
/dev/sda2 /var/spool rw,relatime,space_cache /@/var/spool
/dev/sda2 /var/opt rw,relatime,space_cache /@/var/opt
/dev/sda2 /var/log rw,relatime,space_cache /@/var/log
/dev/sda2 /var/lib/named rw,relatime,space_cache /@/var/lib/named
/dev/sda2 /var/lib/pgsql rw,relatime,space_cache /@/var/lib/pgsql
/dev/sda2 /var/lib/mailman rw,relatime,space_cache /@/var/lib/mailman
/dev/sda2 /usr/local rw,relatime,space_cache /@/usr/local
/dev/sda2 /var/crash rw,relatime,space_cache /@/var/crash
/dev/sda2 /opt rw,relatime,space_cache /@/opt
/dev/sda2 /tmp rw,relatime,space_cache /@/tmp
/dev/sda2 /srv rw,relatime,space_cache /@/srv
/dev/sda2 /boot/grub2/x86_64-efi rw,relatime,space_cache /@/boot/grub2/x86_64-efi
/dev/sda2 /home rw,relatime,space_cache /@/home
/dev/sda2 /boot/grub2/i386-pc rw,relatime,space_cache /@/boot/grub2/i386-pc

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

On RHEL 6.0 there is no findmnt (in contrast to RHEL 6.5) - at least not by default:

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
# type -a findmnt
-bash: type: findmnt: not found
# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | cut -d ' ' -f 1,3,5,6
/dev/mapper/VolGroup-lv_root / ext4 (rw)
/dev/sda1 /boot ext4 (rw)

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

On RHEL 6.x findmnt was added to the util-linux-ng RPM
on "Thu Jan 27 2011":

# rpm -q --changelog util-linux-ng
.
.
.
* Thu Jan 27 2011 Karel Zak  2.17.2-8
...
- fix #616325 - Include findmnt in util-linux-ng package

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

findmnt is available since RHEL 6.1 and works there as needed:

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)
# findmnt -nrv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered
# mount -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs | cut -d ' ' -f 1,3,5,6
/dev/mapper/VolGroup-lv_root / ext4 (rw)
/dev/sda1 /boot ext4 (rw)

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

I submitted #559 that should hopefully fix it.

@gdha
Copy link
Member

gdha commented Mar 5, 2015

@bbeaver @jsmeix and what if we do the following:

COLUMNS=254 findmnt -alnuv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/vg00-lv00 /          ext3   rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered

or

COLUMNS=254 findmnt -nrv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/vg00-lv00 / ext3 rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered

@jsmeix
Copy link
Member

jsmeix commented Mar 5, 2015

With '-r' findmnt results the right output regardless of the terminal width.

I had tried "COLUMNS=900" before but that did not make a difference for me.

I think the whole issue is that by default findmnt tries (too?) hard to make the output nice looking for interactive usage and only with '-r' one gets the real hard facts for real hard men ;-)

With RHEL 6.1 in a smaller xterm:

# COLUMNS=254 findmnt -alnuv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs        
/dev/mapper/VolGroup-lv_root
                          /      ext4   rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1                 /boot  ext4   rw,relatime,seclabel,barrier=1,data=ordered
# findmnt -nrv -o SOURCE,TARGET,FSTYPE,OPTIONS -t ext2,ext3,ext4,vfat,xfs,reiserfs,btrfs
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,seclabel,barrier=1,data=ordered
/dev/sda1 /boot ext4 rw,relatime,seclabel,barrier=1,data=ordered

Note the additional newline in the first findmnt output that breaks what belongs to /dev/mapper/VolGroup-lv_root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants