Re-mount hdd where dietpi_userdata is located

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=10
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

Hi guys,

I was so close to having this all setup, but broken something - think my kid disconnected the hdd and now I need to mount it again and get the dietpi_userdata hooked up again as can’t uninstall via dietpi-software anymore.

Any help on mounting to the old mounting place, so everything just works again would be appreciated

mount "$(mawk '/dietpi_userdata/{print $2}' /etc/fstab)"

Should do it.

Mount: : can’t find in /etc/fstab.

Think the the first time I mounted it was /mnt/data

Can you share following

df -h
cat  /etc/fstab
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
root@DietPi:~# df -h
cat  /etc/fstab
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  3.5G   24G  13% /
devtmpfs        446M     0  446M   0% /dev
tmpfs           480M  4.0K  480M   1% /dev/shm
tmpfs           192M  4.6M  188M   3% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.0G  4.0K  1.0G   1% /tmp
tmpfs            50M  8.0K   50M   1% /var/log
/dev/mmcblk0p1  127M   32M   95M  26% /boot
# You can use "dietpi-drive_manager" to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------


#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=1024M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf, glusterfs, mergerfs, bind, Btrfs subvolume
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAP SPACE
#----------------------------------------------------------------
/var/swap none swap sw

#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=c26b8af2-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=c26b8af2-01 /boot vfat noatime,lazytime,rw 0 2
NAME        FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                      931.5G  0 disk
└─sda1      ext4         931.5G  0 part            6e837fc5-ef2d-449e-898a-a99725e2bdc0 a8985f6f-25d1-469b-8cb7-fc00e30094bb
mmcblk0                   29.2G  0 disk
├─mmcblk0p1 vfat           128M  0 part /boot      c26b8af2-01                          9041-5D00
└─mmcblk0p2 ext4            29G  0 part /          c26b8af2-02                          14bb0923-da43-46db-919f-a1b300fdc73f

It is indeed not part of /etc/fstab anymore. In this case you’d need to remount it via dietpi-drive_manager to get the entry re-added.

OK, so just go into dietpi-drive_manager and mount again - I think I named it mnt/data before is there anyway to check that?

I guess when mounting again the path needs to be the same as before for it to work again right?

Thanks for the help fella - really appreciate it :slight_smile:

You can check via ls -l /mnt/dietpi_userdata where it is linking to.

Hey, sorry it’s been a while - life got in the way - so did the check

/mnt/dietpi_userdata -> /mnt/data/dietpi_userdata

Looks like it was named data before, but I get the below when trying to mount to mnt/data again

 Command: mount -o noatime,lazytime,rw /dev/sda1 /mnt/data                 │
│  - Exit code: 32                                                             │
│  - DietPi version: v8.10.2 (MichaIng/master) | HW_MODEL: 3 | HW_ARCH: 3 |    │
│ DISTRO: 6                                                                    │
│  - Image creator: DietPi Core Team                                           │
│  - Pre-image: from scratch                                                   │
│  - Error log:                                                                │
│ mount: /mnt/data: mount(2) system call failed: Structure needs cleaning.    

Any ideas?

Seems like the filesystem is broken and you need to check and repair it.
This can also be done with dietpi-drive_manager. In the same menu where you can mount it there is also a “Check & Repiar” option.

Yeah I tried that a couple of times, but it just says:

[ INFO ] DietPi-Drive_Manager | Checking for required APT packages: e2fsprogs

Then hangs

How long did you wait? And what did you do then?
I think disconnecting the HDD of a working system corrupted your whole file system.
Are you able to boot another linux machine and plugin in SD card and the HDD for a fs check?
Or do you have a backup of the working system?

theoretically the drive could be checked as follow (as long as not mounted)

fsck -a /dev/sda

Another thing is to check kernel error messages

dmesg -l err,crit,alert,emerg