Samstag, 12. Juni 2021

[Solved] Samsung Fit Plus 256 GB USB Flash Drive too slow in linux



If you have a Samsung Fit Plus 256GB USB Flash Drive (or any other size) and it is very slow in linux then here comes the explanation.

For the Samsung Fit Plus USB Flash Drive exists a Kernel Quirk that reduces the speed of file transfers by a factor of approx 6.

Normal read speed is around 240 MB/s (linux running in Parallels on a Mac Mini). The kernel reduces the speed to around 40MB/s. 

We can remove the kernel restriction by the following methods:


a) "on the fly" by executing following commands (do not change the numbers)

 # rmmod uas usb_storage

# modprobe usb_storage quirks=090c:1000:

b) permanently by adding/editing the file /etc/modprobe.d/usb_storage.conf and adding this line:

options usb_storage quirks=090c:1000:

It is important that the Flash Drive is connected directly to a USB 3.0 port without any adapter in between. Otherwise I saw the kernel complaining and disconnecting the device.

Useful commands:


# hdparm -t /dev/sdj
/dev/sdj: Timing buffered disk reads: 922 MB in  3.00 seconds = 307.19 MB/sec

# dd if=/dev/sdj of=/dev/null bs=1M count=1000
1048576000 bytes (1.0 GB, 1000 MiB) copied, 3.51042 s, 299 MB/s

# cat /proc/scsi/usb-storage/*
   Host scsi9: usb-storage
       Vendor: Samsung
      Product: Flash Drive FIT
Serial Number: 0302320100001796
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks: SANE_SENSE

If you do not get close to this numbers than the old kernel quirks is still active (try to reboot your system).

Sonntag, 30. April 2017

Speed up time machine backup on MAC

The time machine backup runs in the background and is programmed to not take much CPU power in order to not influence the normal work. But sometimes it is necessary to have the backup done in the fastest way possible (i.e. after backing up to a new hard drive). The following command:

sudo sysctl debug.lowpri_throttle_enabled=0

gives back the normal priority to the time machine backup which speeds up heavily the copy process.

This parameter is being reset to the original value 1 after a reboot.

Samstag, 6. Februar 2016

Solution: dd too slow on Mac OS X

Does your dd command seem to be far too slow on your MAC?
It is not the dd command that makes it slow, it's the device that you selected.
On a MAC there exist for an external attached USB device two names in the /dev/ tree (example):

/dev/disk3

and

/dev/rdisk3

If you copy from /dev/disk3 with dd command (does not depend much on the blocksize that you
selected) then you will get around 30Mbytes/s. Now if you choose /dev/rdisk3 then you can
get up to 300Mbytes/s (using a USB3.0 SATA adapter and a fast disk of course).

