dijous 23 de juny de 2011




Storage











Contents








SCSI rescan without reboot



On debian



backup:~# aptitude install scsiadd

backup:~# scsiadd -s
Attached devices:
Host: scsi0 Channel: 00 Id: 06 Lun: 00
Vendor: PE/PV Model: 1x6 SCSI BP Rev: 1.0
Type: Processor ANSI SCSI revision: 02
Host: scsi0 Channel: 02 Id: 00 Lun: 00
Vendor: MegaRAID Model: LD 0 RAID1 34G Rev: 521X
Type: Direct-Access ANSI SCSI revision: 02





On other linux:



backup:~# echo "- - -" > /sys/class/scsi_host/host0/scan


For some Fiber channels it can be:



echo "1" > /sys/class/fc_host/host#/issue_lip






Partition re-read without reboot



backup:~# aptitude install parted
backup:~# partprobe


Adding a new partition



fdisk + partprobe



backup:~# fdisk /dev/sda

The number of cylinders for this disk is set to 34680.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 36.3 GB, 36364615680 bytes
64 heads, 32 sectors/track, 34680 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x49e2fd2f

Device Boot Start End Blocks Id System
/dev/sda1 1 7629 7812080 83 Linux
/dev/sda2 7630 7631 2048 82 Linux swap / Solaris


Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (7632-34680, default 7632):
Using default value 7632
Last cylinder or +size or +sizeM or +sizeK (7632-34680, default 34680):
Using default value 34680

Command (m for help): p

Disk /dev/sda: 36.3 GB, 36364615680 bytes
64 heads, 32 sectors/track, 34680 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x49e2fd2f

Device Boot Start End Blocks Id System
/dev/sda1 1 7629 7812080 83 Linux
/dev/sda2 7630 7631 2048 82 Linux swap / Solaris
/dev/sda3 7632 34680 27698176 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


backup:~# partprobe


backup:~# ls -la /dev/sda*
brw-rw---- 1 root disk 8, 0 2009-10-01 11:10 /dev/sda
brw-rw---- 1 root disk 8, 1 2009-09-30 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 2009-09-30 15:32 /dev/sda2
brw-rw---- 1 root disk 8, 3 2009-10-01 11:10 /dev/sda3
backup:~#







Formatting ext3 and mounting the partiton




backup:~# mke2fs -j /dev/sda3
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1733312 inodes, 6924544 blocks
346227 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
212 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.





Mounting via command:



backup:~# mkdir /tmp/mount

backup:~# mount /dev/sda3 /tmp/mount/


Mounting via fstab



backup:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda3 /tmp/mount ext3 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/hde /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/hdb /media/cdrom1 udf,iso9660 user,noauto 0 0

backup:~# umount /tmp/mount/
backup:~# mount /tmp/mount/



LVM



Physical Volumes pv Physical disk or partions that we will use to create partiongs
Volume Group vg A set of Physical Disk's or partitions that equals like a big disk
Logical Volume lv Logical Volumes that we set up in a Volume Group, like a partition in a disk






Create an LVM partition



The procedure is to create the partition like other partition and change the Id to 'Linux LVM'



backup:~# fdisk /dev/sda3
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x10c7f8c8.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.


The number of cylinders for this disk is set to 27049.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sda3: 28.3 GB, 28362932224 bytes
64 heads, 32 sectors/track, 27049 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x10c7f8c8

Device Boot Start End Blocks Id System

Command (m for help): q

backup:~# fdisk /dev/sda

The number of cylinders for this disk is set to 34680.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 36.3 GB, 36364615680 bytes
64 heads, 32 sectors/track, 34680 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x49e2fd2f

Device Boot Start End Blocks Id System
/dev/sda1 1 7629 7812080 83 Linux
/dev/sda2 7630 7631 2048 82 Linux swap / Solaris
/dev/sda3 7632 34680 27698176 83 Linux

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): L

0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot
1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris
2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx
6 FAT16 42 SFS 86 NTFS volume set da Non-FS data
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3 75 PC/IX
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sda: 36.3 GB, 36364615680 bytes
64 heads, 32 sectors/track, 34680 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x49e2fd2f

Device Boot Start End Blocks Id System
/dev/sda1 1 7629 7812080 83 Linux
/dev/sda2 7630 7631 2048 82 Linux swap / Solaris
/dev/sda3 7632 34680 27698176 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


backup:~# partprobe







Creating Physical Volumes



backup-server:~# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created


To show it:



backup-server:~# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name backup-vg
PV Size 9.31 GB / not usable 2.00 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 2384
Free PE 0
Allocated PE 2384
PV UUID c523t4-ayG8-111I-w1uj-4MTL-ivau-WO00rR


Creating Volume Group



backup-server:~# vgcreate backup-vg /dev/sda3
Volume group "backup-vg" successfully created


To display the volume group:



backup-server:~# vgdisplay
--- Volume group ---
VG Name backup-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.31 GB
PE Size 4.00 MB
Total PE 2384
Alloc PE / Size 0 / 0
Free PE / Size 2384 / 9.31 GB
VG UUID rKpG12-3AUc-J2Yg-Kl1V-IlK1-kTBo-prYgMs


Creating a logical volume




backup-server:~# lvcreate -l 100%FREE -n bacula backup-vg
Logical volume "bacula" created






backup-server:~# lvdisplay
--- Logical volume ---
LV Name /dev/backup-vg/bacula
VG Name backup-vg
LV UUID YIK4iX-faGF-A84t-slGo-6lv1-VKxF-7j8SSC
LV Write Access read/write
LV Status available
# open 0
LV Size 9.31 GB
Current LE 2384
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0


Then we need to format the new logical parition by:






backup-server:~# mke2fs -j /dev/backup-vg/bacula
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
610800 inodes, 2441216 blocks
122060 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2499805184
75 block groups
32768 blocks per group, 32768 fragments per group
8144 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


Then we can start to mount the partition:



backup-server:~# mkdir /tmp/aa
backup-server:~# mount /dev/backup-vg/bacula /tmp/aa/


So here, we go, we have a new partiton of 9.2G



backup-server:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.4G 872M 6.2G 13% /
tmpfs 1014M 0 1014M 0% /lib/init/rw
udev 10M 724K 9.3M 8% /dev
tmpfs 1014M 0 1014M 0% /dev/shm
/dev/mapper/backup--vg-bacula
9.2G 150M 8.6G 2% /tmp/aa






Resizing on LVM



On the worse of the cases, if we want to resize the Logical Volume, we will need to create a new Physical Volume, add it into the Volume Group, and extend the logical volume:


First that we need to do is to ummount the partition.



backup-server:/tmp# unmount /tmp/aa


We will create a new Physical Device



backup-server:/tmp# pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created

backup-server:/tmp# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name backup-vg
PV Size 9.31 GB / not usable 2.00 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 2384
Free PE 0
Allocated PE 2384
PV UUID c523t4-ayG8-111I-w1uj-4MTL-ivau-WO00rR

"/dev/sda4" is a new physical volume of "17.10 GB"
--- NEW Physical volume ---
PV Name /dev/sda4
VG Name
PV Size 17.10 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID N4pKWY-cQyJ-zFiA-4nAO-tN0B-xw63-8NOwYT



Then we will need to extend the Volume Group with the Physical Device



backup-server:/tmp# vgdisplay
--- Volume group ---
VG Name backup-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.31 GB
PE Size 4.00 MB
Total PE 2384
Alloc PE / Size 2384 / 9.31 GB
Free PE / Size 0 / 0
VG UUID rKpG12-3AUc-J2Yg-Kl1V-IlK1-kTBo-prYgMs



backup-server:/tmp# vgextend backup-vg /dev/sda4
Volume group "backup-vg" successfully extended


backup-server:/tmp# vgdisplay
--- Volume group ---
VG Name backup-vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 26.41 GB
PE Size 4.00 MB
Total PE 6761
Alloc PE / Size 2384 / 9.31 GB
Free PE / Size 4377 / 17.10 GB
VG UUID rKpG12-3AUc-J2Yg-Kl1V-IlK1-kTBo-prYgMs
<pre>

