LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Problems with mounting drive at boot (https://www.linuxquestions.org/questions/debian-26/problems-with-mounting-drive-at-boot-4175532993/)

hiero 02-03-2015 10:16 PM

Problems with mounting drive at boot
 
Hi,

I have problems with mounting my second drive at boot.
(sorry i am a noob)

When i use the mount command like this:

Code:

mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2
My drive is mounted, the problem is that after a reboot it isnt any more.

I already tryed to add to fstab with.
Code:

nano /etc/fstab
Code:

/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults,errors=remount-ro 0 1
also tryed to add this line.

Code:

UUID=553afede-fa45-4cdc-9972-c0a9aa899509 /mnt/HD/HD_b2 ext3 errors=remount-ro 0 1
But this didnt work, after reboot fstab is empty (normal??)

When i open /etc/mtab

Code:

rootfs / rootfs rw 0 0
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,relatime 0 0
proc /proc proc rw,relatime 0 0
squash /usr/local/tmp ramfs rw,relatime,size=38m 0 0
/dev/loop0 /usr/local/modules squashfs ro,relatime 0 0
/dev/mtdblock5 /usr/local/config jffs2 rw,relatime 0 0
/dev/sda4 /mnt/HD_a4 ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw,relatime,errors=continue 0 0
none /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda2 /mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/sda2 /mnt/HD/HD_a2/squeeze/mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/root /mnt/HD/HD_a2/squeeze/mnt/root ext2 rw,relatime,errors=continue 0 0
/dev/root /mnt/HD/HD_a2/squeeze/dev ext2 rw,relatime,errors=continue 0 0
sysfs /mnt/HD/HD_a2/squeeze/sys sysfs rw,relatime 0 0
proc /mnt/HD/HD_a2/squeeze/proc proc rw,relatime 0 0

Output of blkid:

Code:

/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sda2: UUID="09e0e365-0aa6-4214-b571-2bc6b027fd9f" TYPE="ext3"
/dev/sda4: UUID="64038414-136c-4939-bd14-9871a20290bd" TYPE="ext3"
/dev/sdb1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sdb2: UUID="553afede-fa45-4cdc-9972-c0a9aa899509" TYPE="ext3"
/dev/sdb4: UUID="bf594be6-ffb6-469d-a3a8-246be66a4d90" TYPE="ext2"
/dev/md0: TYPE="swap"

I have a NAS (DNS-325) where i installed debian squeeze on via this tutorial.

The funny thing is, i already installed it this way 2 years a go, had to reinstall (becaus i F* up trying stuff ;-) ) Then i got it to work, but dont remember how i solved it. Already spent a lot of hours trying to solve it.

Hope you guys can help me out.

widget 02-04-2015 10:19 AM

Simple things first.

Does the directory /mnt/HD/HD_b2 exist?

Run;
Code:

ls /mnt/HD
To find out.

I ask because it is a common error.

Myself, seeing how you have only 6 partitions, I would not have a /mnt/HD directory at all.

I would first; label all partitions; second have a directory in /mnt of each of them.

Labels like 1a, 1b, 2a, 2b and so on. Giving you /mnt/1a, /mnt/1b, etc.

Usual practice has drives and such mounted in /media but that is up to you. My /mnt is pretty much mount points for chroot environments.

And as I have never used raid I will admit things could well be done differently when that is being used.

veerain 02-04-2015 10:51 AM

Quote:

Originally Posted by hiero (Post 5311607)
Hi,

I have problems with mounting my second drive at boot.
(sorry i am a noob)

When i use the mount command like this:

Code:

mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2
My drive is mounted, the problem is that after a reboot it isnt any more.

I already tryed to add to fstab with.
Code:

nano /etc/fstab
Code:

/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults,errors=remount-ro 0 1
also tryed to add this line.

Code:

UUID=553afede-fa45-4cdc-9972-c0a9aa899509 /mnt/HD/HD_b2 ext3 errors=remount-ro 0 1
But this didnt work, after reboot fstab is empty (normal??)

When i open /etc/mtab

Code:

rootfs / rootfs rw 0 0
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,relatime 0 0
proc /proc proc rw,relatime 0 0
squash /usr/local/tmp ramfs rw,relatime,size=38m 0 0
/dev/loop0 /usr/local/modules squashfs ro,relatime 0 0
/dev/mtdblock5 /usr/local/config jffs2 rw,relatime 0 0
/dev/sda4 /mnt/HD_a4 ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw,relatime,errors=continue 0 0
none /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda2 /mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/sda2 /mnt/HD/HD_a2/squeeze/mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeback,usrquota,grpquota 0 0
/dev/root /mnt/HD/HD_a2/squeeze/mnt/root ext2 rw,relatime,errors=continue 0 0
/dev/root /mnt/HD/HD_a2/squeeze/dev ext2 rw,relatime,errors=continue 0 0
sysfs /mnt/HD/HD_a2/squeeze/sys sysfs rw,relatime 0 0
proc /mnt/HD/HD_a2/squeeze/proc proc rw,relatime 0 0


