Has anyone had trouble getting the HDD file system to boot as read/write when following this procedure for setup?
https://github.com/emoncms/emoncms/blob/bufferedwrite/docs/hddsetup.md
I changed 'ro' to 'rw' in /etc/fstab, then tried using just 'defaults', or 'defaults' and specifying a user group that both root and pi are members of with umask=0000 but no dice, the filesystem keeps booting as read only as verified by the output of 'mount'. If I run mount -o remount,rw /dev/sda2 it will mount as rw, but I'd like to figure out what's going on so I don't have to manually remount it at each startup.
I've tried several troubleshooting steps, I ran e2fsck (on the recommendation of the dmesg output grepped for /dev/sda and it found errors on dev/sda3, running e2fsck -y on this partition eliminated the dmesg warning message (I'm at work now, forgot exactly what the warning was but I think it said it was mounting without journal).
I'm wondering if I just need to wipe the HDD, reformat and rewrite the image? I used the win32diskimager to write both the SD card and HDD images. The HDD was NTFS before writing the image, it was an old WinVista drive, maybe this is causing trouble? I was under the impression that win32diskimager would write the image bit-for-bit to the drive so formatting as ext prior to imaging wouldn't be necessary but maybe it is.
What about it being something to do with this particular USB chipset on the external drive? Are some known to have compatibility issues with the linux OS that affect using the USB drive a root file system?
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Do you still have the errors=remount-ro text in your fstab?
If so, and your drive still has file system errors, it's getting remounted read-only. (You can delete errors=remount-ro from fstab temporarily to find out if it's the cause of your read-only issue)
Since the root partition is mounted during normal operation, you won't be able to run fsck on it without risking severe file system corruption. (e2fsck gives that warning when a check is attempted on a mounted disk/partition)
If you have another Linux machine you can mount the HDD on, you can check the drive while it's connected, but not mounted, on that machine. If not, you can boot from a Linux live CD, or Linux installed on a USB flash drive and check the drive on the machine you boot the CD/USB drive from.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
If you don't easily find out how to solve this properly, you could just add the remount command you quoted to /etc/rc.local so that it was executed at each boot.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
I forgot to say so , but I tried removing errors=remount-ro last night when troubleshooting and it still mounted as read only.
I do have another linux machine I can work with to check the whole disk's file system. I'll try that when I get home tonight. I haven't run e2fsch on the /dev/sda2 partition, only /dev/sda3 (I commented it out of fstab and rebooted before running the check).
There must be something obvious I'm missing or have botched, I'll also triple check tonight that I didn't make a typo or otherwise screw something up on /boot/cmdline.txt file on the SD card in case that's somehow causing unexpected functionality.
Thanks for the replies!
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
You can reverse the read-only changes quite easily as the original files that get edited were backed up with ".orig" extensions. https://github.com/emoncms/emoncms/blob/bufferedwrite/docs/install.md#read-only-mode
There are 3 effected files you can reinstate by deleting, moving or overwriting the "RO" versions
sudo mv /etc/default/rcS.orig /etc/default/rcS
sudo mv /etc/fstab.orig /etc/fstab
sudo mv /etc/mtab.orig /etc/mtab
Which take you back to standard raspbian, so you will need to edit the contents of fstab for booting to hdd (probably changing mmcblk0p2 to sda2) and adding the 3rd partition.(probably the same as what you should currently have /dev/sda3 /home/pi/data ext2 defaults,rw,noatime 0 2 )
Paul
PS if you still have the OS on the SD card you can temporarily edit /boot/cmdline.txt (in another machine) to boot to the SD card ( change /dev/sda2 to mmcblk0p2) if you need to access the hdd without booting into it eg to check the file system.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Restoring all the *.orig files and adding back the needed lines in fstab didn't work, still get a read only filesystem. So I went nuclear and reformatted/repartitioned the disk using fdisk and this time copied the image using the 'dd' tool on the linux machine and it appears to have worked (the image writing that is). I then checked the filesystems using e2fsck. The first partition had a dirty bit set so I cleared it, the second partition checked out OK, but the ext2 data partition gave a bunch of these messages "Inode XXXX has EXTENTS_FL flag set on filesystem without extents support" so I used the -y option to say yes to all.
Reattaching to the Pi and booting shows the root filesystem is still read only!
Thoughts? I'd suspect the disk but it seems to behave normally when mounted to the other machien or after remounting on the pi.
Perhaps adding the remount command to a startup script is the best way to go, it's just frustrating to not understand the root cause of the issue.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
You mentioned formatting the data partition as ext2. Have you tried formatting the it as ext4? (ext4 is preferable to ext2, and the extents flag problem looks like it might be a "left-over" from a previous ext4 formatting gone bad.
If that doesn't work, I'd say zero the entire drive with: dd if=/dev/zero of=/dev/sda bs=1M
Depending on the size of your drive, and the speed of your machine, it could take a while...
Note: Use /dev/sda instead of /dev/sda1
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
The pre-configured image has the data partition formatted as ext2 already but I could build up the whole thing manually, which is probably the better way to do it regardless and would allow a fuller understanding of how the components work together (mySQL, emoncms etc).
Tonight I may try another USB external HDD just in case there's something odd with this specific device. It's a toshiba USB 3 capable drive but is back-compatible with USB 2, the cable is USB 3 on one end and standard USB 1/2 on the other, but I'm wondering if the chipset in the drive for the USB to SATA interface is not playing well with the linux driver somehow.
Should probably have considered or tested this first, but I forgot I have another USB HDD in a drawer that will be easy to try it with and forgot that the USB 3 capability of this drive could be problematic.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
...I could build up the whole thing manually, which is probably the better way to do...
Without doubt the best option! It will take a little time to do so, but in doing so you will head off other problems that you would otherwise encounter.
Paul
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Yes, and had I don't that in the first place I'd probably be finished by now! Oh well, at least I've learned a bit along the way.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Following this procedure with the same Toshiba drive allows it to boot into Raspbian R/W.
http://raspberrypihobbyist.blogspot.com/2013/07/running-from-external-ha...
So I should be off to the races for setting up the rest of the bits now.
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Setting the Pi up to run from the USB drive beginning with a standard Raspbian image worked and the file system mounts as RW.
I went through the steps to set everything up and got to the localhost/emoncms landing page and entered the user name and password from the /var/www/emoncms/settings.php page using the epiphany web browser and the page went to blank white and nothing will load any longer from localhost/emoncms.
I'll go through and double-check I didn't miss anything from the setup instructions.
I know virtually nothing about apache web server, mysql or php so this could be fun...
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
As this is a completely different problem, I would start a new thread/title.
You may get a better response.
Paul
Re: Booting Pi from HDD - file system mounts as read only (yes I modified the fstab entry)
Sure, will do. Thanks for all the help so far!