Extend logical volume on Linux

3 01 2012

I am not a system administrator but I had to extend a logical volume on our search cluster nodes due to increased data usage and a storage shortage. I have not done this before and after asking a linux admin and googling some pages I discovered that all the information needed for someone not having done this before is quite insufficient and I decided to write a sum up which finally worked fine:

Preconditions for this solution:

  • System with one SCSI controller important for below scan because host0 is used, this can be different if you have more than one SCSI controller in place
  • cfdisk or fdisk installed
  • lvm ready
  • existing Volume should be extended by a new physical volume

Hints:

  • sdc was the device on my system can be another one on yours
  • sdc1 will also then have another name on your system after fdisk
  • VolGroup01 was made on my system yours can have another name
  • /san mountpoint is the name on my system your mountpoint can have a different name

For Runaways the fast way:

rescan SCSI bus_______: echo "- - -" > /sys/class/scsi_host/host0/scan
create lvm partitioin_: fdisk /dev/sdc
create physical volume: pvcreate /dev/sdc1
unmount volume________: umount /san/
extend volume group___: vgextend VolGroup01 /dev/sdc1
save changes__________: vgchange -a y VolGroup01
extend logical volume_: lvextend /dev/VolGroup01/san /dev/sdc1
check filesystem______: e2fsck -f /dev/VolGroup01/san
extend filesystem_____: resize2fs /dev/VolGroup01/san
mount volume__________: mount -t ext3 /dev/VolGroup01/san /san/
check changes_________: df -h
reboot for cowards____: shutdown -r now

