Differences

This shows you the differences between the selected revision and the current version of the page.

technology:unix:lms:linux_log 03.16.2010 21:31 technology:unix:lms:linux_log 03.18.2013 04:30 current
Line 43: Line 43:
====== Bittorrent and Large RAID test files downloaded ====== ====== Bittorrent and Large RAID test files downloaded ======
 +
====== AFP and Avahi for Apple filesharing ====== ====== AFP and Avahi for Apple filesharing ======
 +Instructions modified from:
 +  * http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/
 +  * http://plugcomputer.org/plugwiki/index.php/AFP
 +
===== Install Netatalk ===== ===== Install Netatalk =====
 +  * Netatalk install <code>sudo apt-get install netatalk</code>
 +    * I used to have to install this manually because it did not formerly come with the correct crypto options. Now, this is included in the latest netatalk install. Info from [[http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/#comment-86412|here]].
 +    * Setting up netatalk (2.2~beta4-1) ...
 +
===== Config Netatalk (AFP) ===== ===== Config Netatalk (AFP) =====
 +  * Which daemons to run?
 +    * edited /etc/default/netatalk
 +    * <code>
 +        ATALKD_RUN=no
 +        PAPD_RUN=no
 +        CNID_METAD_RUN=yes
 +        AFPD_RUN=yes
 +        TIMELORD_RUN=no
 +        A2BOOT_RUN=no</code>
 +  * Set various settings for afp daemon
 +    * edited /etc/netatalk/afpd.conf
 +    * <code>
 +        - -transall -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -savepassword -advertise_ssh</code>
 +    * - says that this line applies to the default afpd server; you could, optionally, have more than one, with names in place of this dash
 +    * -transall uses all protocols, tcp, udp, ddp (could also optionally choose any one or mix of these)
 +    * -uamlist sets user auth modules to use; [[http://www.trollop.org/2011/03/06/netatalk-afp-mac-os-x-10-7-lion/|uams_dhx2.so]] is needed for OSX Lion
 +    * -savepassword allows clients to save the pass locally; can also be -nosavepassword
 +    * -advertise_ssh allows afp encrypted and sent over a ssh session; assumes sshd is setup and running correctly; not advised by netatalk [[http://netatalk.sourceforge.net/2.0/htmldocs/afpd.conf.5.html|docs]]
 +
 +
===== Config Shared Volumes ===== ===== Config Shared Volumes =====
 +  * Set what to share and to whom
 +    * edited /etc/netatalk/AppleVolumes.default
 +    * <code>
 +        /media/documents LinuxMediaServer allow:nyeates,shyeates,shyeates513 cnidscheme:cdb options:usedots,upriv
 +      </code>
 +      * allow: usernames that can login to the afp server; needs to be defined users I think
 +      * cnidscheme: use dbd; cdb doesnt work anymore on netatalk 2.1+
 +      * options: usedots: allow proper .blah files; upriv: afp3 unix privs - do not use if you have OS X tiger
 +  * Restarted Apple Files Server
 +    * <code>sudo /etc/init.d/netatalk restart</code>
 +
 +  * Test connectivity
 +    * Go over to mac computer on same network
 +    * In finder, hit Ctrl+K
 +    * Type in "afp://lms" and hit connect
 +      * lms is the dns name of my server; could also use IP address
 +    * Type in auth info - user and pass
 +    * It should load and show mount options (if more than one mount was defined in AppleVolumes.default)
 +    * Files and directories should load and show
 +
===== Install Avahi (Bonjour) ===== ===== Install Avahi (Bonjour) =====
 +  * Avahi install <code>sudo apt-get install avahi-daemon</code>
 +  * Other needed package?? <code>sudo apt-get install libnss-mdns</code>
 +    * both already installed !!
 +  * edited /etc/nsswitch.conf
 +    * added "mdns" to "hosts:" line
 +    * <code>hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns</code>
 +
 +
===== Config Avahi and advertise services ===== ===== Config Avahi and advertise services =====
 +  * edited /etc/avahi/services/afpd.service
 +    * inserted XML: "port 548"
 +    * <code>
 +        <?xml version="1.0" standalone='no'?><!--*-nxml-*-->
 +        <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 +        <service-group>
 +        <name replace-wildcards="yes">%h</name>
 +        <service>
 +        <type>_afpovertcp._tcp</type>
 +        <port>548</port>
 +        </service>
 +        <service>
 +        <type>_device-info._tcp</type>
 +        <port>0</port>
 +        <txt-record>model=Xserve</txt-record>
 +        </service>
 +        </service-group></code>
 +  * Restarted Avahi Daemon
 +    * <code>sudo /etc/init.d/avahi-daemon restart</code>
 +    * <code>sudo restart avahi-daemon</code>
 +
===== Test on Macs ===== ===== Test on Macs =====
==== Worked Perfect! ==== ==== Worked Perfect! ====
 +2-2.5 MBps transfers! Yay
 +
====== RAID monitor commands ====== ====== RAID monitor commands ======
Line 1258: Line 1338:
==== With Zenoss ==== ==== With Zenoss ====
==== Test ==== ==== Test ====
 +
Line 1266: Line 1347:
Possibility to use [[http://allmydata.org|tahoe fs]] and [[http://github.com/divegeek/GridBackup/tree/master|GridBackup]] as a backup medium for a friendnet. Hadoop and HDFS are possibilities too. <del>ZFS</del> is out of the running. Possibility to use [[http://allmydata.org|tahoe fs]] and [[http://github.com/divegeek/GridBackup/tree/master|GridBackup]] as a backup medium for a friendnet. Hadoop and HDFS are possibilities too. <del>ZFS</del> is out of the running.
 +
 +===== CrashPlan =====
 +Found out that this service is not just cloud-based only but allows backup amongst computers for free and it runs on linux and mac and win. I could use this to backup to other locations like Rolands or my parents.
 +
 +Installed CrashPlan and got following post-install info:
 +<code>
 +CrashPlan has been installed and the Service has been started automatically.
 +
 +Press Enter to complete installation.
 +
 +Important directories:
 +  Installation:
 +    /usr/local/crashplan
 +  Logs:
 +    /usr/local/crashplan/log
 +  Default archive location:
 +    /media/documents/Backups/CrashPlanBackups
 +
 +Start Scripts:
 +  sudo /usr/local/crashplan/bin/CrashPlanEngine start|stop
 +  /usr/local/crashplan/bin/CrashPlanDesktop
 +
 +You can run the CrashPlan Desktop UI locally as your own user or connect
 +a remote Desktop UI to this Service via port-forwarding and manage it
 +remotely. Instructions for remote management are in the readme files
 +placed in your installation directory:
 +  /usr/local/crashplan/doc
 +</code>
 +
 +
 +====== RIP: LMS - Server Died ======
 +Sometime in Spring or Summer of 2011, the lms servers hardware died. I tried many things to try to get it responsive. I think it was the motherboard that died, as it wouldnt even post or beep. Nothing. CMOS Battery removal didnt do anything.
 +
 +I determined that to continue, I would need a replacement motherboard with same model, or to start on a whole new machine. Replacement Mobos were a bit expensive. I actually am thinking that I want to move off of the lms server and onto the mac mini so that it makes it easier and more integrated. This means that I do not want to spend too much money fixing this so that I can then immediately move to a different solution.
 +
 +====== New Server ======
 +I ended up getting a new HP mini tower computer from my dads work. It did not have 3 SATA ports. I bought a decent Promise SATA card online for like 50 or 60 bucks. I installed the card and then didnt touch the machine for months.
 +
 +Now at end of Oct, I have finally got the new machine hooked up and running in Bellas room. I had to try a few different hard drives on the main OS one to assure that it was a quite one. It was the large 320 GB HDD.
 +
 +===== New OS install =====
 +Put Ubuntu 11.10 on a USB stick (they have an awesome site and UX now! and the previews of their OS looks nice!) Also other have told me that it has improved much. They were right! I installed form the usb stick fine onto the 320 GB disk.
 +
 +===== Initial Server Setup =====
 +I immediately updated all advised updates in the UI. Took maybe 12 mins.
 +
 +I got openssh running on it with
 +
 +<code>
 +sudo apt-get install openssh-server
 +</code>
 +
 +I used the GUI-based disk util to see the various disks. All 3x 1TB disks show.
 +I also looked at their SMART status. All disks good except one.
 +WARNING: One of the 1TB drives has had some bad sectors.
 +
 +==== Raid startup ====
 +I want to get the raid array up and going asap.
 +
 +Following notes at [[http://nickyeates.com/technology/unix/raid_filesystem_lvm]] I found that I had to install mdadm:
 +<code>
 +apt-get install mdadm
 +</code>
 +It went into a curses mode to install Postfix, the mail transport agent. I told it:
 +  * Internet-based email
 +  * lms.loc (changing /etc/mailname to lms.loc)
 +
 +Started up existing raid array:
 +<code>
 +mdadm --verbose --assemble /dev/md0 /dev/sd[bcd]1
 +
 +mdadm: looking for devices for /dev/md0
 +mdadm: /dev/sdb1 is identified as a member of /dev/md0, slot 1.
 +mdadm: /dev/sdc1 is identified as a member of /dev/md0, slot 2.
 +mdadm: /dev/sdd1 is identified as a member of /dev/md0, slot 0.
 +mdadm: added /dev/sdb1 to /dev/md0 as 1
 +mdadm: added /dev/sdc1 to /dev/md0 as 2
 +mdadm: added /dev/sdd1 to /dev/md0 as 0
 +mdadm: /dev/md0 has been started with 3 drives.
 +</code>
 +
 +Looks good:
 +<code>
 +cat /proc/mdstat
 +
 +md0 : active raid5 sdd1[0] sdc1[2] sdb1[1]
 +      1953519872 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
 +</code>
 +
 +Mounted the raid array:
 +<code>
 +mkdir /media/documents
 +mount -t ext3 /dev/md0 /media/documents/
 +</code>
 +
 +Edited /etc/fstab:
 +<code>
 +# raid5 mdadm filesystem
 +/dev/md0        /media/documents ext3  defaults        0      2
 +</code>
 +
 +Went into mounted dir and its all there! Yay!
 +
 +
 +====== Got AFP and Bonjour equivalents running ======
 +See [[#afp_and_avahi_for_apple_filesharing|above section]] that I updated on this
 +
 +====== Dubugging dir list slowness ======
 +In using the AFP shares on mac mini for movies with plex media server, I noticed that the directory listing was molasses slow.
 +Also, the entire 'movies' dir wouldnt load at all after some time.
 +
 +I started digging into log files and people with similar problems.
 +
 +Error log for Netatalk, the AFP daemon:
 +  tail -f /media/documents/.AppleDB/db_errlog
 +
 +This file was giving same error over and over:
 +
 +  cnid2.db/cnid2.db: DB_SECONDARY_BAD: Secondary index inconsistent with primary
 +  Finding last valid log LSN: file: 2 offset 7783453
 +  Recovery starting from [2][7782965]
 +  Recovery complete at Tue Mar  6 17:17:04 2012
 +  Maximum transaction ID 80000004 Recovery checkpoint [2][7783453]
 +
 +Users [[http://forums.freebsd.org/showthread.php?t=20324|here]] had similar issues and they basically were deleting their entire CNID databases (the database that keeps track of IDs -> file names. They were then restarting. Another set of information [[http://netatalk.sourceforge.net/2.1/htmldocs/configuration.html#CNID-backends|under the official Netatalk docs]] explained about this CNID db and how it operates, what its role is, and about a new command:
 +  dbd -s .
 +
 +The -s scans. -r rebuilds what the scan finds.
 +
 +I decided I would move the /media/documents/.AppleDB dir (same as deleting it), and rebuild.
 +
 +I shutdown netatalk
 +moved .AppleDB
 +ran a cnid rebuild
 +  dbd -r /media/documents/
 +
 +The above command started checking and writing new CNIDs for every single file. Tons of lines flew by, one for each file it seemed.
 +
 +45 mins of CNID rewrites, and it stops. I now start up netatalk. Logs and db seem to clear out from new.
 +
 +Initial directory loads take a bit of time still, but once they are loaded, they are cached and fast.
 +
 +
 +====== Move data to Mac Mini Server ======
 +I want to get all of the data on this linux server over to a mac server, held on our current mac mini that will come from the living room. Now that we have 2 apple TV devices, we dont need the mac mini as a TV device in living room, freeing it for server use. My hope is that 1) I dont have to mess with such low level stuff and piecing together 10 open source components when setting up hard drives and file shares and bonjour, etc 2) So that Sue can more easily modify or restart or understand the data on this server.
 +
 +===== Plan =====
 +Purchased a 3 TB HDD, and a USB enclosure that can take 4 drives.
 +
 +  - Plug this enclosure in, with the 3TB drive in it, into the Linux Media Server.
 +  - Format and mount the 3 TB drive on LMS, now we have the 2 TB raid and 3 TB hdd
 +  - Copy the files over to 3 TB hdd
 +    - check that copy is correct
 +  - Install mac mini and get server edition running on it (cheap app store purchase)
 +  - Bring 3TB hdd over to mac mini (via usb enclosure), mount it,
 +    - check that files show
 +    - check that streaming is fast enough
 +  - Start Backblaze backup immediately
 +  - Unplug 3 x 1TB drives from LMS, slide them into USB enclosure on mac mini
 +  - Format the 3 x 1TB drives into a mac raid-jbod (just a bunch of disks)
 +    - there is no fault tolerance here, but i will setup a backup solution via backblaze or the likes
 +  - Copy the files from 3 TB hdd to 3 x 1 TB raid-jbod
 +  - Format the 3 TB hdd on mac mini
 +  - Add the 3 TB hdd into the raid-jbod array, to create a 6TB JBOD array
 +  - Install menu-bar utility that allowed SMART monitoring status and emails
 +
 +===== Format and Mount 3 TB as UDF =====
 +Read an article that I should try UDF file system, so that when I take it to the mac, it can still be read natively. Ubuntu/linux also can format it. Little did I know, there was a bit of researched needed to format and mount it on linux.
 +
 +Turns out UDF does not use normal MBR (master boot record) at the begining of the disk. It does its own thing, and you just gobble up the entire disk. So I messed with partitions at first, without knowing I didnt need to. Instead, it is good to first clear the MBR at the start of the disk, and then format with udftools on ubuntu. See commands below.
 +
 +sudo dd if=/dev/zero of=/dev/sde bs=512 count=1
 +sudo mkudffs --media-type=hd --blocksize=512 /dev/sde
 +
 +Got the info from here:
 +  - http://superuser.com/questions/39942/using-udf-on-a-usb-flash-drive/
 +  - http://superuser.com/a/567559/110601
 +  - http://superuser.com/questions/526174/what-unix-like-filesystem-can-easily-and-safely-be-mounted-on-both-the-mac-and-l/
 +
 +When I look at the drive capacity though, with `df -h` it says the drives size is 747G. Not 3 TB :-(
 +
 +I could still test the 3TB UDF drive on the mac mini to see if it mounts and has files on it.
 
technology/unix/lms/linux_log.1268789504.txt.gz · Last modified: 12.13.2010 00:15 by 173.59.243.26
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki