Convert a .dmg to a .iso
Issue:
Mac formatted disk image (.dmg) cannot be directly burned on Windows or Linux systems.
Resolution:
One can convert a .dmg to a CD master via the Disk Utility application embedded in OS X, or by opening a terminal window and issuing the following command:
The output file will be named savefile.iso.cdr -- you may strip the .cdr and burn the .iso with any standard utility for doing so.
Mirror a Directory Structure Using the Command Line
Issue:
You need to mirror the directory structure (but not contents) for a tree.
Resolution:
Execute the following command from the root of your source directory. Adjust the destination variable to suit your tastes: %i will match the first token, %j the second, %k the third, and %l will match everything else.
Reference: http://www.dostips.com/DtTipsStringManipulation.php
C compiler cannot create executables received after emerge world
Issue:
When attempting to emerge a new package after a recent emerge -DunNv world the new package emerge fails with:
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for builtin ELF support... yes
checking for ELF core file support... yes
checking for file formats in man section 5... no
checking for i686-pc-linux-gnu-gcc... i686-pc-linux-gnu-gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
. . .
Cause:
The issue is related to gcc being upgraded as part of a previously executed emerge world. The /etc/ld.so.conf and /etc/env.d/05gcc-i686-pc-linux-gnu files no longer point to valid gcc library and binary paths.
Resolution:
Gentoo provides the gcc-config command to set the active gcc compiler profile.
Sample gcc-config run to list the available gcc profiles and set the active profile to option 1:
[1] i686-pc-linux-gnu-4.3.2 *
root # gcc-config 1
* Switching native-compiler to i686-pc-linux-gnu-4.3.2 ... [ ok ]
Reference: http://forums.gentoo.org/viewtopic.php?t=27486&highlight=gcc
Shrink VirtualBox vdisks After Freeing Space (Windows guests)
Issue:
On dynamically allocated vdisks, freed space on a guest is never released back to the host once freed.
Cause:
This is by design.
Resolution:
The procedure for shrinking (compacting in VirtualBox parlance) is straightforward and consists of a series of steps.
- Delete files on the guest to achieve the desired amount of free space
- Zero free space out with an appropriate utility
- Shut down guest
- Compact disk
Zeroing guest free space is simple: Microsoft provides an excellent utility through its Sysinternals group called SDelete. Download the program, extract it from the archive, and execute it on the disk to be zeroed. Note: this procedure only zeroes free space.
One the zeroing procedure is completed, you may power off the guest and compact the virtual disk from the command line.
Note: This was tested against VirtualBox 3.0.4 r50677
References:
SDelete
Create a Large File For Testing
Issue:
Often you need a set of variable sized files for testing a particular scenario. Generating test data is a painless endeavor.
Resolution:
The Unix dd command is perfectly suited to dispatch this need.
The above command will create a 5 megabyte file full of zeroes. Lovely. You may adjust the count (or blocksize) to achieve the results you desire. This data also achieves stellar compression ratios based on its content.
One could also create a test file full of pseudo random data by pointing if to /dev/urandom.
Remote Mirroring Using nc and dd
You can use the dd and nc commands for exact disk mirroring from one server to another. The following commands send data from Server1 to Server2:
1 2 | Server2# nc -l 12345 | dd of=/dev/sdb Server1# dd if=/dev/sda | nc server2 12345 |
Make sure that you issue Server2's command first so that it's listening on port 12345 when Server1 starts sending its data.
Unless you're sure that the disk is not being modified, it's better to boot Server1 from a RescueCD or LiveCD to do the copy.
Reference: http://www.linuxjournal.com/content/tech-tip-remote-mirroring-using-nc-and-dd
Intel Matrix Storage Console Reports SATA Drives as Generation 1 not 2
Issue:
When launching the Intel Matrix Storage Console and reviewing the disposition of a mirrored pair of Seagate SATA 3.0Gb/s drives, I noted the Serial ATA transfer mode reported as Generation 1.
Cause:
SATA host adapters typically support autonegotiation, however, with the Intel ICH10R this does not seem to be the case with RAID enabled. Note: It does work with standard AHCI mode on this chipset.
Resolution:
Seagate drives ship with a jumper enabled for 1.5GB/s mode. One must remove this jumper to force the drive in 3.0GB/s mode.
Attachment: Seagate ST3500320AS product manual.
Cannot SSH into PIX/ASA firewall
Issue:
When attempting to SSH into a PIX/ASA firewall you receive the following error on the client
Investigating the log on the PIX/ASA will yield a corresponding error:
Cause:
The issue is the result of a corrupt or missing RSA key on the firewall.
Resolution:
You need to generate a new RSA key on the firewall.
Magic juju (from either SDM or a prompt):
ca generate rsa key 1024
wr mem
copy run start
rsync failed to set times on [filename]
This error occurs because the version of rsync on the system cannot preserve modified times for directories.
Run rsync with the following arguments to suppress this warning:
rsync -avrPO ./source/* ./destination
Explanation of switches:
1 2 3 4 5 | a -> Archive mode (do not preserve hard links, ACLs, or extended attributes) v -> Verbose (I like to know what is happening) r -> Copy directories recursively P -> Equivalent to --partial --progress (for long transfers that may be interrupted) O -> Omit directories from times |
Enable opportunistic locking with Sun SMB service on Solaris Nevada
The primary reason for implementing this is performance.
From Microsoft:
Opportunistic locking (oplock) is a mechanism that allows a server to tell a client process that a requested file is only being used by that process. The client can safely do read-ahead and write-behind as well as local caching, knowing that the file will not be accessed or changed in any way by another process while the opportunistic lock is in effect. The server notifies the client when a second process attempts to open or modify the locked file.
Reference: http://msdn.microsoft.com/en-us/library/dd327670.aspx
The snippet:
svccfg -s smb/server setprop smbd/oplock_enable=boolean: true