power failure, boot, and fsck
Hi, After a power failure at home, my FreeBSD server automatically starts again but fails to mount my UFS /boot disk because it was not properly unmounted. Here is my fstab: $ cat /etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/da0s1a /boot-disk ufsrw 00 I'm using ZFS root with a USB UFS boot device. Anyway, I get an error that looks like (copied from another thread; devices and mount points don't match): UFS: /dev/ad10s3f (/usr) Automatic file system check failed, help! error aborting boo (sending sigtem to parent)! init: /bin/sh on /etc/rc terminated abnormally, going to single user mode. enter full pathname of shell or RETURN for /bin/sh: In single-user mode I just `fsck /dev/da0s1a` and reboot. That fixes the problem. However, I would like this to be automatic on boot. It would be annoying if I'm out-of-town and the server cannot recover without my help. Any tips? -- Patrick Donnelly ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Writes to Hard Disk Going Beyond Capacity
Hi List, I have a strange problem in a C program I wrote. I open a hard disk character file (/dev/ad1) and attempt to write over the entire disk. I expect the last write that would go beyond the hard disk length (capacity) to return with an error but instead the write succeeds. This happens for hundreds of gigabytes beyond the file (hard drive) length. What could be wrong? (This program works fine on Linux. The last write that would go beyond the end of the hard drive returns with -1.) Thanks for any help, -- - Patrick Donnelly ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Writes to Hard Disk Going Beyond Capacity
On Sat, Jul 10, 2010 at 4:01 AM, Giorgos Keramidas keram...@ceid.upatras.gr wrote: On Sat, 10 Jul 2010 03:10:31 -0400, Patrick Donnelly batr...@batbytes.com wrote: Hi List, I have a strange problem in a C program I wrote. I open a hard disk character file (/dev/ad1) and attempt to write over the entire disk. I expect the last write that would go beyond the hard disk length (capacity) to return with an error but instead the write succeeds. This happens for hundreds of gigabytes beyond the file (hard drive) length. What could be wrong? (This program works fine on Linux. The last write that would go beyond the end of the hard drive returns with -1.) Thanks for any help, Can we see the exact source code of the program? What you describe might work if the file has holes inside it. http://www.batbytes.com/destroy Specifically, after filling the hard drive it will begin to rapidly write where the throughput of the writes is about 10 GB/s (obviously not going to the hard drive). -- - Patrick Donnelly ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Writes to Hard Disk Going Beyond Capacity
On Sat, Jul 10, 2010 at 2:38 PM, C. P. Ghost cpgh...@cordula.ws wrote: Are you aware of short writes? static int write_buf (int fd, const char *buf, size_t s) { ssize_t r = write(fd, buf, s); if (r == -1) fprintf(stderr, write error: %s\n, strerror(errno)); return r = 0; } What if write(2) returns less than s, but not -1? Or, to be more precise, is it possible that write(2) returns 0 for some reason, perhaps because the device isn't ready and can't accept more data, so it says that it wrote 0 bytes, but that you are free to try again? On Solaris, the write(2) man page says: If a write() requests that more bytes be written than there is room for—for example, if the write would exceed the process file size limit (see getrlimit(2) and ulimit(2)), the system file size limit, or the free space on the device—only as many bytes as there is room for will be written. For example, suppose there is space for 20 bytes more in a file before reaching a limit. A write() of 512-bytes returns 20. The next write() of a non-zero number of bytes gives a failure return (except as noted for pipes and FIFO below). http://docs.sun.com/app/docs/doc/816-5167/write-2?l=enn=1a=view Have you tried your program on [Open]Solaris too? What happens there? Perhaps our write(2) isn't entirely IEEE Std 1003.1 compliant? Because write(2) there says: If a write() requests that more bytes be written than there is room for (for example, [XSI] [Option Start] the process' file size limit or [Option End] the physical end of a medium), only as many bytes as there is room for shall be written. For example, suppose there is space for 20 bytes more in a file before reaching a limit. A write of 512 bytes will return 20. The next write of a non-zero number of bytes would give a failure return (except as noted below). (...) http://www.opengroup.org/onlinepubs/95399/functions/write.html Hmmm... any C/POSIX standards lawyers/specialists here? write returning 0 appears to be the problem. That is indeed strange and I would guess it may be a bug? -- - Patrick Donnelly ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org