Head-Fi.org › Forums › Equipment Forums › Computer Audio › Linux question
New Posts  All Forums:Forum Nav:

Linux question

post #1 of 15
Thread Starter 

I have Ubuntu Karmic. I chose to install it with an encrypted home directory.

Recently I got a warning that I only had 2GB of drive space left. This is mostly because of my music. So I went and bought a new hard drive and partitioned it and made 1 ext4 partition and copied my music all to the new hard drive. I can run sudo mount /dev/sdb music/ and it will mount fine and I can see all my music.

I added a line in my fstab to mount the new hard drive to ~/music, but when I reboot the computer, there is a screen saying something like "error mounting /home/me/music, press S to skip or ESC to reboot".

If I press S to skip, then when my system comes up there is a music directory but it's empty because my other hard drive didn't get mounted., so why can't fstab mount it? Does this have something to do with my encrypted home directory, or permissions?

post #2 of 15

Is this a NAS or a attached hard drive?

 

For my NAS I use this in a script.

 

sudo mount -t smbfs -o noserverino,ro,username=admin,password=password //192.168.1.5/share/Music /media/External_Music

 

For regular attached storage it always just mounted the USB Hard drive by itself every time I booted up.  But if you use fstab there will be something similar in the line as far as username and password. 

post #3 of 15
Quote:
Originally Posted by trains are bad View Post

I have Ubuntu Karmic. I chose to install it with an encrypted home directory.

Recently I got a warning that I only had 2GB of drive space left. This is mostly because of my music. So I went and bought a new hard drive and partitioned it and made 1 ext4 partition and copied my music all to the new hard drive. I can run sudo mount /dev/sdb music/ and it will mount fine and I can see all my music.

I added a line in my fstab to mount the new hard drive to ~/music, but when I reboot the computer, there is a screen saying something like "error mounting /home/me/music, press S to skip or ESC to reboot".

If I press S to skip, then when my system comes up there is a music directory but it's empty because my other hard drive didn't get mounted., so why can't fstab mount it? Does this have something to do with my encrypted home directory, or permissions?


So you are mouting your second drive /dev/sdbx (where x is the partition number) to ~/music.  Do you already have a ~/music folder with files in it before mounting your other hard disk into that folder.  Are you specifying the partition in /etc/fstab (/dev/sdbx) or just the drive (/dev/sdb)?

post #4 of 15
Thread Starter 
Quote:
Is this a NAS or a attached hard drive?

 

It's just another hard drive hooked up via SATA, internally.

 

Quote:
For regular attached storage it always just mounted the USB Hard drive by itself every time I booted up.

 

Yeah, but Ubuntu always mounts it to like /media or somewhere like it's removable storage, and I want it mounted right to my home directory as if I had one big hard drive. Even if it was USB, I would want to mount it to ~/music.

post #5 of 15
Thread Starter 
Quote:
Originally Posted by deadspider187 View Post




So you are mouting your second drive /dev/sdbx (where x is the partition number) to ~/music.  Do you already have a ~/music folder with files in it before mounting your other hard disk into that folder.  Are you specifying the partition in /etc/fstab (/dev/sdbx) or just the drive (/dev/sdb)?

I have a ~/music folder, but there's nothing inside it. I'm pretty sure I said /dev/sdb1 but maybe I just said /dev/sdb. I can definitely mount /dev/sdb1 using the 'mount' command.
 

post #6 of 15

Maybe a problem of permissions, if not you should use dmesg in a terminal or see in /var/log, especially /var/log/messages and /var/log/syslog to find out what's wrong. I don't think it's right to mount your partition in /home, you should make a dir in /, something like /music or /mnt/music.

 

To be sure you always mount the same partition in the same directory, I suggest you use uuid in your /etc/fstab, see this page.

 

For example in my /etc/fstab the old line and the new one:

 

# /dev/sda5       /media/data1    ext3    defaults        0       2
UUID=f73ce1f7-981a-4392-a1c9-8f587558e457       /media/data1    ext3    defaults        0       2

post #7 of 15
Thread Starter 

 

I think I've decided the problem is caused my my encrypted home directory. I think that until I log on, the system cannot mount anything to my home directory because until I log in, my home directory is not decrypted to the rest of the system. Thus fstab can't mount the other hard drive there because it doesn't exist until I log in. This is lame. Is there some way I can add the mount command to a script that runs when I log in, at least?

 

Quote:
I don't think it's right to mount your partition in /home, you should make a dir in /, something like /music or /mnt/music.

 

Why? I really wanted to be able to mount the new hard drive to ~/music because I have a HTPC that shares that directory, and I have scripts that reference that location and everything. I just ran out of hard drive space so I was going to mount an entire new partition to ~/music. I was going to have fstab mount it to ~/music and everything would be seamless. If I had LVM I could just add this HDD to the volume, but I don't know if you can LVM with encryption either...

post #8 of 15
Quote:
Originally Posted by trains are bad View Post

 

I think I've decided the problem is caused my my encrypted home directory. I think that until I log on, the system cannot mount anything to my home directory because until I log in, my home directory is not decrypted to the rest of the system. Thus fstab can't mount the other hard drive there because it doesn't exist until I log in. This is lame. Is there some way I can add the mount command to a script that runs when I log in, at least?

 

