

Unmounting each time before would be a good option. I was unaware there was a hibernation helper, would this be like a script, i.e. shell script, or complete application program?Hu wrote:To partially handle this problem, many common Linux hibernation helpers can be configured to unmount filesystems on hibernation, so that the kernel can gracefully remount it when you resume, thus avoiding the inconsistency problems.
Makes sense, Yes.Hu wrote:Would you like for this topic to be moved there?


Code: Select all
#!/bin/bash
if [ "${1}" == "pre" ]; then
touch /home/jonathanCentOS/hook.sleep.started
umount /home/data.loc
echo "time for unmount is" > /home/jonathanCentOS/unmount
elif [ "${1}" == "post" ]; then
touch /home/jonathanCentOS/hook.sleep.complete
# nothing goes here
#service NetworkManager restart
touch /home/jonathanCentOS/hook.resume.started
sleep 3
set -x
mount /home/data.loc
touch /home/jonathanCentOS/hook.resume.complete
fi
Why it looks like it tries to successfully mount, but then Ownership and permission disabled and then unmount right away is very strange?!Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Version 2017.3.23AR.4 integrated FUSE 27
Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Mounted /dev/nvme0n1p4 (Read-Write, label "USER_DATA.ntfs", NTFS 3.1)
Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Cmdline options: rw
Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Mount options: allow_other,nonempty,relatime,rw,fsname=/dev/nvme0n1p4,blkdev,blksize=4096
Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Ownership and permissions disabled, configuration type 1
Jul 8 23:08:32 Reznik-CentOS ntfs-3g[5812]: Unmounting /dev/nvme0n1p4 (USER_DATA.ntfs)
Jul 8 23:08:32 Reznik-CentOS systemd: Started Hibernate.
Jul 8 23:08:32 Reznik-CentOS systemd: Unit sleep.target is not needed anymore. Stopping.
Jul 8 23:08:32 Reznik-CentOS systemd: Stopped target Sleep.
Jul 8 23:08:32 Reznik-CentOS systemd: Reached target Hibernate.
Jul 8 23:08:32 Reznik-CentOS systemd: Unit hibernate.target is bound to inactive unit systemd-hibernate.service. Stopping, too.
Jul 8 23:08:32 Reznik-CentOS systemd: Stopped target Hibernate.
Jul 8 23:08:32 Reznik-CentOS kernel: wlp4s0: authenticate with dc:ef:09:a7:95:e4
Jul 8 23:08:32 Reznik-CentOS kernel: wlp4s0: send auth to dc:ef:09:a7:95:e4 (try 1/3)
Jul 8 23:08:33 Reznik-CentOS NetworkManager[1613]: <info> [1562652513.0055] device (wlp4s0): supplicant interface state: disconnected -> authenticating
Jul 8 23:08:33 Reznik-CentOS kernel: wlp4s0: authenticated
Jul 8 23:08:33 Reznik-CentOS kernel: wlp4s0: associate with dc:ef:09:a7:95:e4 (try 1/3)
Jul 8 23:08:33 Reznik-CentOS kernel: wlp4s0: RX AssocResp from dc:ef:09:a7:95:e4 (capab=0x1411 status=0 aid=2)
Jul 8 23:08:33 Reznik-CentOS kernel: wlp4s0: associated
Jul 8 23:08:33 Reznik-CentOS NetworkManager[1613]: <info> [1562652513.0211] device (wlp4s0): supplicant interface state: authenticating -> associa

I'd use whatever tool is most efficient at restoring your backups of that drive.LIsLinuxIsSogood wrote:1) I forgot to mention that I want to recover the corrupt files at this point too so is this a job for ntfs-fix or is there any other tool?
It will not permit the unmount. Depending on the hibernation script, this failure may be ignored and leave the filesystem mounted or it may abort the entire hibernation. The latter is preferable here, since the goal is to ensure data integrity by performing the unmount. In some cases, you can arrange for the offending processes to be killed, but that's disruptive. I prefer to have the hibernation fail and let me, as the system owner, decide whether I want to close the processes or refrain from suspending.LIsLinuxIsSogood wrote:In order to mount and unmount though I am a bit confused how that will work because if files are actually open I don't think that the shell or operating system is going permit unmounting the partition due to open files on it...or will it?
If the hibernation tool has a dedicated hook for unmounting, it should handle both running umount and checking that the unmount was successful. If you reimplement this by using a more generic hook, then at minimum you will need to propagate the exit code of umount up from your script so that your parent can see that your script failed.LIsLinuxIsSogood wrote:Could be my script may need to check that kind of thing and take action there first...seems like a big challenge to have to figure out without closing open applications at which point this defeats the idea of freezing the system state to hibernation in the first place. How might I use the functionality of suspend/hibernate to check first then unmount or is that not a necessary precaution to take?
Is the device in question one which can be slow to appear after a resume, such as a USB device? Builtin drives ought to be online soon enough for a mount to succeed.LIsLinuxIsSogood wrote:It worked one time the shell script executed at both pre hibernation and post for resume, even though the unmount command clearly worked and the mount command did not, I'm thinking that might be an issue of timing when the command is executed upon resume.
You have more information about it than we do.LIsLinuxIsSogood wrote:The bigger problem is that while the script ran correctly for the first time, i can't seem to make it work again!!!! What could be the problem IDK?
I don't use systemd, but I am never surprised when it exhibits unexpected results.LIsLinuxIsSogood wrote:Is it worth maybe fresh restart and trying again, or even just logging out and back in? Weird that the systemd service hook script woud work once and then stop!
Missing set -e.LIsLinuxIsSogood wrote:Code: Select all
#!/bin/bash
What output did mount produce? It may have been written to a log file instead of a terminal. What is the fstab line for this mount?LIsLinuxIsSogood wrote:Could someone please tell me why maybe the mount command isn't working, of course this is the mount point only being passed, which /etc/fstab has an entry for, which I would think is enough for the bash script to work with, but I don't know anything about this sort of stuff really so of course help is appreciated.
Yes, it is strange.LIsLinuxIsSogood wrote:Why it looks like it tries to successfully mount, but then Ownership and permission disabled and then unmount right away is very strange?!
NTFS is a complicated filesystem. Linux support for it has never been at the level of support for native filesystems. If I were to guess, the lack of a checker is because no one has both the knowledge and motivation to write a good one.LIsLinuxIsSogood wrote:to try and see if booting that will give me a repair option to run chckdsk since from the sounds of it there is no comparable tool available for NTFS from within linux, which seems strange given that Microsoft and Linux are probably two of the most common operating systems found across the Internet as a whole.











Code: Select all
root@Reznik-CentOS:/# mount
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=8041408k,nr_inodes=2010352,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/mapper/centos_reznik-root on /var/tmp type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=8041408k,nr_inodes=2010352,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/mapper/centos_reznik-root on /var/tmp type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)