Thanks to Daoyluan Li (http://daoyuan.li/solution-dd-too-slow-on-mac-os-x/#comment-13896)
who found that solution!!!

Samstag, 7. November 2015

scp files from A to C or from C to A via intermediate host B



I have access to three different machines A, B and C like:A to BB to AB to CC to Bbut not from A to C and not from C to A because A and C are on a different network.
In order to transfer files from A to C or from C to A do the following:
ssh -fN -L 4567:C:22 username_of_B@B
and then to transfer a directory from C to A:
scp -r -P 4567 localhost:directory_on_C path_on_A_where_to_put_the_directory
to transfer a directory from A to C:scp -r -P 4567 directory_on_A_which_is_to_transfer localhost:path_on_C_where_to_put
and for transfering files:to transfer a file from C to A:
scp -P 4567 localhost:file_to_transfer_on_C path_on_A_where_to_put_the_file
to transfer a file from A to C:
scp -P 4567 file_on_A_which_to_transfer localhost:path_on_C_where_to_put_the_file


Even better is this command to rsync files from computer A to computer C (or vice versa)via intermediate computer B:
rsync -av -e 'ssh -o "ProxyCommand ssh username_at_computer_B@IP_of_computer_B exec nc %h %p 2greater/dev/null"' username_at_computer_C@IP_of_computer_C:directory_on_C_to_sync/* directory_on_A_to_sync/



the word "greater" in the line above has to be replaced with the greater symbol of the keyboard. I can not do it here because while saving it is being replaced with >

Sonntag, 1. Juni 2014

How to create a WiFi Hotspot on a linux machine in order to share the ethernet connection?

How to create a WiFi Hotspot on a linux machine in order to share the ethernet connection? I tried several days "all" solutions posted in the internet on my Macbook Pro running on SuSe 12.3 under gnome but nothing worked. My mobile devices (iphone, ipad) could see the created Hotspot but after connecting to it there was no internet connection. The simple solution was to set the "wireless security" to "none". For me no problem at all for that purpose I am using it. So here come the instructions: I use Networkmanager and the nm-applet. a) In nm-applet click on "Create New Wireless Network" Specify any name for "Network name" in the window that will open. Select "none" under "Wireless security" Select "Create" b) connect any wireless device to this newly created hotspot and press "Join Anyway" in case that the iOS will inform you that this hotspot is not connected to the internet. For me that and only that worked out.

Dienstag, 9. Juli 2013

How to save a partition via network to a different computer and later restore that partition after formatting the local disc

How to save a partition via network to a different computer and later restore that partition after formatting the local disc? 1) try to unmount the partition if possible 2) dd if=/dev/hda1 bs=1k conv=sync,noerror | gzip -c | ssh -c blowfish user@hostname "dd of=filename.gz bs=1k" 3) format or do whatever you want to do with /dev/hda1 4) go to the remote computer "hostname" and execute following command there: dd if=filename.gz | ssh -c blowfish root@deadhost "gunzip -c | dd of=/dev/hda1 bs=1k" Thanks a lot to http://www.inference.phy.cam.ac.uk/saw27/notes/backup-hard-disk-partitions.html for this and many more useful tips!

Samstag, 6. April 2013

howto enable apple wireless keyboard to send message by pressing cmd-enter

How many key combinations have you tried in order to get the Apple wireless keyboard to send a message instead of inserting a carriage return? 100 as I did? More? Stop trying it because it is not possible without a Cydia tweak. Today I found the answer. Install the free Bluetooth Keyboard Helper from Matthias Ringwald and be happy. It translates the cmd-enter key into a |press 'Send' button" action in the messages.app.

Dienstag, 6. November 2012

enable wireless in suse linux on a macbook pro

If you install linux on a Macbook Pro then the wireless adapter is not automatically working. You need to install the firmware before you can use wireless: sudo zypper install b43-fwcutter sudo /usr/sbin/install_bcm43xx_firmware

Mittwoch, 17. Oktober 2012

debug IDL program that uses a shared library call

If you need to debug a IDL program that uses a shared library c-program then use qt creator! This program works perfect for this job. Just call the program and then choose: Debug -> Start debugging -> Start and Debug external Application Then choose the idl executable and the directory where to run IDL. An xterm will be opened with the IDL command prompt. Run your IDL program there. Open the c-program by file -> open file with... and set your breakpoints as you wish. The program is ready to be debugged! Very easy!!

Freitag, 4. Mai 2012

debug shared library in IDL with DDD

How to debug a c program that was compiled as shared library and that is called by IDL via call_external in GNU DDD debugger? a) compile the shared library without optimization and with debugging information: Example: gcc -fPIC -O0 -ggdb3 -c fw_bw_loop_quick_xp.c && gcc -shared -o fw_bw_loop_quick_xp.so fw_bw_loop_quick_xp.o -lm b) call IDL inside DDD in the path where your data is like: LD_LIBRARY_PATH=/usr/local/rsi/idl/lib:/usr/local/rsi/idl/bin/bin.linux.x86_64 ddd /usr/local/rsi/idl/bin/bin.linux.x86_64/idl c) inside DDD type "run" This will start IDL inside DDD. Now you can restore your software and execute whatever you want. If it enteres the c-program, type CTRL-C or set somehow a breakpoint d) continue normal debugging. Open the source of your c-program by "open->source". Thanks a lot to my friend Fernando Silveira for this tip!!!!!!

Donnerstag, 2. Dezember 2010

edit initrd

If you ever need to edit the initrd file of /boot/ then issue the following commands:

mkdir ~/initrd
zcat boot/initrd-2.6.22.12-0.1-default >~/initrd-2.6.22.12-0.1-default.cpio
cd ~/initrd
cpio -idv <../initrd-2.6.22.12-0.1-default.cpio

The reverse process is doing by this commands:

find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img

Donnerstag, 23. September 2010

repair cacti database

issue following command as root:
mysqlcheck --auto-repair --databases cacti

Donnerstag, 26. August 2010

solve envi 4.1 segmentation fault

If ENVI 4.1 crashes with segmentation fault then find a old libX11.so.6 file from a working
version and copy it to the directory of your choice and specify this path to LD_LIBRARY_PATH:
export LD_LIBRARY_PATH="/usr/local/lib/private_lib"
export LD_PRELOAD_PATH="/usr/local/lib/private_lib"

then start ENVI and...works

Dienstag, 29. Juni 2010

untethered jailbreak and unlock for iphone 3GS with new bootrom and firmware 3.1.3

The iphone 3GS with new bootrom and firmware 3.1.3 can be jailbreaked and unlocked with following tools:

1) jailbreak it with Spirit from this page:
http://www.redmondpie.com/spirit-jailbreak-fix-for-itunes-9.2/
The link to the software you will find here:
http://rapidshare.com/files/403136973/Spirit.Fix.iTunes.9.2.rar.html

2) unlock the phone with ultrasn0w.
Go to Cydia and add the source http://repo666.ultrasn0w.com
Then install ultrasn0w and everything is done.

Donnerstag, 24. Juni 2010

mount partition of dd image of hard disk

If you did a backup of a hard disk with the dd command then you stored
everything including the partition table.
If you want to mount one partition of this backup only to a folder then you need to do the following:

1) losetup /dev/loop0 /home/proc/file
2) fdisk -lu /dev/loop0 then you will see the partitions and the number of the blocks where they start. If you want to mount the partition number 3 then read the number there. Let's say it is N
3) losetup -d /dev/loop0 (release the loop device)
4) losetup /dev/loop0 /home/proc/file -o $((N*512))
5) mount /dev/loop0 disk

Montag, 31. Mai 2010

1 Tb hard disk appears as 33Mbyte disk on a Gigabyte mainboard

If a 1Tb hard disk that is installed on a Gigabyte motherboard appears to have
a size of 33 Mbyte after some time then do the following:

>hdparm -N /dev/sdc (assuming that the disc appears as /dev/sdc)
/dev/sdc:
max sectors = 1953525168/1953525168, HPA is disabled

write the number that appears behind the slash in the following line:

>hdparm -Np1953525168 /dev/sdc


Then reboot the machine.
The disc has its original size and all data is still there.
Thanks to:

http://www.mail-archive.com/linux-ide@vger.kernel.org/msg16327.html

Donnerstag, 18. Februar 2010

howto encrypt a directory to a file

To encrypt a directory input_directory to a encrypted file do the following:

a) generated a file input_directory_file big enough to hold the data. This file will be the
filename of theencrypted file later. To do this you can use the command dd if=/dev/zero
of=input_directory_file bs=1M count=100. This command will generate a file with 100Mb size.
b) losetup /dev/loop0 input_directory_file
c) cryptsetup luksFormat /dev/loop0 (answer with YES and specify the password twice)
d) cryptsetup luksOpen /dev/loop0 containername
e) mke2fs /dev/mapper/containername (to put a filessystem to the device)
f) mkdir container_dirctory
g) mount /dev/mapper/containername container_directory
h) put all the files and directories inside this container_directory
i) umount container_directory
j) cryptsetup luksClose containername
k) losetup -d /dev/loop0

That's all

Donnerstag, 14. Januar 2010

how to read the database of sleep cycle and how to generate the same plots

1) copy the file /var/mobile/Applications/sleep cycle/Documents/eventlog.sqlite
to your pc.
2) use sqlitebrowser to open the file and to extract the data:
ZINTENSITY contains the data
ZTIME contains the time
ZSLEEPSESSION contains the session number (number of night)
-> the time is given in seconds since 1.1.1970
-> example: array=dblarr(2,200)
array(0,*)=ZTIME
array(1,*)=ZINTENSITY
3) for plotting:
->subtract the time of the first element from all times (remove the time offset)
array(0,*)=array(0,0)
->generate an empty array with the same number of elements as you have seconds
arind=fltarr(max(array(0,*)))
->put your data to that positions where the time was recorded.
arind(array(0,*))=array(1,*)
-> plot the data with plot,smooth(smooth(smooth(at,1001),1001),1001)

Mittwoch, 2. Dezember 2009

use mouse gestures in fvwm2/suse

easystroke is a wonderful program that lets you record mouse gestures and executes
commands based on them.
In conjunction with a special definition in .fvwm2rc you can specify any action
to be executed. For example to switch to a special window on the desktop:
in .fvwm2rc:
Key Pause A N FocusWindowNumber 8
-> switches to the window remembered on position 8
PipeRead 'for i in `seq 0 9`; do echo Key $i A MC AssignNumberToCurrentWindow $i; done'
->remembers the window and stores it on position 8

in easystroke define key "Pause" to a gesture of your choice.

If executing that gesture the window 8 is switched to.

Mittwoch, 18. November 2009

tell mplayer which sound device to use

mplayer -ao oss:/dev/dsp *.mp3
mplayer -ao alsa:device=hw=0.0 *.mp3


or

mplayer -ao oss:/dev/dsp1 *.mp3
mplayer -ao alsa:device=hw=1.0 *.mp3