But /etc/mtab shows the second partition of second hard drive /dev/sdb2 as mounted.

hiero 02-04-2015 10:51 AM

Quote:

Originally Posted by widget (Post 5311909)
Simple things first.

Does the directory /mnt/HD/HD_b2 exist?

Yes, i can mout the drive with the mount command, and explore it, so it does exist.

Quote:

Run;
Code:

ls /mnt/HD
To find out.

I ask because it is a common error.
root@dlink:/mnt/HD# ls
HD_a2 HD_b2



And for the stucture, you are right, but its just consmetic, dont have to work a lot on this NAS. And i am the only 1 that use it (home).

And thanks for the fast replay.

hiero 02-04-2015 11:04 AM

Quote:

Originally Posted by veerain (Post 5311932)
But /etc/mtab shows the second partition of second hard drive /dev/sdb2 as mounted.

Yes, i know, but that line doesnt, give me a mounted device, i need to use the mount command, and when i look ate the /etc/mtab again, it looks like this, check last line.

Code:

rootfs / rootfs rw 0 0
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,relatime 0 0
proc /proc proc rw,relatime 0 0
squash /usr/local/tmp ramfs rw,relatime,size=38m 0 0
/dev/loop0 /usr/local/modules squashfs ro,relatime 0 0
/dev/mtdblock5 /usr/local/config jffs2 rw,relatime 0 0
/dev/sda4 /mnt/HD_a4 ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw,relatime,errors=continue 0 0
none /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda2 /mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sda2 /mnt/HD/HD_a2/squeeze/mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,u$
/dev/root /mnt/HD/HD_a2/squeeze/mnt/root ext2 rw,relatime,errors=continue 0 0
/dev/root /mnt/HD/HD_a2/squeeze/dev ext2 rw,relatime,errors=continue 0 0
sysfs /mnt/HD/HD_a2/squeeze/sys sysfs rw,relatime 0 0
proc /mnt/HD/HD_a2/squeeze/proc proc rw,relatime 0 0
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw 0 0


Hungry ghost 02-04-2015 02:12 PM

Quote:

Originally Posted by hiero (Post 5311607)
after reboot fstab is empty (normal??)

That's not normal; it should properly save the changes you make to it. However, I'm not sure why it happens.

Silly question: are you sure you're saving the file properly after you edit it? BTW, when you say it's empty, you mean the file is completely blank or only the line for this partition has been removed? And one more thing, could you post your complete fstab file here?

veerain 02-04-2015 02:48 PM

Quote:

/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
See this hiero. It means it's already mounted. If you mount again it would show a new line displaying it in last line.

Did you checked for files and directories in /mnt/HD/HD_b2 before trying manual mount?

hiero 02-04-2015 04:51 PM

Quote:

Originally Posted by odiseo77 (Post 5312066)
Silly question: are you sure you're saving the file properly after you edit it? BTW, when you say it's empty, you mean the file is completely blank or only the line for this partition has been removed? And one more thing, could you post your complete fstab file here?

When i edit the fstab file, i save it and open it again, to see if it did save, so that one is true, it saves.

Its completely blank. Want to upload the file (fstab) but attachment(site) doesnt let me, but it realy compleetly empty, if i for example put in a compleetly wrong line in the fstab file on purpose, and i type mount -a , i get a error, [mntent]: line 1 in /etc/fstab is bad

So i think fstab is in the right location/ name.


Quote:

Originally Posted by veerain (Post 5312088)
See this hiero. It means it's already mounted. If you mount again it would show a new line displaying it in last line.

Did you checked for files and directories in /mnt/HD/HD_b2 before trying manual mount?

Yes

Code:

root@dlink:~# cd /mnt/HD/HD_b2
root@dlink:/mnt/HD/HD_b2# ls
root@dlink:/mnt/HD/HD_b2#

Then i do this

Code:

root@dlink:~# mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2
After this i get
Code:

root@dlink:/mnt/HD/HD_b2# ls
Data  dir1  Untitled.png  dir2  temp  dir3  dir4
root@dlink:/mnt/HD/HD_b2#

This is the content of my second drive.
Note: i changed real dir names here to dir1,dir2,dir3,dir4

selfprogrammed 02-04-2015 11:07 PM

Wild guess, you may be trying to mount as a user, so you need user permission in the options.
/etc/fstab
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,user,errors=remount-ro 0 1

hiero 02-05-2015 10:16 AM

Quote:

Originally Posted by selfprogrammed (Post 5312304)
Wild guess, you may be trying to mount as a user, so you need user permission in the options.
/etc/fstab
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,user,errors=remount-ro 0 1

