HPUX Breaking Mirror and Extending LVM 2 June 2009
Posted by Maulvi Bakar in : Unix, Work , add a commentI’m learning new things nowadays.. Particularly HPUX. Not really my cup of tea since it not open-source but interesting enough though.
We had one machine with mirrored harddisks with one being faulty that needs removal.
Break mirror procedure..
1. Remove the mirror on the Logical Volume affected within the Volume Group
lvreduce -m 0 /dev/vg01/lvol1
lvreduce -m 0 /dev/vg01/lvol2
2. Now remove the Volume Group from the Physical Volume that is targeted for removal
vgreduce /dev/vg01 /dev/dsk/c2t0d0
3. Finally remove the Physical Volume from the Physical Disk
pvremove /dev/rdsk/c2t0d0
Please note the ‘r’.. ‘r’ stands for physical disk, while the one without is the physical volume..
Restore mirror procedure…
1. First, let’s verify things
ioscan -funC disk
pvdisplay /dev/dsk/c1t0d0 # get lvm info of existing disk.
pvdisplay /dev/dsk/c2t0d0 # get err, no lvm def on it, raw disk.
2. Now we create the Physical Volume within the Physical Disk and extend the Volume Group onto it.
pvcreate /dev/rdsk/c2t0d0 # add physical disk to be used by LVM
vgextend /dev/vg01 /dev/dsk/c2t0d0 # incorporate new disk to existing vg00
3. Check and verify!
strings /etc/lvmtab # see new disk used by lvm
4. The next steps will actually perform the mirror, and it will fail if -m mirroring option is not activated with valid license
lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c2t0d0 # add mirror for lvol1
lvextend -m 1 /dev/vg01/lvol2 /dev/dsk/c2t0d0 # add mirror for lvol2
Enjoy!
Changing user’s file ownership across the board 25 December 2008
Posted by Maulvi Bakar in : Linux, Unix, Work , add a commentThe guys from the promised database lands had their systems acting funny. After investigation, they found out that, their files was having the wrong group ownership.
There’s a total of 70,000 files involved. Promised lands or not, manually changing 70,000 files (and folders) is not a good prospect. Well, I could go through the individual sub-folders but I would need to work from the last in-depth sub-folders and work my way out. Even that does not guarantee accuracy, since there might be sub-folders with multiple owners which I’m not suppose to touch. When that happen, then I have to go through it manually looking at each files and folders individually – not good.
There has to be a short-cut.
I know I can locate all the files that needs to be changed it’s ownership by using the following commands -
find ./ -user someuser -group wronggroup -print
It’ll list all the relevant files and sub-folders. At first, maybe I’ll output it into a file, all the results. Manipulate the file into an executable. Append each lines with a “chgrp correctgroup” and have something like – “chgrp correctgroup ./to/the/path/of/the/file”.
I am smart, hey!
Let’s prove that I can be smarter
Vanity and pride are different things, though the words are often used synonymously. A person may be proud without being vain. Pride relates more to our opinion of ourselves; vanity, to what we would have others think of us.
Jane Austen
No, I’m just trying to figure out the best way of doing things.
“xargs -t <commands>”
xargs is a command of Unix and most Unix-like operating systems. It is useful when one wants to pass a large number of arguments to a command. Arbitrarily long lists of parameters can't be passed to a command, so xargs will break the list of arguments into sublists small enough to be acceptable.
xargs - build and execute command lines from standard input
The “-t” is for the verbose option. It’ll spew out the output of the commands being executed.
Basically, every time the output of the earlier “find”, it’ll append the extra commands specified and have it executed. Voila, no need to make a separate executable. My solution is thus -
find ./ -user someuser -group wronggroup -print | xargs -t chgrp correctgroup
Happy 4th Anniversary to myself
Merry Christmas everyone!
Enjoy!
Linux NFS Server, AIX NFS Client 31 July 2008
Posted by Maulvi Bakar in : Linux, Unix, Work , 2 commentsHmmm..
We have a Linux NFS machine to extend the AIX Server’s chronic acute harddisk space shortage syndrome. Somehow, AIX Client could not mount the shared NFS folder from the Linux Server.
Apparently, AIX uses high ports to establish the connectivity to NFS Server. Linux NFS Server requires low ports (below 1024). So, you have to force AIX to use those reserved ports to establish the connection.
nfso -o nfs_use_reserved_ports=1
Then, the normal ‘mount’ should work from AIX after the medicine
Enjoy
unknown nfs status return value: -1 11 December 2007
Posted by Maulvi Bakar in : Linux, System, Unix, Work , 1 comment so farI’m trying to mount an NFS export from an AIX machine to a Linux client.
Had encountered the above problem. Apparently the NFS exports on AIX requires the client’s hostname and IP address within the /etc/hosts file.
Enjoy!
OpenBSD – Reloading pf.conf 18 September 2006
Posted by Maulvi Bakar in : Unix, Work , add a commentOpenBSD, world most secure OS. Also one of the most User-Hostile ones. Now, I needed to reload the firewall rules. Modified some settings in the /etc/pf.conf and this is how did it to reload the ruleset -
$ pfctl -f /etc/pf.conf
This will reload the ruleset plainly from the file specified. The -R flag only loads the filtering rules. -N only loads the NAT rules. Should there be need to reload just the filtering and/or NAT rules, just use the appropriate options.
Enjoy!