3

How does PCManFM know where to mount a drive? I have an external drive /dev/sdb1/ whose mount point I would like to change from /media/Media to /media/external, but I'm not sure how to tell PCManFM to do this. I could just turn off auto-mounting in PCManFM and do it via fstab, but then I'd have to hit S when booting without the drive connected.

Is there a file where PCManFM sets the mountpoints so it remembers them for the future?

Sophie
  • 190
  • 1
    You can try fstab with the nobootwait option, look at this answer http://askubuntu.com/questions/120/how-do-i-avoid-the-s-to-skip-message-on-boot – TuKsn May 06 '14 at 09:32

3 Answers3

3

Normally PCManFM mounts partitions to /Media/Username/Partition-Label. If you change the partition label it will then mount under the new name.

Eg: /Media/Username/Example could be changed to /Media/Username/Changed.

Steps:

Step #1

In PCManFM unmount the partition for your external drive by clicking the unmount icon.

screenshot1

Step #2

Go to the main menu, accessories, and click Disks.

screenshot2

Step #3

In Disks click on your device (from left hand side menu), then under volumes click on the partition so it's highlighted, and then click the cog beneath it and choose "edit filesystem".

screenshot3

screenshot4

Step #4

Change the partition label as desired, and click "change".

screenshot5

Step #5

Re-open PCmanFM and you will see it mounted under the new name.

screenshot6

Screenshot links are dead.

ravery
  • 6,874
mango
  • 101
0

I wrote this script to make my sd-card mount to my chosen mount point when mounting my device inside pcmanfm.
It applies equally to Thunar.

When you see
/run/media/$USER/3456-7890/
in pcmanfm (or thunar) 3456-7890 is the mount point pcmanfm is using.

This can be changed.

This "3456-7890" number is not randomly generated or invented somehow by pcmanfm.

It is a property of the device being mounted. In this case an sd-card.

If the sd-card disk is formatted as

  • exfat, "3456-7890" is the disk label on the sd-card and this is where pcmanfm takes this number from
  • ext3 or ext4, "3456-7890" is the disk UUID, on the sd-card and this is where pcmanfm takes this number from

If you use
sudo blkid
at the command line with your sd-card/ device mounted you will see this information for yourself.

The script I wrote below changes the default disk label, or UUID, of the sd-card/ your device to your chosen disk 'ID' and is fairly self explanatory.

Run it from the top, bit by bit, until you can see what it is doing.

#!/bin/bash

clear screen

clear

my existing disk label or UUID

Change this to your existing mount point

grab it from pcmanfm or from using blkid at the command line

current_UUID="3456-7890" # sd-card in T440s laptop #current_UUID="3434-3533" # sd-card in T430 laptop

set the new desired disk ID here

this will be the new mount point after you run the script

new_UUID="SDC-256GB"

install e2fsprogs if not already installed

if ! pacman -Qq e2fsprogs >/dev/null 2>&1; then sudo pacman -S e2fsprogs else echo; echo "e2fsprogs is already installed"; echo fi

install util-linux-libs if not already installed

if ! pacman -Qq util-linux-libs >/dev/null 2>&1; then sudo pacman -S util-linux-libs else echo; echo "util-linux-libs is already installed"; echo fi

see the UUID and mount points of all devices

echo;echo;echo " ... all devices info shown below ..." sudo blkid echo; echo

show our sd card, all information

echo; echo " ... our device only ..." sudo blkid | grep "$current_UUID" echo; echo

get the mount point of the device

echo; echo " ... the actual mount point of our device ... " sudo blkid | grep "$current_UUID" | grep -oE "^.:" | sed 's/://g' mpd="$(sudo blkid | grep "$current_UUID" | grep -oE "^.:" | sed 's/://g')"

echo; echo "... the mount point we need to use to change the UUID..." sudo blkid | grep "$current_UUID" | grep -oE "^.:" | sed 's/p1://g' | sed 's/p0://g' mpdc="$(sudo blkid | grep "$current_UUID" | grep -oE "^.:" | sed 's/p1://g' | sed 's/p0://g' )"

echo

unmount or make sure our device is unmounted

sudo umount $mpd

echo; echo "... changing the UUID"

file_system_type="$(blkid | grep $current_UUID | grep -oE "TYPE="[a-zA-Z0-9]{1,20}"" | sed 's/TYPE="//g' | sed 's/"//g')"

if [[ "$file_system_type" = "ext4" ]] || [[ "$file_system_type" = "ext3" ]]; then

 # for ext3 and ext4 file systems

 # set the new UUID to be specific
 sudo tune2fs "$mpd" -U "$new_UUID"

 # set the new UUID to be random
 #### sudo tune2fs "$mpd" -U random

fi

echo;

if [[ "$file_system_type" = "exfat" ]]; then

 # for exfat file systems
 sudo exfatlabel "$mpd" "$new_UUID"

fi

mount the disk

make dir "$new_UUID" if it did not already exist

sudo mkdir -p /run/media/$USER/"$new_UUID";

moiunt the disk

sudo mount /dev/"$mpd" /run/media/$USER/"$new_UUID"

test to check it worked

echo; echo " ... this should show new UUID ..." blkid | grep "$new_UUID" echo; echo

Kes
  • 121
0

If you want to change this using a GUI utility, for a device with an exfat filesystem

(this may also work for devices with ext4 and ext3 filesystems)

  1. Install gnome-disk-utility

on arch linux
sudo pacman -S gnome-disk-utility

on debian based distributions such as ubuntu
sudo apt-get install gnome-disk-utility

  1. Open the utility called "disks" from the gui menu.
    With the Openbox window manager it is under the Settings sub-menu
    --> menu --> Settings --> Disks

a. Select the device you want to change the mount ID for.

b. Now select the partition on the device usually the main partition you want to change the ID for.
You will know you have selected the right partition because you will find the ID that pcmanfm is mounting your device with eg "3456-7890"

c. Click the gear icon in the panel

d. Click Edit filesystem. You will now see label: "3456-7890".
Change it to your desired mount point ID and click OK.

Kes
  • 121