My MacBook suddenly crashed yesterday. On startup, the computer would always shut down after a few seconds. I used ⌘ Command R to go into Disk Utility from Recovery HD to see what the problem was and the partition with OS X (Yosemite) could not be verified. I have 2 partitions one named BOOTCAMP (for Windows) and the other Macintosh HD (for OS X). The Windows partition was working properly.
On clicking repair for Macintosh HD I got a message saying the disk could not be repaired due to "error code 8". I formatted the disk and tried to reinstall the OS but I got an error saying that "file system verify or repair failed".
I was told that a possible solution is to go to single-user mode and type
fsck -fy as that repairs the disk. I did that and there were no problems detected however I still could not install the OS and I was getting the same error. I then went back to Disk Utility and removed the Macintosh HD partition. I thought that since the BOOTCAMP partition was working I could try splitting the Macintosh HD partition into smaller partitions and see if there was an error in them.
I split the available free space into 4 smaller partitions and verified each of them; only one of them had a problem. The others were working perfectly. I then played around with the partitions and I now have a partition of around 250 GB that works properly with Yosemite installed and a chunk of free space (that was previously occupied by the partitions that was not working) and the partition for BOOTCAMP (Windows).
So I solved the problem I was initially facing but my question is will this affect my MacBook or my data negatively in any way? Also was the problem caused because of a hard disk failure?