How to mount hard drives automatically after booting?

Booting, installing, newbie
Message
Author
selvam
Posts: 145
Joined: Tue 03 Dec 2013, 12:29

How to mount hard drives automatically after booting?

#1 Post by selvam »

how to mount hard drives automatically after booting with out giving mount command

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: How to mount hard drives automatically after booting?

#2 Post by Moose On The Loose »

selvam wrote:how to mount hard drives automatically after booting with out giving mount command
You can put the mount command in a script in the Startup directory. The script will get run when the GUI is up and going. I am going to code without testing here

Code: Select all

#!/bin/bash
# I assume you can compose $PART and $OPTIONS
#
if ! grep $PART /etc/mtab ; then
  mount $OPTIONS /dev/$PART /mnt/$PART
  fi

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Hello, selvam.

Here is a little script that will do that, and a couple of satellites to it. One satellite checks
if you have the necessary folders in /mnt to receive the mounts; the second one checks
if /etc/fstab is duly populated. Very first time this script is run, it might take a couple of
seconds; after that, you don't perceive it.

How-to:
Create a folder named Systeme in /root/my-applications, unpack them in /root/my-
applications/Systeme. Make them executable and make a link from MonterPartitions3.sh
to the /root/Startup folder.

Then, re-start X -- through the menu or from the initial black console, with

Code: Select all

xwin < name of your window manager >
(i.e. xwin jwm, or xwin openbox)
All your partitions should be mounted now.

After that, a link being in /root/Startup, it lauches itself automatically at each session.

Code: Select all

#!/bin/sh
# (avec awk)
# ~/my-appl*/Systeme/MonterPartitions3.sh
# Objet : Monter partitions non iso9660, non USB
# Purpose : Mount non iso9660 & non USB partitions
# musher0, 13-12-13
####
function monte {
CMNDS="/tmp/cmnds.sh"
LST="/tmp/lstPrt"
probepart|awk -F"/" '{ print $3 }' > $LST
awk -F"|" '$2 ~ /ext|vfat/ { print "mount -t "$2" /dev/"$1" /mnt/"$1 }' $LST > $CMNDS
awk -F"|" '$2 ~ /ntfs/ { print "ntfs-3g /dev/"$1" /mnt/"$1 }' $LST >> $CMNDS
chmod ug+rwx $CMNDS
$CMNDS
# cleanup
rm $CMNDS
rm $LST
# echo "All partitions have been mounted."
}

# Checks
[ "`ls -d /mnt/sd*`" = "" ] && ~/my-applications/Systeme/rep-dans-mnt.sh
# This script will create missing partition folders (/mnt/sd*) in /mnt, if any are missing.

[ "`wc -l /etc/fstab | cut -d' ' -f1`" -lt 7 ] && ­~/my-applications/Systeme/Create-fstab.sh &
# This script completes the /etc/fstab, if not already populated. (It never is on a new Puppy.)

# If everything is already mounted, we simply pass. 
[ "`cat /proc/mounts | grep 't/[s,h]' | wc -l`" -lt "`probepart | egrep 'ext|vfat|ntfs' | wc -l`" ] && monte
I hope this fits the bill. Please let me know.

If not, MuppyQuickMount also puts a "mount all partitions" script in /root/Startup once
installed. It needs a BASIC language installed, though, plus, depending on your Puppy
version, the blkid utility may need to be enhanced.

BFN.

musher0

~~~~~~~~~~~
PS. The remarks in the scripts are in French. If puzzled, please see translations above.
Attachments
MountAtStartup.zip
(2.07 KiB) Downloaded 320 times
Last edited by musher0 on Tue 07 Jan 2014, 16:35, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Almost forgot...

If you have an ntfs partition on your system, you'll need the ntfs-3g utility.
You can test if you have this utility in your Puppy by typing in console:

Code: Select all

which ntfs-3g
You should get: /bin/ntfs-3g as an answer.

If no answer (that is: just the usual prompt), you'll need to install it.
But again, only if you have an ntfs drive on your system.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#5 Post by Puppus Dogfellow »

can't find the thread at the moment, but there's also startmount 0.5.5, which gives you a gui...

it'll automount what you tell it to look for, but i'm not sure it will automount drives it hasn't already been made aware of.


edit: thread

selvam
Posts: 145
Joined: Tue 03 Dec 2013, 12:29

#6 Post by selvam »

thanks for all the help

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Hello, all.

Here's an update to the post above at:
http://murga-linux.com/puppy/viewtopic. ... 413#749286

This script will mount all available partitions on your hard drives and inform you of it
automatically in French or in English depending on the LANG variable.

It will also check if the partition folders in /mnt reflect the number of HD partitions and if
fstab is properly populated; if not, it will call secondary scripts to do those jobs.

If the partitions are already mounted, it does nothing, and simply passes to the next
script in /root/Startup.

It work very well here, I've been using it without problems for the past few months.
Let me know of any quirks on your Puppy? Thanks.

Enjoy!

musher0

~~~~~~~~~~~~~
N.B. The "Create-fstab" sub-script requires < replaceit > as a dependency.
< replaceit > can be found at http://www.pldaniels.com/replaceit
Attachments
MountPartitions-4.pet
(2.41 KiB) Downloaded 422 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

In order to automount partitions I have been using the muppyquickmount .pet here:
http://murga-linux.com/puppy/viewtopic. ... 315#745315

Musher0 - would you recommend your pet above instead of muppy quick mounter?

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#9 Post by darkcity »

Puppus Dogfellow wrote:can't find the thread at the moment, but there's also startmount 0.5.5, which gives you a gui...

it'll automount what you tell it to look for, but i'm not sure it will automount drives it hasn't already been made aware of.


edit: thread
Its also listed on the wiki
http://puppylinux.org/wikka/Startmount

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

greengeek wrote:In order to automount partitions I have been using the muppyquickmount .pet here:
http://murga-linux.com/puppy/viewtopic. ... 315#745315

Musher0 - would you recommend your pet above instead of muppy quick mounter?
Hi, greengeek.

hehe. That's like asking a father if his son is more intelligent than the neighbour's!
Of course he is! 8)

But if I try to be impartial, I'd say:
* use my script if you want to:
-- mount ALL hard drive partitions in one fell swoop at startup AND
-- you want to properly populate your Puppy fstab file (like it should in any Linux) AND
-- you want to make sure that your partition folders in /mnt match the usable partitions
on your disk(s).

AFAIK, my script is the only one that mounts all partitions AND checks that the other
elements of the mounting environment are ok.

OR

* use the StartMount utility if you want to:
-- selectively mount one or two partitions only at startup. (My script doesn't allow a
selection.)

AND

* use the UPDATED MuppyQuickMount as well -- but remove its startup script in
/root/Startup
-- to replace Puppy's default mounter (this is the killer argument, IMO).
-- Whatever your choice above, the updated MQM is much faster than the default
Puppy mounter and its layout is much clearer (again, IMO).

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

Hello, all.

Just a slight change: the 2nd yaf-splash message moved from true centre to SE of
screen to avoid overlap with 1st message.

BFN.

musher0
Attachments
MountPartitions-4a.pet
(2.41 KiB) Downloaded 391 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

tmm2112
Posts: 12
Joined: Sat 25 Aug 2012, 04:54

#12 Post by tmm2112 »

I would like to use this startmount, but I cant find it in the pet directory.

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#13 Post by Puppus Dogfellow »

tmm2112 wrote:I would like to use this startmount, but I cant find it in the pet directory.

Startmount-0.0.5

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#14 Post by rufwoof »

Check whether Menu, Filesystem, PMount has an option to set auto mount at start up (when you right click on the drive/partition)
Attachments
i1.jpg
(56.45 KiB) Downloaded 1169 times
i2.png
(45.04 KiB) Downloaded 1194 times

tmm2112
Posts: 12
Joined: Sat 25 Aug 2012, 04:54

#15 Post by tmm2112 »

That's interesting. My version of Pmount is quite different. I'm using Puppy Precise and the Pmount application is much more simple. It does not give options for auto mounting.

I have looked in the repositories but no other version of Pmount is there, nor is the Startmount there. This seems like a very solvable problem but I'm not getting anywhere with it.

