Linux – How to Mount Hibernated Windows Partition

fstabhibernatelinuxmountmulti-boot

I am trying to mount my Windows partition at boot. It works fine when Windows is in shutdown, but when Windows is hibernated, it can't be mounted as read/write, and I am sent to the root shell at boot. I tried to solve this by adding errors=remount-ro to my fstab, to mount it read-only if it can't be mounted as read/write when it is hibernated, but it doesn't work, and I still get an error at boot.

Is there a way to work around this and boot the partition as read/write when possible, but as read-only when it is hibernated?

# <file system> <dir>   <type>  <options>   <dump>  <pass>
UUID=1f026730-1640-42fa-b5f6-eca9749b3a98 /boot ext4 defaults 0 2
UUID=2b5c372b-d6d5-4c27-9c3f-5e26ca84d3a7 /home ext4 defaults 0 2
UUID=2c154114-4898-45e6-8455-575e910d8382 / ext4 defaults 0 1
UUID=92041326-03a7-4fdc-9211-c060e83d662e swap swap defaults 0 0
UUID=A28034F38034CF91 /media/win7 ntfs defaults,user,exec,dev,suid,errors=remount-ro 0 0

Best Answer

I ended up removing the line from /etc/fstab. I now mount the Windows partition in ~/.xinitrc, by using the return code from mount:

# Mount windows
sudo mount -o defaults,user,exec,dev,suid /dev/sda1 /media/win7
if [ $? -eq 14 ]
then
  sudo mount -o defaults,user,exec,dev,suid,ro /dev/sda1 /media/win7
fi

To be warned/informed about the way the partition is mounted, I also added the following to my Conky configuration:

/dev/sda1 (Windows) is mounted:
${if_match "${exec mount | grep /dev/sda1 | grep -Eo [^a-z]ro[^a-z] | grep -o ro}" == "ro"}${font bold}${alignc}READ-ONLY: WATCH OUT!!!
${else}${alignc}R/W (normal)
${endif}
Related Question