So we have now a 17G free in the Volume Group.

We need now to extend the Logical Volume bacula.

<pre>
backup-server:/tmp# lvextend -l +100%FREE /dev/backup-vg/bacula
Extending logical volume bacula to 26.41 GB
Logical volume bacula successfully resized



backup-server:/tmp# lvdisplay
--- Logical volume ---
LV Name /dev/backup-vg/bacula
VG Name backup-vg
LV UUID YIK4iX-faGF-A84t-slGo-6lv1-VKxF-7j8SSC
LV Write Access read/write
LV Status available
# open 0
LV Size 26.41 GB
Current LE 6761
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0



But still if we mount the Logical Volume it is still 9 G :



backup-server:/tmp# mount /dev/backup-vg/bacula /tmp/aa/

backup-server:/tmp# ls -la /tmp/aa/
total 28
drwxr-xr-x 3 root root 4096 2009-10-02 12:37 .
drwxrwxrwt 5 root root 4096 2009-10-02 12:34 ..
-rw-r--r-- 1 root root 15 2009-10-02 12:37 aa.txt
drwx------ 2 root root 16384 2009-10-02 12:34 lost+found


backup-server:/tmp# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.4G 872M 6.2G 13% /
tmpfs 1014M 0 1014M 0% /lib/init/rw
udev 10M 724K 9.3M 8% /dev
tmpfs 1014M 0 1014M 0% /dev/shm
/dev/mapper/backup--vg-bacula
9.2G 150M 8.6G 2% /tmp/aa




We will need also to extend the partiton. This will depend on the file-system that we have. In our case this is ext3. So we will use resize2fs utility to resize. If no argument is given it will resize to the max size of the partition. The first time we run the program it will ask to check the partition with e2fsck.






backup-server:/tmp# umount /tmp/aa/

backup-server:/tmp# resize2fs /dev/backup-vg/bacula
resize2fs 1.41.3 (12-Oct-2008)
Please run 'e2fsck -f /dev/backup-vg/bacula' first.


backup-server:/tmp# e2fsck -f /dev/backup-vg/bacula
e2fsck 1.41.3 (12-Oct-2008)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/backup-vg/bacula: 12/610800 files (0.0% non-contiguous), 76506/2441216 blocks



backup-server:/tmp# resize2fs /dev/backup-vg/bacula
resize2fs 1.41.3 (12-Oct-2008)
Resizing the filesystem on /dev/backup-vg/bacula to 6923264 (4k) blocks.
The filesystem on /dev/backup-vg/bacula is now 6923264 blocks long.


So we will have now a new partiton of 26G and with the data still on it.






backup-server:/tmp# mount /dev/backup-vg/bacula /tmp/aa/


backup-server:/tmp# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.4G 872M 6.2G 13% /
tmpfs 1014M 0 1014M 0% /lib/init/rw
udev 10M 724K 9.3M 8% /dev
tmpfs 1014M 0 1014M 0% /dev/shm
/dev/mapper/backup--vg-bacula
26G 154M 25G 1% /tmp/aa


backup-server:/tmp# cd /tmp/aa/
backup-server:/tmp/aa# ls -la
total 28
drwxr-xr-x 3 root root 4096 2009-10-02 12:37 .
drwxrwxrwt 5 root root 4096 2009-10-02 12:34 ..
-rw-r--r-- 1 root root 15 2009-10-02 12:37 aa.txt
drwx------ 2 root root 16384 2009-10-02 12:34 lost+found
backup-server:/tmp/aa#



Mounting LVM on other server



Boot with rescue CD. Skip mounting of the system partitions.


# lvm vgchange -a y





dimarts 7 de desembre de 2010

Gràcies

No fa més d'un any vaig fer un curs on en varen explicar-me la importància de saber donar les gràcies. Aquest pont de la puríssima he anat a esquiar amb la meva família, i el primer regal me'l va donar el meu fill, va dir : Avui és el dia més maco de la meva vida !!!, ho va dir mentre esmorzàvem i ell mirava per la finestra. Només per aquest fet ja ha valgut la pena fer aquesta sortida !!!.

