Friday, October 9, 2015

mount s3 on linux

Steps:
# yum remove fuse fuse-s3fs
# yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap
# wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz
# tar xvfs fuse-2.9.3.tar.gz
# cd fuse-2.9.3
# ./configure --prefix=/usr/local
# make
# make install
# yum install fuse-libs

# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# ldconfig
# modprobe fuse

# wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz
# tar -xvf s3fs-1.74.tar.gz
# cd s3fs-1.74
# ./configure --prefix=/usr/local
# make
# make install

[root]# mkdir /s3logs

At this point create a new user in AWS IAM, download the accesskey and secret key.
Make sure you grant this user the access to S3 bucket.


[root@pgvmdc s3]# cat s3_access_key
AWSAccessKeyId=XXXXXXXXXXXXXXXX
AWSSecretKey=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

[root@pgvmdc s3]# echo XXXXXXXXXXXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY  > ~/.passwd-s3fs

[root@pgvmdc s3]# chmod 600 /root/.passwd-s3fs

[root@pgvmdc s3]# cat ~/.passwd-s3fs
XXXXXXXXXXXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

[root@pgvmdc s3]# mkdir /tmp/cache
[root@pgvmdc s3]# chmod 777 /tmp/cache/
[root@pgvmdc s3]# chmod 777 /s3mnt/



[root]# s3fs -o use_cache=/tmp/cache logserver  /s3logs
fuse: warning: library too old, some operations may not not work

[root@pgvmdc s3]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2       25G  7.8G   16G  34% /
tmpfs           497M     0  497M   0% /dev/shm
/dev/xvda1      248M   82M  154M  35% /boot
s3fs            256T     0  256T   0% /s3logs


Add this to fstab
/etc/fstab
s3fs#logserver /s3logs fuse allow_other,use_cache=/tmp/cache 0 0


Errors:
##1
[root]# s3fs -o use_cache=/tmp/cache log-server-bkup /s3logs/
s3fs: could not determine how to establish security credentials

## resolution ##
make sure the .passwd-s3fs is in the home directory

##2
[root]# s3fs -o use_cache=/tmp/cache log-server-bkup /s3logs/
s3fs: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory

## resolution ##
make sure you have installed fuse-libs
[root]# yum install fuse-libs


#3. # s3fs -o use_cache=/tmp/cache log-server-bkup  /s3logs
s3fs: unable to access MOUNTPOINT /s3logs: Transport endpoint is not connected

## resolution ## (This typically is caused by the mount directory being left mounted due to a crash of your filesystem)
#mv /s3logs /tmp
#mkdir /s3logs
mount again

Monday, August 31, 2015

pvcreate error: Device /dev/sdb not found (or ignored by filtering).

Error::::
[root@pg ~]# pvcreate /dev/sdb /dev/sdc
  Device /dev/sdb not found (or ignored by filtering).
  Device /dev/sdc not found (or ignored by filtering).

(parted) print all
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 300GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  2149MB  2147MB  primary  linux-swap(v1)
 2      2149MB  300GB   298GB   primary  ext4            boot


Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 36.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start  End  Size  File system  Name  Flags

Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdc: 36.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start  End  Size  File system  Name  Flags


Solution:
[root@lrsxfcp29112 ~]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdc
Using /dev/sdc
(parted) mklabel loop
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk
will be lost. Do you want to continue?
Yes/No? y
(parted) q
Information: You may need to update /etc/fstab.