For anyone who could help, I'm trying to set up an automount of a partition on my hard drive. I've tried scripts but they only produce a momentary mount that goes away seconds after bootup.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#16 Post by musher0 »

tmm2112 wrote:(...)

For anyone who could help, I'm trying to set up an automount of a partition on my hard
drive. I've tried scripts but they only produce a momentary mount that goes away seconds
after bootup.
Hello, tmm2112.

Strange... All suggestions presented in the posts above "stick" until you deliberately
unmount the partition(s). Maybe review your steps?

Just a thought. BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

sheldonisaac
Posts: 902
Joined: Mon 22 Jun 2009, 01:36
Location: Philadelphia, PA

#17 Post by sheldonisaac »

Some snipping was done.
tmm2112 wrote:I'm using Puppy Precise..

For anyone who could help, I'm trying to set up an automount of a partition on my hard drive. I've tried scripts but they only produce a momentary mount that goes away seconds after bootup.
I'll try a Precise to see what I can do, and get back to edit this.

===============

Sorry, didn't succeed.

I booted what I think is Precise 5.7.1 from my sda2 partition, with pfix=ram on the kernel GRUB menu line.
Made a directory /mnt/sda3
Edited /etc/rc.d/rc.local to include

mount -t vfat /dev/sda3 /mnt/sda3

Rebooted (made a savefile on the sda2 boot drive)

The mounting of sda3 did not occur after the reboot.

Don't know why; I vaguely recall that someone helped in the past with a better version of mount or probepart or blkid or ???

Hang in there; someone more knowledgeable will come and help.
Dell E6410: BusterPup, BionicPup64, Xenial, etc
Intel DQ35JOE, Dell Vostro 430
Dell Inspiron, Acer Aspire One, EeePC 1018P

tmm2112
Posts: 12
Joined: Sat 25 Aug 2012, 04:54

#18 Post by tmm2112 »

Puppus Dogfellow wrote:
tmm2112 wrote:I would like to use this startmount, but I cant find it in the pet directory.

Startmount-0.0.5
I somehow missed this post before, but I downloaded the pet, installed and
it worked! Much thanks, pupps dogfellow.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#19 Post by rufwoof »

musher0 wrote:Hello, selvam.

Here is a little script that will do that....
Hi Musher0,

Not working for me :cry:

Clean prefix=ram boot, only mounts those partitions that have previously been mounted during the session. When I manually run

# ./rep-dans-mnt.sh

No /mnt/s[d,r]* directory seem to be missing.



Listing the contents of /mnt I see

# ls /mnt
cdrom data dvd flash floppy msdos ram1 sda1 sda4 swap zip
#

My sda2 and sdb1 partitions are left unmounted.

I believe the relevant part of the version of your code that I'm running for the above is

Code: Select all

if [ "`ls -d /mnt/s[d,r]*`" = "" ];then
	probepart | awk -F"|" '$2 ~ /ext|ntfs|vfat|iso/ { print $1 }' | awk -F"/" '{ print "mkdir -p /mnt/"$3 }' > /tmp/DIRS
	chmod ug+rwx /tmp/DIRS
	/tmp/DIRS
	echo
	echo "$NOTANYMORE"
	echo
	else
		echo
		echo "$NOTMISSING"
		echo
fi
probepart returns

# probepart
/dev/sda1|vfat|67584
/dev/sda2|ntfs|345608192
/dev/sda3|swap|4083712
/dev/sda4|ext4|40960000
/dev/sdb1|ntfs|78140096
/dev/sr0|iso9660|261056
/dev/sr1|none|2097150

(Running Slacko 5.3.3t)

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#20 Post by rufwoof »

What I personally have in mind for wanting all auto-mounted is so that I might include a HD file (script) as part of the startup.

Boot from read only CD/DVD (pfix=ram), that mounts all drives and if a file xyz.sh exists in any of the root directory of the HD partitions then run that script (extension of Startup directory contents). So a RAM boot - available 'disk' space is all of the available memory (1.5GB in my case), but with some additional automated tuning possible (optional load of load nvidia.sfs, flash.sfs etc - or not, according to whether that's set in the xyz HD script).

Post Reply