svccfg -s name-service/switch setprop config/ipnodes = astring: '("files dns")' svccfg -s name-service/switch setprop config/host = astring: '("files dns")' svccfg -s name-service/switch listprop config svcadm refresh name-service/switch
Monday, 29 February 2016
Add entry in /etc/nsswitch - Solaris 11
To add DNS to /etc/nsswitch.conf
Regex with awk
To use a regular expression in awk use the operator ~ and //, e.g/:
cat home-dir.txt | awk '{if ($3 !~ /^[0-9]/) print $0;}'to print any line that does not have a number in column 3
Monday, 25 January 2016
RedHat 7 - Software failed to update
If you have issues with yum updating your OS or packages, with this error:
Error downloading packages: lsscsi-0.27-3.el7.x86_64: [Errno 256] No more mirrors to try.Mount the DVD-ROM with the RedHat EL 7 source disk:
# mount /dev/cdrom /cdromMake sure your yum repo has this file: cdrom.repo:
[CDROM] name=CDROM baseurl=file:///cdrom enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releaseMake sure you are joined to the RHN with a valid subscription:
And if you have this error: rhn_register fails with "ERROR: can not find RHNS CA file:/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT", fix this using the instructions here: https://access.redhat.com/solutions/26435?tour=6 correcting these lines in /etc/sysconfig/rhn/up2date:
serverURL=https://xmlrpc.rhn.redhat.com/XMLRPC sslCACert=/usr/share/rhn/RHNS-CA-CERT
Thursday, 14 January 2016
Install .net Framework 3.5 on Windows Server 2012
Start up a PowerShell as Administrator and run this:
> Install-WindowsFeature -name NET-Framework-Core -source J:\sources\sxsWhere J is your install media drive letter.
Monday, 30 November 2015
Unknown filesystem type 'LVM2_member' - Debian
So you are working with LVM volumes specifically with LVM volumes that contain complete filesystems - i.e. virtual hard disks - and you are getting this 'unknown filesystem type 'LVM2_member' when you are trying to mount the volume. This error is encountered because this partition contain multiple LVM parts (i.e. members). The way you would mount these volumes is to extract this partition, mount it as a loop device and then use pvs/lvs and vgchange command to activate the LVM and mount.
Consider my LVM volume that exist on a Xen/Ganeti host:
# gnt-instance info migrate.isys [cut] Disk template: plain Disks: - disk 0: lvm, size 10.0G access mode: rw logical_id: volg1/50c29778-490a-4686-8a42-569d8b55f40c.disk0_data on primary: /dev/volg1/50c29778-490a-4686-8a42-569d8b55f40c.disk0_data (254:66) [cut]Use kpartx to separate the partitions of the volume:
# kpartx -a -p- /dev/volg1/50c29778-490a-4686-8a42-569d8b55f40c.disk0_data # ls -la /dev/mapper/volg1-50c29778* lrwxrwxrwx 1 root root 8 Nov 30 14:46 /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data -> ../dm-66 lrwxrwxrwx 1 root root 8 Nov 30 15:30 /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-1 -> ../dm-79 lrwxrwxrwx 1 root root 8 Nov 30 15:30 /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-2 -> ../dm-80Let's mount the first partition: /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-1
# mount /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-1 /mnt # ls -la /mnt total 34110 dr-xr-xr-x. 5 root root 1024 Nov 23 13:28 . drwxr-xr-x 23 root root 4096 May 11 2015 .. -rw-r--r--. 1 root root 107134 Jul 23 17:13 config-2.6.32-573.el6.x86_64 drwxr-xr-x. 3 root root 1024 Nov 23 13:27 efi drwxr-xr-x. 2 root root 1024 Nov 23 13:29 grub -rw-------. 1 root root 27635640 Nov 23 13:29 initramfs-2.6.32-573.el6.x86_64.img drwx------. 2 root root 12288 Nov 23 13:25 lost+found -rw-r--r--. 1 root root 205998 Jul 23 17:14 symvers-2.6.32-573.el6.x86_64.gz -rw-r--r--. 1 root root 2585052 Jul 23 17:13 System.map-2.6.32-573.el6.x86_64 -rwxr-xr-x. 1 root root 4220560 Jul 23 17:13 vmlinuz-2.6.32-573.el6.x86_64 -rw-r--r--. 1 root root 166 Jul 23 17:13 .vmlinuz-2.6.32-573.el6.x86_64.hmacLooks like it's the /boot partition. Fine, the rest of my disk is on the second partition, so let's mount that:
# mount /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-2 /mnt mount: unknown filesystem type 'LVM2_member'Uh-oh, can not mount: unknown filesystem type 'LVM2_member'. So the second partition must be made up of more than one LVM members. Lets make an image of this and mount it as a loop back filesystem to see what is inside.
# dd if=/dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data-2 of=/var/tmp/partition2.dd bs=1M 10039+0 records in 10039+0 records out 10526654464 bytes (11 GB) copied, 174.754 s, 60.2 MB/s # file partition2.dd partition2.dd: LVM2 PV (Linux Logical Volume Manager), UUID: NydiFK-CaAX-PWcz-I0pY-EpAk-4ViC-pIGpf0, size: 10526654464 # losetup /dev/loop0 partition2.dd # pvs PV VG Fmt Attr PSize PFree /dev/loop0 volg0 lvm2 a-- 9.78g 992.00m /dev/sda5 SYSTEM lvm2 a-- 79.76g 55.55g /dev/sdb1 volg1 lvm2 a-- 1.97t 1.96t # lvs LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert HOME SYSTEM -wi-ao-- 3.72g ROOT SYSTEM -wi-ao-- 7.45g SWAP SYSTEM -wi-ao-- 3.72g TMP SYSTEM -wi-ao-- 1.86g VAR SYSTEM -wi-ao-- 7.45g root volg0 -wi----- 7.81g swap volg0 -wi----- 1.00gHey look! It's made up of root and a swap member! Now if you want to mount these, you can now run the vgchange command and activate them:
# vgchange -ay volg0 2 logical volume(s) in volume group "volg0" now active # lvdisplay [snip] --- Logical volume --- LV Path /dev/volg0/root LV Name root VG Name volg0 LV UUID dAoIl6-WR4G-Z0d1-9Cgg-hevk-oSaf-7TTeGv LV Write Access read/write LV Creation host, time migrate.isys.bris.ac.uk, 2015-11-23 13:25:26 +0000 LV Status available # open 0 LV Size 7.81 GiB Current LE 250 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:5 --- Logical volume --- LV Path /dev/volg0/swap LV Name swap VG Name volg0 LV UUID L0haeP-jWyr-Gij9-sAhA-8mk6-VGS0-M42Gyl LV Write Access read/write LV Creation host, time migrate.isys.bris.ac.uk, 2015-11-23 13:25:30 +0000 LV Status available # open 0 LV Size 1.00 GiB Current LE 32 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:6 # mount /dev/volg0/root /mnt # ls /mnt bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr varAnd there you are, you have access to your root data! Copy it, move it, do anything you want, then perform the clean up-reverse actions:
# umount /mnt # vgchange -an volg0 0 logical volume(s) in volume group "volg0" now active # losetup -d /dev/loop0 # kpartx -d -p- /dev/volg1/50c29778-490a-4686-8a42-569d8b55f40c.disk0_data # ls -la /dev/mapper/volg1-50c29778* lrwxrwxrwx 1 root root 8 Nov 30 14:46 /dev/mapper/volg1-50c29778--490a--4686--8a42--569d8b55f40c.disk0_data -> ../dm-66
Wednesday, 25 November 2015
Puppet Error: Error 400 on SERVER: Error from DataBinding 'hiera' while looking up 'puppet_enterprise::certificate_authority_port': (): could not found expected ':'
If you get this Puppet error (when running puppet agent -t on your client):
Error 400 on SERVER: Error from DataBinding 'hiera' while looking up 'puppet_enterprise::certificate_authority_port': (): could not found expected ':'
It means that there is a syntax error in you hiera yaml file.
Friday, 20 November 2015
How to extend root partition in LVM
Follow these instructions!
https://rbgeek.wordpress.com/2013/01/27/how-to-extend-the-root-partition-in-lvm/
Subscribe to:
Posts (Atom)