Detailed Doing:

  • Example for ls -l /dev/sd* before rescan
  • brw-rw---- 1 root disk 8, 0 Nov 9 10:21 /dev/sda
    brw-rw---- 1 root disk 8, 1 Nov 9 10:21 /dev/sda1
    brw-rw---- 1 root disk 8, 2 Nov 9 10:21 /dev/sda2
    brw-rw---- 1 root disk 8, 16 Nov 9 10:21 /dev/sdb
    brw-rw---- 1 root disk 8, 17 Nov 9 10:21 /dev/sdb1
  • Rescan of the SCSI bus
  • echo "- - -" > /sys/class/scsi_host/host0/scan
  • Example for ls -l /dev/sd* after rescan, a new device sdc is now visible for the system
  • brw-rw---- 1 root disk 8, 0 Nov 9 10:21 /dev/sda
    brw-rw---- 1 root disk 8, 1 Nov 9 10:21 /dev/sda1
    brw-rw---- 1 root disk 8, 2 Nov 9 10:21 /dev/sda2
    brw-rw---- 1 root disk 8, 16 Nov 9 10:21 /dev/sdb
    brw-rw---- 1 root disk 8, 17 Nov 9 10:21 /dev/sdb1
    brw-rw---- 1 root disk 8, 32 Jan 3 13:52 /dev/sdc
  • Mark partition for LVM using cfdisk followed by device
  • fdisk /dev/sdc
    [root@tfdsypwpadmin.tdmz.hbd ~]# fdisk /dev/sdc
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. 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 2610.
    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): 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): n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4):
    Value out of range.
    Partition number (1-4): 1
    First cylinder (1-2610, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
    Using default value 2610
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 8e
    Changed system type of partition 1 to 8e (Linux LVM)
    Command (m for help): p
    Disk /dev/sdc: 21.4 GB, 21474836480 bytes
    255 heads, 63 sectors/track, 2610 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdc1 1 2610 20964793+ 8e Linux LVM

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

    Calling ioctl() to re-read partition table.
    Syncing disks.

  • Example for ls -l /dev/sd* after creating new partition using fdisk
  • brw-rw---- 1 root disk 8, 0 Nov 9 10:21 /dev/sda
    brw-rw---- 1 root disk 8, 1 Nov 9 10:21 /dev/sda1
    brw-rw---- 1 root disk 8, 2 Nov 9 10:21 /dev/sda2
    brw-rw---- 1 root disk 8, 16 Nov 9 10:21 /dev/sdb
    brw-rw---- 1 root disk 8, 17 Nov 9 10:21 /dev/sdb1
    brw-rw---- 1 root disk 8, 32 Jan 3 13:52 /dev/sdc
    brw-rw---- 1 root disk 8, 33 Jan 3 13:58 /dev/sdc1
  • Create the physical volume
  • [root@tfdsypwpadmin.tdmz.hbd ~]# pvcreate /dev/sdc1
    Physical volume "/dev/sdc1" successfully created
  • Unmount the volume
  • [root@tfdsypwpadmin.tdmz.hbd ~]# umount /san/
  • Extend logical volume with created physical one. We have a volume group defined with the name VolGroup01, there we will add the additional physical volume. Listing of vgdisplay:
  • [root@tfdsypwpadmin.tdmz.hbd ~]# vgdisplay
    --- Volume group ---
    VG Name VolGroup01
    System ID
    Format lvm2
    Metadata Areas 1
    Metadata Sequence No 2
    VG Access read/write
    VG Status resizable
    MAX LV 0
    Cur LV 1
    Open LV 1
    Max PV 0
    Cur PV 1
    Act PV 1
    VG Size 29.97 GB
    PE Size 32.00 MB
    Total PE 959
    Alloc PE / Size 959 / 29.97 GB
    Free PE / Size 0 / 0
    VG UUID 1HFeZa-IJNC-v7Wh-KKN1-VtPx-J04n-MV7YZ6
    [root@tfdsypwpadmin.tdmz.hbd ~]# vgextend VolGroup01 /dev/sdc1
    Volume group "VolGroup01" successfully extended
  • Changes are currently not visible for the node only for the volumegroup, see VolGroup01 is still of size 30GB but should be 50GB by now
  • [root@tfdsypwpadmin.tdmz.hbd san]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-root
    16G 14G 940M 94% /
    /dev/sda1 99M 15M 80M 16% /boot
    none 3.9G 0 3.9G 0% /dev/shm
    /dev/mapper/VolGroup01-san
    30G 76M 28G 1% /san
  • Make changes persistent unmount Volume, call vgchange -a y volumegroupname and mount again
  • [root@tfdsypwpadmin.tdmz.hbd ~]# vgchange -a y VolGroup01
    1 logical volume(s) in volume group "VolGroup01" now active
  • Extend the logical volume with the size of the prior created physical volume
  • [root@tfdsypwpadmin.tdmz.hbd ~]# lvextend /dev/VolGroup01/san /dev/sdc1
    Extending logical volume san to 49.94 GB
    Logical volume san successfully resized
  • Extend the filesystem
  • [root@tfdsypwpadmin.tdmz.hbd ~]# e2fsck -f /dev/VolGroup01/san
    e2fsck 1.35 (28-Feb-2004)
    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/VolGroup01/san: 12/3932160 files (8.3% non-contiguous), 142845/7856128 blocks
    [root@tfdsypwpadmin.tdmz.hbd ~]# resize2fs /dev/VolGroup01/san
    resize2fs 1.35 (28-Feb-2004)
    Resizing the filesystem on /dev/VolGroup01/san to 13090816 (4k) blocks.
    The filesystem on /dev/VolGroup01/san is now 13090816 blocks long.[root@tfdsypwpadmin.tdmz.hbd ~]# mount -t ext3 /dev/VolGroup01/san /san/
    [root@tfdsypwpadmin.tdmz.hbd ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-root
    16G 14G 941M 94% /
    /dev/sda1 99M 15M 80M 16% /boot
    none 3.9G 0 3.9G 0% /dev/shm
    /dev/mapper/VolGroup01-san
    50G 84M 48G 1% /san
  • FINISHED




Erste Erfahrungen mit dem iPhone 4s oder das Batterieproblem ;-)

29 12 2011

Seit kurzem bin ich Besitzer des neuen iPhone 4s. Nach aller Freude über das neue Teil, Siri und schneller und überhaupt und so hat sich Akku technisch ganz schnell Ernüchterung eingestellt. Trotz Beteuerungen seitens Apple, dass mit dem 5.0.1er Firmwareupdate Akku Probleme adressiert wurden konnte ich hier leider keine signifikante Verbesserung feststellen. Wie kann man feststellen dass man das Akku Problem hat. Apple beschreibt für die normale Benutzung im Standby Modus einen Verbrauch von ca. 0,5% pro Stunde. Das Akkuproblem macht sich schön im Standby Modus bemerktbar, das Gerät zieht trotz Nichtstun kontinuierlich ziemlich viel Saft. Bei mir waren das so ca. 40% über einen halben Tag hinweg was eigentlich nur 6% hätten sein sollen. Ich habe mich dann durch alle möglichen Foren und Berichte gequält und mir schon gedacht Sch**** das Ding hat ein Problem mit der Antenne und ist defekt, bis ich diesen Artikel gefunden habe wo ein fixes Kerlchen herausgefunden hat, dass es offensichtlich kein Hardware Defekt ist, sondern ein Problem beim restoren von Backups gibt. Vorher hatte ich alle möglichen Hinweise auf diverse Services deaktivieren usw. usf. ausprobiert, ohne Erfolg. Die Neuinstallation mit Anlage als neues iPhone und dann alles händisch neu gesetzt brachte mich dann zum gewünschten Erfolg. Gerät ist neu geladen, war 3 h im Standby und steht immer noch bei 100%, somit für mich gecklückt und froh. Also nix an den Einstellungen herumdrehen, ist reine Zeitverschwendung, neues Gerät sofort mit neuer Firmware neu installieren und dann ja kein Restore von einem Backup machen, sondern alles neu einrichten, bis Apple einen Fix für das Problem hat.





iPhone 4s first review including battery life

25 12 2011

There are a lot of articles about the iphone 4s battery issues. Starting at rumors about icloud draining ending at the infrared sensor which is used by siri when you raise your phone to your ear when using raise to speak. As far as I can state from my device there is a kind of phantom usage of about 1% drainage every few minutes in standby until you switch of siri completely, this has vanished after i have disabled siri as mentioned in this article here. But I do not think this is all what draines the iphones battery. The highest dropping rates come from the 3g network usage. I tried using the phone with mobile data switched off, what resulted in similar behaviour as on my iphone 4, but when you switch on mobile data you can watch the battery dropping visually. I experienced 2% in two minutes of surfing on the web, what is a not exceptable rate in comparison to my iPhone 4. So please apple follow the hints you get from your users and try to get the new comboned antenna problem right.





ACHTUNG Paypal Hoax / Abzocke / Betrugs Mails

8 12 2011

In den letzten Tagen habe ich einige Mails angeblich von paypal bekommen, wo ich meine Daten überprüfen sollte. Ein kurzes Studium des mitgesendeten Links in der Mail hat das als sogenanntes Phishing Mail entlarvt. Achtung also bei Mails die so aussehen, wie die Abbildung unten. Nicht schlecht gemacht aber halt trotzdem durchschaubar, zum Glück.





Ein Enter an einen shell Befehl senden – send a return to a shell command

6 12 2011

Some of us especially the ones working in a high automated administrative environment have the need to write shell scripts issuing commands. Some of these commands like passwd or other binaries from 3rd party vendors expect you to press the enter key or an abort key stroke for continuing or aborting the operating. One of the solutions out there is using expect to do this, but I wanted to avoid installing a further binary on my productional environment. So I googled around and found a solution which works fine for me. You can send any commands/character combinations to a shell command. e.g. echo -ne ‘\n’ | crawleradmin -d $tmpCollection sends an enter to the command I issue afterwards and guess what happened, it worked. So use this method if you need it but ensure you test it in advance to avoid nasty sideeffects.





Alle Dateien, auch versteckte im Finder unter MacOS anzeigen

1 12 2011

Manchmal benötigt man einfach die Sicht auf alle Dateien in einem Ordner, vor allem wenn man zu den Technikern dieser Welt gehört. Da Apple ja bekanntlich den Benutzer vor zu viel Information und Komplexität schützt kann man diese Option nicht so einfach in den Einstellungen des Finder vornehmen. Wenn man wirklich so wie ich für die Entwicklung mit Eclipse die .plugin… Verzeichnisse und Dateien sehen will muss man auf der CommandLine = Terminal folgenden Befehl absetzen:

defaults write com.apple.Finder AppleShowAllFiles YES

mit Enter quittieren und den Finder bei gedrückter alt Taste und rechter Maustaste – Neu starten – neu starten. Ab dann sieht man alles. Wem das zuviel ist der kann die obige Zeile abändern auf ein NO am Ende und es ist wieder rückgängig gemacht. ACHTUNG es ist gut möglich dass diese Option bei einem späteren Update von Apple wieder rückgängig gemacht wird.





Eclipse Indigo unter MacOS Lion oder Linux hinter einem Proxy

1 12 2011

Heute habe ich mir das neue Eclipse Indigo (3.7) geladen und musste diverse Plugins für die Arbeit laden. Die Update Sites haben aber alle den Dienst verweigert, sind so bei 2% immer verweilt und haben nichts weiter gemacht. Nach einiger Recherche im Netz sieht es so aus als würden die manuellen Proxy Einstellungen im GUI nicht ziehen, da die Provider Implementierung die default die Proxy Verbindungen macht fehlerhaft implementiert ist. Um das Problem zu umgehen muss man in der eclipse.ini folgende Zeilen hinzufügen:

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=XXX
-Dhttp.proxyUser=XXX
-Dhttp.proxyPassword=XXX
-Dhttp.nonProxyHosts=localhost|127.0.0.1

Wenn man genau wissen will wie das Ganze zustande kommt kann man hier nachsehen. Seit der Umstellung im eclipse.ini geht bei mir alles fein. Am Mac ist das ini File im Ordner Eclipse.app/Contents/MacOS zu finden. Ich persönlich finde es recht ärgerlich dass das bei so einem mittlerweile professionellen und weit verbreiteten Entwicklungstool solche Probleme macht. Verbindungen durch Proxies sollten heutzutage keine Probleme mehr machen.





iPhone APN Einstellungen 2.0

1 12 2011

Hi. Letztes Jahr habe ich einen Artikel hier verfasst zur Einstellung der APN Einstellungen für das mobile Datennetz beim iPhone für A1. Bei den neueren Versionen hat man jetzt nicht mehr die Möglichkeit, diese Einstellungen selbst zu machen, hier muss ein sogenanntes Profile eingespielt werden. Bei Vertragsgebundenen Telefonen ist das bereits für den jeweiligen Provider eingespiel, bei netzoffenen Geräten, wie z.B. meinem iPhone 4 ist da nix drin und somit kann das mobile Datennetzwerk auch nicht aktiviert werden. Nach kurzer Recherche im Internet bin ich auf eine Seite, die mir bereits des öfteren geholfen hat gestossen benm.at. Die Seite ist zwar gesiedelt aber der Inhalt ist nach wie vor der gleiche. Mit dem iPhone den vorigen Link ansurfen und dann den Anweisungen am Bildschirm folgen. Es sollte ein Leichtes sein seinen Provider auszuwählen und dann das geeignete Profile herunterzuladen und einzuspielen. Bei mir hat das Ganze ca. 5 min. gedauert und jetzt funktioniert alles. Im Zuge der Auswahl wird dann auch das benm helpcenter url als Icon am Desktop vom iPhone abgelegt, ist aber nur ein Weblink, jedoch sehr nützlich sollte man sich die Einstellungen löschen.

Schrittweises Vorgehen:

  • am iPhone Safari öffnen
  • http://help.benm.at eingeben
  • Punkt “Tethering” auswählen
  • Land auswählen
  • Provider auswählen
  • Download auswählen (Profil wird heruntergeladen und angezeigt)
  • Installieren auswählen
  • Fertig

Fotostrecke:





Das @ Zeichen im Windows Remote Desktop unter Mac OS

1 12 2011

Ein kleines Problem hatte sich bei mir eingestellt. In meiner Windows Remote Desktop Session vom Mac aus hatte ich immer wieder das Problem, dass ich bei Email Adressen es nicht geschafft habe ein @ Zeichen einzugeben. Dabei ist es ganz einfach. Nach ein bisschen googeln wurde ich fündig. Die Tastenkombination dafür ist CTRL-ALT-Q.





SVN Development and DiffMerge using RapidSVN

1 12 2011

Hi. After moving back to a mac for working I had to install some development tools. I need a programmers editor, a svn client and a diff and merge tool. I decided to go with Smultron, RapidSVN and DiffMerge. All the apps work fine the only problem I had was to get DiffMerge working when calling a diff or merge from within RapidSVN. See this link for the right configuration and it works fine.

Links:

 








Follow

Get every new post delivered to your Inbox.