Raspberry Pi Losing Mounted Drive After Reboot - raspberry-pi

Brand new to the world of Pi - like so new that I had never even touched one until three days ago, and know very little about Linux... I have a Western Digital MyBook plugged directly into my router, and I've found I'm able to mount this as a drive with the following command:
sudo mount -t cifs -o user=yourusername,passwd=yourpasswd,rw,file_mode=0777,dir_mode=0777 //mybookIP/public /mnt/mybook
Unfortunately, it seems to drop this mount whenever I reboot. Anyone have a suggestion on how to make this permanent?

Based on the comments here, this is what I did:
First, in Terminal I ran:
sudo nano /etc/fstab
Once that was opened, I added the line:
//mbookIP/public /mnt/mybook cifs _netdev,username=yourusername,password=yourpasswd 0 0
Once I saved this I was able to reboot and the mounted drive was visible when it all loaded back up again.

Related

Rsnapshot filepermission problem with network hdd over raspberry pi

After trying to solve this for days, I want to ask for help here:
I want to make backups with rsnapshot, which usually runs on a server and manages local backups. In my case, I want to run rsnapshot on my computer and let rsnapshot manage my backups on an externel harddrive. This externel harddrive is connected to my raspberry pi and mounted to my computer with following command:
sudo sshfs -o default_permissions,allow_other,idmap=user,IdentityFile=/home/user/.ssh/id_rsa pi#192.168.0.1:/mnt/externelHdd /mnt/backupHdd
Here, /mnt/backupHdd is the local root for rsnapshots backup directory.
Additionally, I want to connect the external harddrive directly to my computer for bigger backup jobs. For this purpose I wrote a script, which mounts the external harddrive either locally or over network with upper command. Afterwards, it starts the rsnapshot job with sudo rsnapshot daily. When the harddrive is connected locally, everthing works fine. When it's connected over sshfs, I get permission denied errors.
Rsnapshot apperently is not allowed to manage files per sshfs, when the files/directories were created with physical connection (different users: local and rasppi). I tried to solve this with the option allow_other and idmap=user but I think there is more to do. So Im asking you guys: How can I give permissions to rsnapshot?
Thanks for any help!
edit:
I get the following error:
/bin/cp: cannot create directory '/mnt/backupHdd/daily.1': Permission denied
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot daily
----------------------------------------------------------------------------
ERROR: /bin/cp -al /mnt/backupHdd/daily.0 /mnt/backupHdd/daily.1 failed (result 256, exit status 1).
ERROR: Error! cp_al("/mnt/backupHdd/daily.0/", "/mnt/backupHdd/daily.1/")
daily.0 was created when the hdd was connected to my local computer. daily.1 should be created with my hdd mounted over sshfs.
I'm assuming your running rsnapshot as root and root owns the remote backup directory. This command:
sudo sshfs -o default_permissions,allow_other,idmap=user,IdentityFile=/home/user/.ssh/id_rsa pi#192.168.0.1:/mnt/externelHdd /mnt/backupHdd
Is not going to work out as I think you are intending. Even though you are using sudo on the local side of the connection, your still SSH-ing in as "pi" meaning everything done on the far side of the connection is done by the user pi. No option to sshfs can change this fact. You'd need to enable root login and then ssh in as root, or at least some user that has full R/W access to that drive.

mount: unknown filesystem type 'vmhgsf'

I'm trying to mount my windows shared folder in centOS using command:
~mount -t vmhgfs .host:/shared-folder /var/www/html/
Unfortunatelly I get :
~monut: unknown filesystem type 'vmhgfs'
error. I tried to use:
~/usr/bin/vmhgfs-fuse /mnt
but mountpoint is not empty...
Is there any way to mount this folder on VMware player?
Cyb
Try this:
vmhgfs-fuse .host:/shared-folder /var/www/html/
you might need to use sudo on this
Working from a MacBook Pro running Big Sur and using VMware to host the virtual machine with CentOS 7 operating system. Had issues with loading in shared folders after VMware tools were installed. What worked for me is to use this exact command:
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
Hope this saves others the trouble of tracking down this solution.
The below is working perfectly fine for me. Might be useful for someone.
Already I have mapped the required folders in "SharedFolder" settings. But it was not showing up.
Additionally running this command shares the windows directories.
sudo /usr/bin/vmhgfs-fuse .host:/ /home/user/win -o subtype=vmhgfs-fuse,allow_other