No cal explicar com he gaudit de la cara de felicitat que tenien els dos nens (Aniol i Aina) quan anaven i tornaven d'esquiar, això és un altre gran regal. També vull donar les gràcies a la meva estimada SOGRE (la Joanna), sense ella no hauríem ni dinat i sopat tant bé (i no penseu que soc un aprofitat !!!), i no només per la teca cal donar-li les gràcies, sino per tots els moments difícils que he patit on sempre m'ha fet costat o ens ha fet costat.

Per cert m'he agafat mots dies de festa, i no perquè no tingui ganes d'anar a la feina (la veritat és que si no cobrés, no hi aniria), personalment necessitava un kit-kat. Que haig de dir dels meus companys? GRÀCIES per ser com sou, encara que ni ha un que és del altre costat de la Tordera. Ha estat i és un plaer poder treballar amb vosaltres, aprendre encara que sigui als 40 i pico !!!

Gràcies als meus cunyats (tant polítics, com de fet), als germans (tots) i als meus nebots, per ser com sou i per poder formar part també de la vostra família.

La veritat és que estic vivint uns dels moments més dolços, espero poder donar les gràcies molts i molts més anys (sempre i quan us ho mereixeu).

Gràcies a tots per ser com sou !!!!


 

Ho dedico a la Cristina, sense tu no aquestes Gràcies no haguessin existit.

divendres 10 de setembre de 2010

dimecres 1 de setembre de 2010

Cada any el mateix

La tornada a l’escola és esperada per molts, sobretot pels nens per retrobar-se amb els seus companys, però any rere any sempre haig de sentir plorar els docents (els professors).

Avui m’he indignat, en el telenotícies migdia i en algun altre mitjà parlaven del poc temps que havien tingut els docents per preparar-se.

POC TEMPS !!! Es clar ells només compten amb els 4 dies de setembre abans que comencin les classes, i dic classes i no dic curs. Tothom es pensa que els docents tenen 2 mesos de vacances, però no es veritat. El Juliol és lectiu, l’haurien de destinar a formació (com a mínim) i si volguessin podrien avançar feina i així no els agafaria amb el pixat al ventre, com sol passar si ho deixes tot fins l’últim moment.

No vull treure cap mèrit a la tasca que fan, estressant ..., però que no es estressant treballar de cara al públic i haver d’aguantar comentari rere comentari, gent pesada i també gent amable. A més no vull comentar , però si fer un incís, l’horari, qui es pogués agafar 2 mesos de vacances, Nadal, Setmana Santa i per postres una setmana al febrer (i que faran? , perquè si aquesta setmana és a canvi de començar les classes una setmana abans, suposo que podré trobar tots els docents en els seus centres si els necessito, oi? )

El que jo no suporto és que els hagi de sentir plorar, no tenim temps de preparar ... , de planificar ... , és que aquest any amb els nous estris (llibres electrònics, portàtils ...).

Si us plau no em prengueu el pel, que quan veig a la meva mare netejant olles 8 hores diàries i molta d’altre gent que hi deixa la pell i la salut, no els veig que es queixin tant.

Tothom és amo del seu destí, ningú els ha obligat a ser docents, ho han triat ells, tenen anys sabàtics, i si no com la resta dels mortals, si no m’agrada la feina la canvio.

I per que consti, treballo en el sector públic, amb un bon horari i unes bones vacances, però QUE NO PODEM SER FELIÇOS AMB EL QUE TENIM ???

dimarts 10 d’agost de 2010

Windsurf to sale a preus economics


Tinc material de windsurf per vendre a preus econòmics, si voleu contactar amb mi ho podeu fer a jfortia@gmail.com

Podeu veure el preu i el material a:
http://picasaweb.google.com/jfortia/WindsurfToSale#

----------------------------------------------------------------------------------------------

Me vendo el material de windsurf aqui teneis el link de picassa con todas las fotos del material:

http://picasaweb.google.com/jfortia/WindsurfToSale#

Cualquier duda a jfortia@gmail.com

El material esta en Sant Antoni de Calonge, entre Palamos y Platja d'Aro.

Pep