This also didnt work, add your line to fstab, checked if it saved, mount -a, didnt do any thing, also reboot didnt, after reboot fstab was empty again.

Is there a work around that i just use the following mount command at boot? putting it in a script some where?

mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2

because above command works after boot, on the command line, then the partition is mounted

Edit:

I have edit
/boot/linuxrc
i put following line in it
/etc/init.d/mediaservers.sh
in mediaservers.sh i put the following line
su root -c "mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2"

(mediaservers.sh is were i start program's)


now after a reboot the partition is mounted.....

But can i call this a solve? (for this topic) because it solved it for me

Hungry ghost 02-05-2015 11:31 AM

Quote:

Originally Posted by hiero (Post 5312156)
When i edit the fstab file, i save it and open it again, to see if it did save, so that one is true, it saves.

Its completely blank. Want to upload the file (fstab) but attachment(site) doesnt let me, but it realy compleetly empty, if i for example put in a compleetly wrong line in the fstab file on purpose, and i type mount -a , i get a error, [mntent]: line 1 in /etc/fstab is bad

So i think fstab is in the right location/ name.

I'm surprised your system even boots with a blank fstab file. Could you post the output of the following command?:

Code:

cat /etc/fstab

hiero 02-05-2015 12:11 PM

Quote:

Originally Posted by odiseo77 (Post 5312591)
I'm surprised your system even boots with a blank fstab file. Could you post the output of the following command?:

Code:

cat /etc/fstab

Code:

root@dlink:/etc/openvpn# cat /etc/fstab
root@dlink:/etc/openvpn#


widget 02-05-2015 01:14 PM

OK, I'll bite.

Why;
Code:

root@dlink:/etc/openvpn#
?

Just exactly what system are you using? This is a Debian version?

What does your user ($) terminal have to say if you just open it normally? Should look similar to;
Code:

sam@lounge:~$
Assuming it does the run, from the $ prompt;
Code:

cat /etc/fstab

hiero 02-05-2015 01:53 PM

Quote:

Originally Posted by widget (Post 5312654)
OK, I'll bite.

Why;
Code:

root@dlink:/etc/openvpn#
?

Just exactly what system are you using? This is a Debian version?

What does your user ($) terminal have to say if you just open it normally? Should look similar to;
Code:

sam@lounge:~$
Assuming it does the run, from the $ prompt;
Code:

cat /etc/fstab

Debian GNU/Linux 7


i found the problem.... sorry i am a noob at this.

I am using a NAS DNS-325

in order to run somthing els then the standaard browser, i installed fun_plug , this comes with a file (fun_plug) that you put on your root of you NAS to started

Fun_plug allows the user to start additional programs and tools on the NAS. A Berlin-based developer named “Fonz” created a package called “ffp” (Fonz fun_plug), which includes the script and some extra software which can be invoked by fun_plug.

After i installed Fonz fun_plug, i used this to install debian, this requered a other fun_plug file on my harddisk. After this i updated it to Debian 7.

I totally forgot about that file (fun_plug), this file is responsible for the problems i had, because it rm fstab, and makes a empty fstab.

Code:

#!/bin/sh

# Root DISK1
export DISK1=/mnt/HD/HD_a2
export DISTDIR=squeeze

cd $DISK1

mount --bind $DISK1 $DISTDIR$DISK1
mount --bind / $DISTDIR/mnt/root
mount --bind /dev $DISTDIR/dev
mount --bind /sys  $DISTDIR/sys
#mount --bind /sys/crfs $DISTDIR/sys/crfs
#mount --bind /web $DISTDIR/web
mount --bind /proc $DISTDIR/proc

cp -f /proc/mounts $DISTDIR/etc/mtab
rm -f $DISTDIR/etc/fstab
touch $DISTDIR/etc/fstab
cp -f /etc/resolv.conf $DISTDIR/etc
hostname >$DISTDIR/etc/hostname
cp -f /etc/hosts $DISTDIR/etc

$DISK1/$DISTDIR/boot/chroot $DISK1/$DISTDIR /boot/linuxrc

so problem found.... sorry i am new at this.(yea a newbie)

for
root@dlink:/etc/openvpn#

I am trying to get openvpn to work, so after your question, i run your command, while i was busy with openvpn, thats why you see me in that dir.

Thanks for the help!!!! (all you guys)

widget 02-05-2015 04:39 PM

Did you install nas from that site or from the Wheezy repo?

While this "fun_plug" sounds interesting it would be a better policy to just use packages from the Debian repos. This will give you less trouble and allow you to learn in an unbroken system.

On the other hand;
A> it is your box
B> you learn a lot in a broken system and it is more exciting


All times are GMT -5. The time now is 11:13 AM.