View previous topic :: View next topic |
Author |
Message |
iNeedIT n00b
Joined: 10 Aug 2024 Posts: 13
|
Posted: Wed Aug 14, 2024 8:43 am Post subject: [BUG?] Fstab can't automount USB disk on frist attempt |
|
|
Hello gentoo forum,
Like in subject, fstab can't find my usb device, and mount it.
BUT, if I restart openRC init, everything is fine. Fstab can find it, and mount.
It is very annoying to restart openRC and log in. There must be another way.
Pictures for explain -> https://imgur.com/a/gentoo-forums-RxtRlet
Code: |
# BLKID OF USB SAMSUNG
#/dev/sda1: LABEL="Gentoo" UUID="9ace0ae7-2c82-401b-a078-8b725fa38bd4" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="5e2ef541-03b4-43b1-b52a-6515fc44b34e"
# ROOT PARTITION
PARTUUID=988508bb-d3b2-4057-af4b-3db1bcde3e5d / xfs defaults 1 1
#PENDRIVE USB SAMSUNG
PARTUUID=5e2ef541-03b4-43b1-b52a-6515fc44b34e /home/anon xfs defaults 0 1
|
Any suggestion? I can provide more information, just ask me. |
|
Back to top |
|
|
lars_the_bear Guru
Joined: 05 Jun 2024 Posts: 512
|
Posted: Wed Aug 14, 2024 10:11 am Post subject: |
|
|
It looks to me as if the drive isn't in a settled state by the time you try to mount it. It can take a long time between the kernel loading the driver and probing the bus, and the drive being ready -- it could be seconds for magnetic disks. But even if it's only milliseconds, it could be too long.
I don't know if there's a nice solution to this problem using OpenRC. In the past I've just mounted the disk using an init script with a time delay before the mount. It's not very elegant. I, too, would like to know if there's a nicer way.
BR, Lars. |
|
Back to top |
|
|
iNeedIT n00b
Joined: 10 Aug 2024 Posts: 13
|
Posted: Wed Aug 14, 2024 11:09 am Post subject: |
|
|
lars_the_bear wrote: | It looks to me as if the drive isn't in a settled state by the time you try to mount it. It can take a long time between the kernel loading the driver and probing the bus, and the drive being ready -- it could be seconds for magnetic disks. But even if it's only milliseconds, it could be too long.
I don't know if there's a nice solution to this problem using OpenRC. In the past I've just mounted the disk using an init script with a time delay before the mount. It's not very elegant. I, too, would like to know if there's a nicer way.
BR, Lars. |
Thanks. Init script has resolved the mount problem.
Template for anyone:
Code: |
GNU nano 8.0 /etc/init.d/mount_pendrive
#!/sbin/openrc-run
depend() {
after localmount
}
start() {
ebegin "Mounting pendrive as /home/anon"
# Replace these variables with your actual values
PARTUUID="FILL IT"
MOUNTPOINT="also this"
FILESYSTEM="and this"
# Attempt to mount the partition
mount -t $FILESYSTEM PARTUUID=$PARTUUID $MOUNTPOINT
if [ $? -eq 0 ]; then
eend 0 "Pendrive mounted successfully"
else
eend 1 "Failed to mount pendrive"
fi
}
stop() {
ebegin "Unmounting pendrive from /home/anon"
umount /home/anon
eend $?
}
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|