I have a new hdd powered with external power plug It is attached to the usb 3.0 (new Pi from shop also)
hdd is ext4
problem:
I mount the hdd on the pi, fine. then I write some files, fine. then I reboot the pi. then ls -l to look at the pi, oh no it has zero files!
ls -l /disk/
ls: reading directory '/disk/': Input/output error
total 0
(reboot again, zero files) then I put the hdd into my laptop and I see all files are ok. then I put it back into the pi, and wow my files are back! but look:
ls: cannot access '/disk/Project': Input/output error
ls: cannot access '/disk/node_modules': Input/output error
d????????? ? ? ? ? ? Project
drwxr-xr-x 3 me me 4096 Jan 31 17:23 SETTINGS
drwxr-xr-x 6 me me 4096 Jan 31 12:33 database_js
-rw-r--r-- 1 root root 21 Feb 4 21:40 ip.txt
drwx------ 2 root root 16384 Dec 17 15:06 lost+found
d????????? ? ? ? ? ? node_modules
drwxr-xr-x 2 me me 4096 Feb 2 14:22 not_modules
so then I change permissions and ownership back to what it is suppose to be and everything is cool again.
ls -l /disk/
total 40
drwxr-xr-x 7 me me 4096 Feb 2 14:24 Project
drwxr-xr-x 3 me me 4096 Jan 31 17:23 SETTINGS
drwxr-xr-x 6 me me 4096 Jan 31 12:33 database_js
-rw-r--r-- 1 root root 21 Feb 4 21:40 ip.txt
drwx------ 2 root root 16384 Dec 17 15:06 lost+found
drwxr-xr-x 122 me me 4096 Oct 18 22:02 node_modules
drwxr-xr-x 2 me me 4096 Feb 2 14:22 not_modules
until I write to files, then the problem starts over again.
I see others have this problem with pi and ext4: https://superuser.com/questions/706186/format-an-external-drive-with-ext4
like I said all equipment is new.
sudo blkid
/dev/mmcblk0: PTUUID="579dffc1" PTTYPE="dos"
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="DC3E-E470" TYPE="vfat" PARTUUID="579dffc1-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="a7adb26a-8b87-4729-99c8-9f5ac069d51e" TYPE="ext4" PARTUUID="579dffc1-02"
/dev/sda1: LABEL="4" UUID="101a689d-3060-4c02-bbbe-886d96990686" TYPE="ext4" PARTUUID="0593da0a-01"
sudo fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors
Disk model: super high speed
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0593da0a
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953523711 1953521664 931.5G 83 Linux
sudo nano /etc/fstab
#UUID=101a689d-3060-4c02-bbbe-886d96990686 /disk ext4 defaults,auto,users,noatime,rw,exec,nofail 0 0
PARTUUID=0593da0a-01 /disk ext4 defaults,auto,users,noatime,rw,exec,nofail 0 0
does pi need extra software besides this installed to handle ext4?
sudo apt update
sudo apt install exfat-fuse
problem still happens
dmesg
right after you get one of thoseInput/output error
s fromls
(or anything). It implies a hardware issue, this will confirm (or at least rule out) that.