1. Attach the new disk
2. create lvm
3. dd data from old to new lvm root
4. grub-install /dev/sdb (the new disk)
5. update-grub (in chroot or inside the actual OS)
Tuesday, May 20, 2014
Friday, May 16, 2014
allow other users in screen session / share screen session
1. sudo chmod +s /usr/bin/screen
2. sudo chmod 755 /usr/bin/screen
3. USER1: screen -S screen1
USER1: CTRL+A :multiuser on
USER1: CTRL+A: acladd USER2
4. USER2: screen -x USER1/screen1
2. sudo chmod 755 /usr/bin/screen
3. USER1: screen -S screen1
USER1: CTRL+A :multiuser on
USER1: CTRL+A: acladd USER2
4. USER2: screen -x USER1/screen1
set ubnutu linux default terminal encoding to UTF-8
gconftool --set --type=string /apps/gnome-terminal/profiles/Default/encoding UTF-8
Monday, May 12, 2014
debian squeeze change root disk to lvm
- create the lvm on the second disk
- dd data onto the lvm disk
- detach the old disk
- reboot with rescue cd and chown into the lvm root
- grub-install /dev/sda
- update-grub
Wednesday, April 30, 2014
X11 forwarding for other users
1. in Your session do xauth list and find your correct auth (the one matching $DISPLAY), and copy the whole line
2. do your sudo or su and then do xauth add<the line copied in step one>
Big Thanks to http://blog.cyphermox.net/2008/05/ssh-x11-forwarding-for-other-users.html
2. do your sudo or su and then do xauth add
Big Thanks to http://blog.cyphermox.net/2008/05/ssh-x11-forwarding-for-other-users.html
Thursday, April 10, 2014
add remove dynamic bind dns records
IF ZONES EXIST
nsupdate -k $keyfile
> server 127.0.0.1
> update add server1.example.com 3600 A 10.0.0.1
> send
> update add 1.0.0.10.in-addr.arpa 3600 in ptr server1.example.com.
> send
nsupdate -k $keyfile
> server 127.0.0.1
> update add server1.example.com 3600 A 10.0.0.1
> send
> update add 1.0.0.10.in-addr.arpa 3600 in ptr server1.example.com.
> send
Wednesday, April 09, 2014
Friday, February 07, 2014
remove a line from a file
sed -i '22d' /root/.ssh/known_hosts
or better is to do ssh-keygen -R hostname/IP
or better is to do ssh-keygen -R hostname/IP
linux change root disk grub-install
redetect disks by grub-install in case dd ing 446 bytes from one disk to the other did not work, /boot/grub/devices.map needs to be fixed
Wednesday, February 05, 2014
perl command line arguments
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use utils qw( &usage );
my($host,$port,$user,$password,$file,$opt_w,$opt_c) = ("",22,"","","","","","","","");
Getopt::Long::Configure('bundling', 'no_ignore_case');
GetOptions
("H|host=s" => \$host,
"p|port=s" => \$port,
"U|user=s" => \$user,
"P|password=s" => \$password,
"F|file=s" => \$file,
"w|warning=s" => \$opt_w,
"c|critical=s" => \$opt_c,
);
($host) || usage("Host not specified\n");
($user) || usage("SFTP Username not specified\n");
($password) || usage("SFTP password not specified\n");
($file) || usage("File to upload and download not specified\n");
($opt_w) || usage("Warning threshold not specified\n");
($opt_c) || usage("Critical threshold not specified\n");
use strict;
use Getopt::Long;
use utils qw( &usage );
my($host,$port,$user,$password,$file,$opt_w,$opt_c) = ("",22,"","","","","","","","");
Getopt::Long::Configure('bundling', 'no_ignore_case');
GetOptions
("H|host=s" => \$host,
"p|port=s" => \$port,
"U|user=s" => \$user,
"P|password=s" => \$password,
"F|file=s" => \$file,
"w|warning=s" => \$opt_w,
"c|critical=s" => \$opt_c,
);
($host) || usage("Host not specified\n");
($user) || usage("SFTP Username not specified\n");
($password) || usage("SFTP password not specified\n");
($file) || usage("File to upload and download not specified\n");
($opt_w) || usage("Warning threshold not specified\n");
($opt_c) || usage("Critical threshold not specified\n");
Tuesday, February 04, 2014
rvm install ruby specific version
\curl -k -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3-p362
Monday, February 03, 2014
replace root with lvm
In rescue mode::
KER=`ls /lib/modules` #if single kernel
initrd -v -f /boot/initrd-$KER.img $KER
DAAA :::: make sure you do not have rd_NO_LVM in the options passed to vmlinuz
KER=`ls /lib/modules` #if single kernel
initrd -v -f /boot/initrd-$KER.img $KER
DAAA :::: make sure you do not have rd_NO_LVM in the options passed to vmlinuz
Friday, December 20, 2013
linux remove sata disk
echo 1 > /sys/block/(whatever)/device/delete
thanks to http://unix.stackexchange.com/questions/43413/how-can-i-safely-remove-a-sata-disk-from-a-running-system
thanks to http://unix.stackexchange.com/questions/43413/how-can-i-safely-remove-a-sata-disk-from-a-running-system
Friday, October 25, 2013
centos enable LVM for root disk
1. do vgchange -a y /dev/vg1/lv_root
this enables you to see the logical volume from the rescue/gparted disk
1. do mkinitrd -f /boot/initrd-2.6.xxxxxx 2.6.xxxxxxx
this enables you to see the logical volume from the rescue/gparted disk
1. do mkinitrd -f /boot/initrd-2.6.xxxxxx 2.6.xxxxxxx
Tuesday, October 01, 2013
extend an lvm with a file on another partition
if resizing another lvm and file system is not an option (time consuming) a temp solution will be
dd if=/dev/zero of=/var/disk1_2.dsk bs=1M count=100
losetup /dev/loop0 /var/disk1_2.dsk
pvcreate /dev/loop0
vgextend /dev/VG1/lv_disk1
lvextend -L+100M /dev/VG1/lv_disk1
vim /etc/rc.local
losetup /dev/loop0 /var/disk1_2.dsk
dd if=/dev/zero of=/var/disk1_2.dsk bs=1M count=100
losetup /dev/loop0 /var/disk1_2.dsk
pvcreate /dev/loop0
vgextend /dev/VG1/lv_disk1
lvextend -L+100M /dev/VG1/lv_disk1
vim /etc/rc.local
losetup /dev/loop0 /var/disk1_2.dsk
Monday, September 16, 2013
awk gsub for regular expression modification of strings
Use gsub like this
ping -c1 10.10.27.5 > /dev/null;arp 10.10.27.5 | awk '/ether/ {gsub(/:/,"",$3);print $3}'
ping -c1 10.10.27.5 > /dev/null;arp 10.10.27.5 | awk '/ether/ {gsub(/:/,"",$3);print $3}'
Thursday, June 27, 2013
remove unkown device from VG
add a new disk and assign the missing uuid to it
pvcreate --uuid 56ogEk-OzLS-cKBc-z9vJ-kP65-DUBI-hwZPSu /dev/sdc1
then remove it from the VG and PVs
pvcreate --uuid 56ogEk-OzLS-cKBc-z9vJ-kP65-DUBI-hwZPSu /dev/sdc1
then remove it from the VG and PVs
Thursday, June 20, 2013
comm - join like utility on linux
Compare sorted files FILE1 and FILE2 line by line.
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column
three contains lines common to both files.
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column
three contains lines common to both files.
Subscribe to:
Posts (Atom)