-
Notifications
You must be signed in to change notification settings - Fork 246
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
Improve #1415 to also explain where the USB device is mounted #1422
Conversation
@@ -9,8 +9,8 @@ REAL_USB_DEVICE=$(readlink -f $USB_DEVICE) | |||
StopIfError "USB device '$USB_DEVICE' is not a block device" | |||
|
|||
# Check if REAR-000 USB device is not accidentally mounted on other than $BUILD_DIR location. | |||
if grep -v $BUILD_DIR /proc/mounts | grep -q "^$REAL_USB_DEVICE"; then | |||
Error "USB device '$REAL_USB_DEVICE' is already mounted." | |||
if res=$(grep -v $BUILD_DIR /proc/mounts | grep "^$REAL_USB_DEVICE" ) ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember that $res will contain whole line from /proc/mounts, not only mountpoint ...
@schlomo V. |
@gozora please check & improve as you see fit and merge. I can't test it here and fully trust you. I simply thought that it is probably easier to just send you a PR with my thoughts in code than to describe them in text. |
@schlomo I'll take a look on this, once I have that retry_command () story done ;-) V. |
@gozora here you go, only show the mount point :-) |
if grep -v $BUILD_DIR /proc/mounts | grep -q "^$REAL_USB_DEVICE"; then | ||
Error "USB device '$REAL_USB_DEVICE' is already mounted." | ||
if res=( $(grep -v $BUILD_DIR /proc/mounts | grep "^$REAL_USB_DEVICE" ) ) ; then | ||
Error "USB device '$REAL_USB_DEVICE' is already mounted on '${res[2]}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schlomo you've nearly hit the right field ;-)
ERROR: USB device '/dev/sdb2' is already mounted on 'ext3'
V.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, I actually tested this one before:
$ res=( $(mount | grep '^/dev/sda1' ) ) ; echo "${res[2]}"
/boot/efi
Does your mount output look different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most probably because outputs from mount
and cat /proc/mounts
differ a bit:
centos:(/root)(root)# tail -n1 /proc/mounts
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=50012k,mode=700 0 0
centos:(/root)(root)# mount | tail -n1
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=50012k,mode=700)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, dumb of me. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anytime ;-)
@schlomo |
Now what I see under the "Files changed" tab of this pull request |
Good catch, I think I need to push this again, will do so in the evening. This branch is definitively broken. |
Some time ago such unexpected additionally changed files |
38ba29c
to
18cccd8
Compare
@schlomo I just finished testing. It looks OK for me. V. |
@gozora can you please check if this would work? I think it will help the users if we explain them why ReaR aborts and to give them a chance to fix it.