I don't know when login in console, but when starting X you have xsession, and some desktops (KDE, Gnome, Xfce) use .desktop files in the autostart directory.

 

I don't think it's right to mount your partition in /home, you should make a dir in /, something like /music or /mnt/music.

 

Why? I really wanted to be able to mount the new hard drive to ~/music because I have a HTPC that shares that directory, and I have scripts that reference that location and everything. I just ran out of hard drive space so I was going to mount an entire new partition to ~/music. I was going to have fstab mount it to ~/music and everything would be seamless. If I had LVM I could just add this HDD to the volume, but I don't know if you can LVM with encryption either...

Maybe I'm wrong, but does it mean you can use an mpd server with an encrypted directory ?
 

post #9 of 15

Why not just let Ubuntu mount the music in the /media directory and create a symbolic link to that directory?

 

ln -s /media/[whatever] ~/music

 

When I used mpd with a attached external hard drive it too was mounted in the /media directory.  For me I just added the path to the /media/.....

 

I think you are trying to go the forcible route, pretty sure you can link any folder with stuff to any other folder, just as long as permissions are right.


Edited by Dynobot - 8/26/10 at 3:08pm
post #10 of 15
Thread Starter 

 

Quote:
Why not just let Ubuntu mount the music in the /media directory and create a symbolic link to that directory?

 

Aha! A symbolic link would solve my problem most handily. I'm not sure if Ubuntu will mount my SATA hard drive to /media or not...that's where it mounts USB drives...but anyway, I can change my fstab line to /music and then just make a link from ~/music to it.


Edited by trains are bad - 8/27/10 at 2:18pm
post #11 of 15

That is the GREAT thing about Linux/Unix, there is a way to do anything you can imagine.

 

post #12 of 15
Quote:
Originally Posted by trains are bad View Post

 

 

Aha! A symbolic link would solve my problem most handily. I'm not sure if Ubuntu will mount my SATA hard drive to /media or not...that's where it mounts USB drives...but anyway, I can change my fstab line to /music and then just make a link from ~/videos to it.


Where does it usually mount to? I've always had my external drives, mp3 players, usb, etc mount at /media/device name

post #13 of 15
Thread Starter 

Same here, with external drives, usb, etc. I think the times I've booted my system with this drive plugged into the other SATA port, it didn't do anything with it at all (it was unmounted). I know I had no trouble manually mounting it to my home directory, and I think mount warns you if it's mounted some other place.

post #14 of 15
Quote:
Originally Posted by trains are bad View Post

 

 

I'm not sure if Ubuntu will mount my SATA hard drive to /media or not...that's where it mounts USB drives...but anyway, I can change my fstab line to /music and then just make a link from ~/music to it.

See my message above, I have a partition mount with /etc/fstab in /media. It is some sort of rule now to mount removable devices in /media, it was not 5-6 years ago with hotplug, they were mounted in /mnt and it was not so easy to use USB with Linux.

 

I just noticed in the first post you use sudo for mounting manually you partition, which means you have the same rights as root for executing the command, after mounting your SATA drive with /etc/fstab check you can write and read the partition as a user.
 

post #15 of 15

Here is my /etc/fstb

 

...........................................

 

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=637ff76a-66fa-4f92-b724-b0a9a90cfcdf /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=fd27c1df-a244-4d58-b480-2445a58fcf7d none            swap    sw              0       0

 

..........................

 

you will need to cd into  /media  then cd into whatever Ubuntu is now calling your disk.

Then issue the command ...... blkid -o value -s UUID

 

Good thing about terminals now a days is you do not need a pen and paper to put it into gedit or pico, nano, vim or whatever.... you can cut and paste the result directly to your opened sudo gedit /etc/fstab.

 

If you formatted the drive as a single partition then the correct value to assess with blkid is the drive as there is only one partition on the drive and you will have no boot sector. If you have allocated multiple partitions on your second hard drive then this will change accordingly. For example there can be up to four primary partitions 0, 1, 2, or 3... if you chose to do it another way and use an extended partition system then all bets are off.

 

After you find the UUID= for this drive you then need to add it to /etc/fstab with the correct permissions and a usable mount point to accomplish what you are trying to do. Otherwise Ubuntu will treat it as any other removable device and it will not even show up in fstab...which is not that bad a thing.

 

None of what you are trying to do can be accomplished except with sudo. Or if you choose to boot into a root shell and then startx you can still do it as root with guis but it is a royal PITA...Oh for good old Slackware and simple easy config files this gui crap gives me the trottsrolleyes.gif

 

It is possible to copy existing directories to a separate drive and then mount that drive as a /home or whatever but this requires a complete rewrite of /etc/fstab and will be much easier if you just re-install and do it all at install time.

 

I have even set up a different 256 meg swap on a dedicated drive in the past using scsi drives to improve swap performance on a pentium1 back when drives were tiny...like 1-2 gig max, and 128 meg of server ram was about $1000 bucks Canadian! Heck I remember that One gig scsi cost me over 200 bucks.

New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Computer Audio
Head-Fi.org › Forums › Equipment Forums › Computer Audio › Linux question