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
Donnerstag, 24. Juni 2010
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
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
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)
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.
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
mplayer -ao alsa:device=hw=0.0 *.mp3
or
mplayer -ao oss:/dev/dsp1 *.mp3
mplayer -ao alsa:device=hw=1.0 *.mp3
Dienstag, 10. November 2009
wacom bamboo stops working after unplugging
to solve this (to get it working as a graphic tablet again without restarting X) just switch from X11 to Console (press Ctrl + Alt + F1 together then release them) and then switch back to X11 (press Ctrl + Alt + F7 together then release them).
Then the graphic tablet works as before unplugging!
Then the graphic tablet works as before unplugging!
Abonnieren
Posts (Atom)