How can I Increase Memory of Beaglebone Black?

everyone. I have been trying to increase the memory of my BleagleBone Black rev c without success.
I have followed these instructions in order to increase the memory of my BBB with a 16GB microSD card. I have already tried burning 2 different images Debian 9.1 2017-08-31 4GB SD LXQT and Debian 8.7 2017-03-19 4GB SD LXQT (without flashing the eMMc) .
The steps that I have been using are listed below.
What I first did was to burn the image into the microSD card using
Etcher.
Then I inserted the microSD into the BBB, I pushed the boot button
and then I plugged it into my computer to turn it on.
After that, I logged into my BBB using ssh and I checked for the
Debian version and it was correct. Indicating that the boot from the
microSD card was correct, but when I tried to check disk space I
couldn´t find the partition for the microSD.
As you can see in the image below it is supposed to show the rootfs where I have the new BBB image and the 16GB extra space, but I´m not able to see the extra partition. Does anyone know what I could be possibly doing wrong?
I am facing with the same issue and I end up with
Login to your BBB by ssh
Run this command
nano grow_partition.sh
copy code from here then paste it on the terminal
save file by pressing control + o then enter
Exit from nano editor by pressing control + x
Run this command sudo ./grow_partition.sh
Reboot BBB
Enjoy :)
I have a beaglebone black (original with 512MB mem) and I was able to use a different method to add swap memory successfully (unfortunately user3680704's method didn't work for me).
I got the idea from this post which basically says the following:
You can check your current memory with
free -h
And you can create the swap memory by running these commands. Again a more detailed better explanation is in the link above, but in case that ever goes dead you can follow these:
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Next open the fstab file by running
vi /etc/fstab
and add the following line to the file
/swapfile swap swap defaults 0 0
You can then check your swap by running
swapon --show
This worked well for me, added 1G of swap. You can add more or less by changing the 1G value

Assigning mountpoints per USB port

I'm using a Raspberry Pi Zero W running Raspbian Jessie Lite. I have a Zero4U 4 port USB hub (it's permanently attached) I'm looking to assign a mountpoint to each USB port, so that any drive plugged into port 1 will always use the mountpoint /media/backup for example. Is this possible?
Thanks
Found the solution!
First, plug in a drive to the port you want to map a mountpoint to. Use sudo blkid to get the /dev/sd** path to the drive & note this down/remember it. I'll be using '/dev/sda1'
Second, use udevadm info --name=/dev/sda1 | grep disk/by-path, which should give you a readout something like:
S: disk/by-path/platform-20980000.usb-usb-0:1.3:1.0-scsi-0:0:0:0-part1
E: DEVLINKS=/dev/disk/by-id/usb-SanDisk_Cruzer_Switch_4C530001110415101044-0:0-part1 /dev/disk/by-label/BACKUP_1 /dev/disk/by-path/platform-20980000.usb-usb-0:1.3:1.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/5936-F7EA
It's the platform-20980000.usb-usb-0:1.3:1.0-scsi-0:0:0:0-part1 that we want. It might look fairly different depending on your device & hub. Copy it/note it down then open up fstab config sudo nano /etc/fstab and on a new line:
/dev/disk/by-path/platform-20980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part1 /media/card exfat auto,nofail,noatime,users,rw,uid=pi,gid=pi 0 0
replace /media/card with the mountpoint you desire, and make sure the bit following /dev/disk/by-path/ matches what you copied earlier. The other options are variable depending on what you want.
Ctrl-X, Y, enter, to save fstab, then reboot and you should now have an auto-mounting usb port! You can repeat the previous steps for each port :)
Hope this helps anyone looking to do the same.

Run commands on Raspberry Pi when external HDD is connected

I am using a Raspberry Pi to provide network access to a Western Digital media player that has no network interface. The player if just an external HDD and automatically mounts when it is connected.
The problem is that it's HFS formatted, so to be able to read and write it I have to unmount and then remount it with these commands:
sudo umount /dev/sda2
sudo mount -o force -t hfsplus /dev/sda2 /media/wdhdd/
Which works fine, but I don't want to have to SSH in via terminal to run these manually every time I reconnect the HDD.
Is there anyway to auto run a script when an external USB device is mounted?
Because this has to be done every time this USB device is plugged in, you should edit the procedures done when it is plugged in. You can find out more about this by visiting this explanation