[root@lrsxfcp29112 ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created
[root@lrsxfcp29112 ~]# pvcreate /dev/sdc
  Physical volume "/dev/sdc" successfully created

Tuesday, July 28, 2015

Pioneer VSX-822, ARC and Samsung UN55en7100

Problem: I want to play my pictures slideshow on my TV, also like to play my favorite songs in the background using the receiver (with external speakers). I start my slideshow using xbox which is connected to game port on the receiver. Now, I try to start my music using receiver, it changes the video output on TV.

Connect TV ARC hdmi port -----------> (PIONEER VSX-822 ) RECEIVER OUT hdmi port

For example: if you want to use Samsung picture app to connect to media server ( NAS/PC where ever you have your pictures stored). Start samsung picture app, connect to storage and start the slide show. Once you have the slide show on the TV.
Use Pioneer Receiver iphone app to connect to media server and choose the song to play.

** Samsung UN55D7000 series picture app doesn't play picture 24 mega pixel, that's why I have to switch to some thing better.

Now, I want to use xbox to display my pictures with music in background.
By the way xbox display is just fantastic, I tried plex media app, roku media player etc. but nothing like xbox quality.

One problem with Xbox is you have start the music before you start the picture slide show, and also you cannot change the songs once you start the slide show.

Now the problem, xbox is connected to game port on Receiver.
Connect TV ARC port -----------> (PIONEER VSX-822 )RECEIVER OUT hdmi port
                                                  XBOX -------->        RECEIVER   (game port)

Whenever you start Pioneer iphone app to connect to media server, it switches the video output on the receiver to media server.
Here is how it works:
Connect TV ARC port -----------> (PIONEER VSX-822 )RECEIVER OUT hdmi port
                                                  XBOX -------->        TV (hdmi port)

Bottom line once you enable ARC on the Receiver and connected to TV ARC hdmi port correctly all the device you connect to TV will pass thru the audio using the Receiver.
And if you choose to change the mode in the receiver to media server it will not change the video output on the TV 

Wednesday, July 1, 2015

Cron error

Error in cron log

tail -f /var/log/cron

Dec  3 00:21:01 lfvsfcp25961 crond[19203]: (root) CMD (/home/root/backup/backup.sh backup.pg.com)
Dec  3 00:23:01 lfvsfcp25961 crond[24488]: (root) CMD (rsync -av --progress --inplace -e "ssh -i /home/root/.ssh/backup_rsa -q -c arcfour" /data/backups/`date +")


actual cron entry

23 00 * * * rsync -av --progress --inplace -e "ssh -i /home/root/.ssh/backup_rsa -q -c arcfour" /data/backups/`date +"%Y%m"`* root@backup.pg.com:/data/backup/backups > /tmp/sync.log


Fix:
escape the % signs. They have a special meaning in crontabs:

man (5) crontab:

Percent-signs (%) in the command, unless escaped with backslash (\),
will be changed into newline characters, and all data after the
first % will be sent to the command as standard input.

23 00 * * * rsync -av --progress --inplace -e "ssh -i /home/root/.ssh/backup_rsa -q -c arcfour" /data/backups/`date +"\%\Y\%m"`* root@backup.pg.com:/data/backup/backups > /tmp/sync.log

Thursday, April 30, 2015

(CRON) ERROR chdir failed (/bin/bash): Not a directory

check /etc/passwd for typo :-(


# cat /etc/passwd
pg:x:100:100:pankaj gautam/pankaj:/bin/tcsh

# cat /etc/passwd ( : missing in root user home /root)
pg:x:100:100:pankaj gautam:/pankaj:/bin/tcsh

Sunday, January 25, 2015

Import iphone6 addressbook to Mercedes C300 (pain in the a$$)

I own a Mercedes C class 2009, It took me a week to import my first iphone address book into Command APS when I bought the car in late 2008. It was so painful that I almost lost interest after finally importing the addressbook.
After 5 years I thought of updating the address book again and went thru the same painful experience.
This time thought of documenting few steps to make life easy for next time.

I'm hoping new model have better sync capabilities, because Mercedes has crippled the bluetooth earlier models (hopefully for good reasons).

There are only three steps to import the addresses in Command APS
#1. Pair your phone/iphone6.
#2. Change Command APS into receive business cards
#3. Send the vcards/csv files to paired MB Bluetooth

I have done this so many times now, if everything works its a 30 mins task. Otherwise couple of days. Just to a reminder that Command APS has a limitation of 1000 addresses.

Prework:
#0. Sync iphone to any email client. Export all your addresses from your email client to a vcard file on any laptop (mac/pc doesn't matter) should have bluetooth.

Steps:
#1. Now pair the laptop with "MB Bluetooth". I hoping you are familiar with this step since you must be using you phone already. It's the same Command APS step System/Bluetooth/Update, it will look for yr LAPTOP and ask for pairing key. Type 2323

Look for a key prompt on the laptop, enter 2323


This is process is again sometimes painful, be patient. If it is not working try to give sometime and start again. You should see a successful connection before starting the next step.

 #2. Once you have laptop connected. Change to addressbook and start receiving business cards. You will see its waiting for new businesscards



#3. From the laptop, look for "Bluetooth file transfer". Click send files. Select "MB Bluetooth". Select the vcard file you exported and click Next.

You will see Command APS receiving business cards. After its finishes you should see all your addresses in the addressbook.


Few problems and resolution:
### If you are sending csv file. It will show you a successful transmission but I guess MB doesn't know how to handle csv files for addressbook. Hence you will not see anything in the MB phone addressbook
###  After successful connection with laptop, it keep losing connection. I believe it was because of battery was draining.
### Laptop won't connect using bluetooth, try disabling bluetooth discovery and enable it again.