Categories
Tech

Set XBMC to Automount Drives

Whenever I install XBMC, one of the first settings I change is I enable auto mounting of drives. It’s a relatively simple change, but requires you modify a file on the filesystem.

For Ubuntu Lucid 10.04:

I’ve noticed that it’s not necessary to manually remove the nodiskmount option on 10.04 (grub2). The modifications that I used to make in /boot/grub/menu.lst on Ubuntu Karmic, I now have to make in /etc/default/grub on Ubuntu Lucid.. When I removed the nodiskmount on Ubuntu Lucid I started having some issues with the disks being mounted in odd ways (eg. my NTFS drive being mounted directly to /media). What I found is that instead of removing nodiskmount, if I just properly labeled my partitions, they would automatically show up properly — you can label your partitions using the e2label command.

As I noted in the comments below, you may still need to remove nodiskmount in Ubuntu Lucid to get your eSATA drive to mount (especially true for people who followed my Revo 1600 guide). What I found is that because the internal drive on the Revo 1600 is NTFS, it will cause the weird issues I mentioned above. If you happen to fall into this case, I would highly recommend you check out my article on Drives Being Mounted with Odd IDs. The article explains how to find the unique identifier (UUID) for your drive and manually create an FSTAB entry to mount your drive with your specifications each time the system loads. Now that I’ve wrapped my head around how FSTAB works, I prefer to use this method as it lets me set my own unique name, path, and other settings for how the drive is mounted.

However, if you’d still like to modify the grub parameters for other reasons, I’ve included the details below…

Open the file /etc/default/grub:

sudo nano /etc/default/grub

Find the line for loading your system (usually starts with GRUB_CMDLINE_LINUXDEFAULT) and make sure it’s not the commented out line that often comes default at the top of the file. Modify this line so it no longer has the nodiskmount option in it.

Save the file and close it. Ctrl+O, Enter, Ctrl+X.

Run the following line to update grub and then reboot:

sudo update-grub sudo reboot

For Ubuntu Karmic:

If you are still booting from the XBMC-Live 9.11 Camelot USB stick directly, this will be in the syslinux.cfg file. If you have installed XBMC to disk, this is in the /boot/grub/menu.lst file. 

To remove this flag from the menu.lst file, telnet into the XBMC machine (use the instructions from the sabnzbd install post if you don’t know how), then open up the file with your favorite editor:

sudo nano /boot/grub/menu.lst (you may have to enter your root username and password — typically xbmc / xbmc)

Arrow down to the first line under “## ## End Default Options ##” near the bottom of the file and on the “kernel” line arrow to the right until you see the “nodiskmount” text. Delete this text then press Ctrl+O [enter] to save the file then Ctrl+X to exit. Reboot your box and you should now see some new items in your file manager usually named something like sdb1 or sda1.

Categories
Tech

Determine Hard Disk Free Space from Shell

I have always noticed that when people ask the question ‘How do I figure out how much hard drive space I have left’ as it relates to the Linux / *nix shell, people always respond telling people to use the following command:

df

Output:

$ df Filesystem           1K-blocks      Used Available Use% Mounted on /dev/sdb5             56870784  22222576  31759324  42% / ... /dev/sda1               252960    122460    130496  49% /media/sda1 /dev/sda3            1441394492 1372242748  69151740  96% /media/sda3 

In the above example, everything is hard to read since it’s in units of one thousand bytes. On some systems this defaults to multiples of 512 bytes unless you specific the -k option. I’m surprised that they don’t mention that if you add one simple switch (-h for human readable), you can make the output much easier to read on most systems:

df -h

Output:

$ df -h Filesystem            Size  Used Avail Use% Mounted on /dev/sdb5              55G   22G   31G  42% / ... /dev/sda1             248M  120M  128M  49% /media/sda1 /dev/sda3             1.4T  1.3T   66G  96% /media/sda3 

In the above example, you can see that I’ve used 1.3 terabytes of my main system drive, leaving me with 66 gigabytes free.

Side Note: You can also find out what file system type you are using by running the following command:

df- T

And it will produce the following results:

Filesystem    Type   1K-blocks      Used Available Use% Mounted on /dev/hdb1     ext3    19228276  14737848   3513680  81% / tmpfs        tmpfs      383960         4    383956   1% /dev/shm

(The second column is the type)

Categories
Tech

Setup Samba/Windows Shares on XBMC Live

It’s relatively easy to setup samba shares on XBMC Live, but it does require bashing out some commands on the shell. First, you’ll need to install samba using apt-get:

sudo apt-get update sudo apt-get install samba

Then, you’ll want to configure your shares by editing the the file named smb.conf, placed in the /etc/samba/ directory. For example, I added the user folder and media folders to be available shares by running the following command:

sudo nano /etc/samba/smb.conf

Scroll down all the way to the bottom of the file, then paste in the following (use right click in Putty to paste something from your clipboard):

[xbmc]  path = /home/xbmc  public = yes  guest only = yes  writable = yes  browseable = yes  force user = xbmc  inherit permissions = yes  [media]  path = /media  public = yes  guest only = yes  writable = yes  browseable = yes  force user = xbmc  inherit permissions = yes

After that, restart the samba server using:

sudo /etc/init.d/samba restart

Update: It looks like this has changed in the more recent versions of Ubuntu that the XBMC Live distribution is packaged with (10.04). You can restart the samba service using the old method:

sudo service smbd restart sudo service nmbd restart

Note: I updated the samba configuration above to include the ‘force user’ and ‘inherit permissions’ features as I was having trouble with newly created files not getting the right permissions and logging into samba.

Also, when accessing the shares from Windows, if you left the default security options you can use the account ‘guest’ with no password to access the shares. Otherwise, you can play with the settings to force a local linux account to be used in order to access the shares.

Categories
Tech

Howto:Change Server Shell Port

I saw this great post on SharkSpace by Amanda about how to change your server’s shell port. It said it was part of the dedicated server guide, but I thought it was good for people with VPSs (Virtual Private Servers) as well. Here’s the post:

1) Login to shell via root.

2) Open the shell configuration file.

nano -w /etc/ssh/sshd_config

 

3) Change port.

Uncomment and change

#Port 22

to look like:

Port 6472 (choose your own 2 to 5 digit port number (49151 is the highest port number)

 

4) Save and exit.

Ctrl + X + Y

 

5) Restart shell. (Make sure if you have a firewall installed that you have the new port unblocked.)

/etc/rc.d/init.d/sshd restart