How to automount a hd partition at boot?

Booting, installing, newbie
Post Reply
Message
Author
User avatar
chris667
Posts: 31
Joined: Tue 01 Apr 2008, 13:41

How to automount a hd partition at boot?

#1 Post by chris667 »

What's the most elegant way to make sure a partition on my hard drive is mounted every time I start Puppy?
User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#2 Post by CatDude »

Hello chris667
chris667 wrote: What's the most elegant way to make sure a partition on my hard drive is mounted every time I start Puppy?
I don't know about the most elegant way, but here is what i normally do.

On partition hdb2 (sdb2 with the newer kernels) i have all of my Downloads, Pictures, docs etc

So i create a directory called: dudesdata in /root of whatever Puppy i use,
then i open /etc/rc.d/rc.local in a text editor and enter the following command:

Code: Select all

mount /dev/hdb2 /root/dudesdata
changing the hdb2 to sdb2 if the Puppy is a version with the newer kernel.

Now whenever i boot into Puppy, that partition is automatically mounted,
all i need to do is click on the directory dudesdata and i am in partition hdb2 ( or sdb2)

Hope this helps
CatDude
.
Image
User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#3 Post by DaveS »

Create a little script to mount the partition, then put the script in /root/Startup. This way, the script will run each time you boot. Here is the script I use to mount sda3

#!/bin/sh
if [ ! -d /mnt/sda3 ]
then
mkdir /mnt/sda3
fi
mount -t ext3 /dev/sda3 /mnt/sda3

If you are not sure how to create an executable script, just add a request for info here.
Spup Frugal HD and USB
Root forever!
User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#4 Post by Béèm »

CatDude wrote:Hello chris667
chris667 wrote: What's the most elegant way to make sure a partition on my hard drive is mounted every time I start Puppy?
I don't know about the most elegant way, but here is what i normally do.

On partition hdb2 (sdb2 with the newer kernels) i have all of my Downloads, Pictures, docs etc

So i create a directory called: dudesdata in /root of whatever Puppy i use,
then i open /etc/rc.d/rc.local in a text editor and enter the following command:

Code: Select all

mount /dev/hdb2 /root/dudesdata
changing the hdb2 to sdb2 if the Puppy is a version with the newer kernel.

Now whenever i boot into Puppy, that partition is automatically mounted,
all i need to do is click on the directory dudesdata and i am in partition hdb2 ( or sdb2)

Hope this helps
CatDude
.
Interesting.
But I suppose you have a /mnt/hdb2 already, so the mount statement on /mnt/hdb2 could be put directly in rc.local.

But I did a test.
sdb1 was already mounted on /mnt/sdb1.
I created a /root/my-data and gave in a console a mount of sdb1 to my-data.
To my surprise this worked.
So I am now with /dev/sdb1 mounted at two different mounting points.
Is this normal?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#5 Post by Béèm »

DaveS wrote:Create a little script to mount the partition, then put the script in /root/Startup. This way, the script will run each time you boot. Here is the script I use to mount sda3

#!/bin/sh
if [ ! -d /mnt/sda3 ]
then
mkdir /mnt/sda3
fi
mount -t ext3 /dev/sda3 /mnt/sda3

If you are not sure how to create an executable script, just add a request for info here.
Nice idea of code.
I have been looking for something like this.
I have an external HDD which has a partition sdb1.
At boot it isn't mounted but visible on the desktop.
A program needs the partition mounted and sometimes I forget to see if it is.
So I have been trying to find a way to test if the partition is mounted (on /mnt/sdb1) and if not mount it.
I didn't succeed even when trying the idea of your code.
I am not familiar with scripting I must say.

Do you have an idea how to do this?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
aarf

#6 Post by aarf »

DaveS wrote:Create a little script to mount the partition, then put the script in /root/Startup. This way, the script will run each time you boot. Here is the script I use to mount sda3

#!/bin/sh
if [ ! -d /mnt/sda3 ]
then
mkdir /mnt/sda3
fi
mount -t ext3 /dev/sda3 /mnt/sda3

If you are not sure how to create an executable script, just add a request for info here.
thanks dave
i have my opera in solitary confinement on it's own partition because, perhaps only when in cahoots with my very naughty internal card reader, it is a known past corrupter of files. so this automount at boot is very nice.
for Beem here is my altered script for comparison and as an additional example

Code: Select all

#!/bin/sh 
if [ ! -d /mnt/sdb2 ] 
then 
mkdir /mnt/sdb2
fi 
mount -t ext2 /dev/sdb2 /mnt/sdb2 

 
here also is another on the topic so perhaps more ideas/examples to get you going there http://www.murga-linux.com/puppy/viewto ... b2118e4ff9
Post Reply