Sunday, 19 June 2016

BOOK: How to Win Friends and Influence People


This is Dale Carnegie's summary of his book, from 1936


Table of Contents

  1. Fundamental Techniques in Handling People
  2. Six Ways to Make People Like You
  3. How to Win People to Your Way of Thinking
  4. Be a Leader: How to Change People Without Giving Offense or Arousing Resentment


Part One

Fundamental Techniques in Handling People


  1. Don't criticize, condemn or complain.
  2. Give honest and sincere appreciation.
  3. Arouse in the other person an eager want.


Part Two

Six ways to make people like you


  1. Become genuinely interested in other people.
  2. Smile.
  3. Remember that a person's name is to that person the sweetest and most important sound in any language.
  4. Be a good listener. Encourage others to talk about themselves.
  5. Talk in terms of the other person's interests.
  6. Make the other person feel important - and do it sincerely.


Part Three

Win people to your way of thinking


  1. The only way to get the best of an argument is to avoid it.
  2. Show respect for the other person's opinions. Never say, "You're wrong."
  3. If you are wrong, admit it quickly and emphatically.
  4. Begin in a friendly way.
  5. Get the other person saying "yes, yes" immediately.
  6. Let the other person do a great deal of the talking.
  7. Let the other person feel that the idea is his or hers.
  8. Try honestly to see things from the other person's point of view.
  9. Be sympathetic with the other person's ideas and desires.
  10. Appeal to the nobler motives.
  11. Dramatize your ideas.
  12. Throw down a challenge.


Part Four

Be a Leader: How to Change People Without Giving Offense or Arousing Resentment

A leader's job often includes changing your people's attitudes and behavior. Some suggestions to accomplish this:
  1. Begin with praise and honest appreciation.
  2. Call attention to people's mistakes indirectly.
  3. Talk about your own mistakes before criticizing the other person.
  4. Ask questions instead of giving direct orders.
  5. Let the other person save face.
  6. Praise the slightest improvement and praise every improvement. Be "hearty in your approbation and lavish in your praise."
  7. Give the other person a fine reputation to live up to.
  8. Use encouragement. Make the fault seem easy to correct.
  9. Make the other person happy about doing the thing you suggest.

Back to the Dale Carnegie Page, and Morgans' web pages

Saturday, 4 June 2016

The real dd command

Cool Learn The DD Command Revised


[Log in to get rid of this advertisement]
This post contains comprehensive documentation with examples for one of the most useful Linux/UNIX/Windows commands: dd. Dd is a bit-stream duplicator. If you have questions, post them. The latest addition, How To Encrypt an 8.0 GB SDHC MicroSD Card was on 06-19-2011.

First Time visitors please reply.

How To Encrypt an 8.0 GB SDHC MicroSD Card

Put the card into an USB adapter. Such devices are not perfect. One might have to push the MicroSD card into the reader as far as it will go, and others might have to pull it back a millimeter or two. If the kernel does not detect a partition on a new card, it's detecting the USB adapter only. Adjust the card slighty, and replace the adapter if necessary. Should show some new device(s):
Code:
ls /dev/sd*
/dev/sdb /dev/sdb1
Write random data to the drive:
Code:
dd if=/dev/urandom of=/dev/sdb bs=4k
/dev/sdb is only an example.
Code:
apt-get install cryptsetup
Learn to use parted, or I quit! Partition the card:
Code:
parted
Encrypt the partition with a good passphrase, one that's easy to remember, but hard to guess. DO NOT use the standard example, because everyone knows it: Deep inside, she knows she cannot attain masculinity, but she can attain masculinity deep inside!
Code:
cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb1
Open the encrypted device:
Code:
cryptsetup luksOpen /dev/sdb1 vol_1
Create a filesystem:
Code:
mkfs.xfs -imaxpct=3 /dev/mapper/vol_1
Mount:
Code:
mkdir /AES_Drive
&& mount /dev/mapper/vol_1 /AES_Drive
Umount:
Code:
umount /AES_Drive && cryptsetup luksClose /dev/mapper/vol_1
Just a footnote, Laptops that went to sleep with the encrypted volume open, may wake up with it open!

Linux DD
The basic command structure is as follows:
Code:
dd if=<source> of=<target> bs=<byte size> ("USUALLY" some power of 2, and usually not less than 512 bytes (ie, 512, 1024, 2048, 4096, 8192, 16384, but can be any reasonable whole integer value.) skip= seek= conv=<conversion>
Source is the data being read. Target is where the data gets written.

Warning!! If you reverse the source and target, you can wipe out a lot of data. This feature has inspired the nickname "dd" Data Destroyer. Warning!! Caution should be observed when using dd to duplicate encrypted partitions.

Examples: duplicate one hard disk partition to another hard disk partition: Sda2 and sdb2 are partitions. You want to duplicate sda2 to sdb2.
Code:
dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror
If sdb2 doesn't exist, dd will start at the beginning of the disk, and create it. Be careful with order of if and of. You can write a blank disk to a good disk if you get confused. If you duplicate a smaller partition to a larger one, using dd, the larger one will now be formatted the same as the smaller one. And there will be no space left on the drive. The way around this is to use
Code:
rsync
, as described below.

To make an iso image of a CD: This duplicates sector for sector. MyCD.iso will be a hard disk image file of the CD.
Code:
dd if=/dev/hdc of=/home/sam/myCD.iso bs=2048 conv=sync,notrunc
You can mount the image like this:
Code:
mkdir /mnt/myCD
mount -o loop /home/sam/myCD.iso /mnt/myCD
This will make the CD root directory the working directory, and display the CD root directory.
Code:
cd /mnt/myCD
This will duplicate a floppy disk to hard drive image file:
Code:
dd if=/dev/fd0 of=/home/sam/floppy.image
If you're concerned about spies taking the platters out of your hard drive, and scanning them using superconducting quantum-interference detectors, you can always add a "for" loop for US Government DoD approved secure hard disk erasure. Copy and paste the following two lines into a text editor.
Code:
#!/bin/bash 
for n in `seq 7`; do dd if=/dev/urandom of=/dev/sda bs=8b conv=notrunc; done
Save the file as anti_scqid.
Code:
chmod +x anti_swqid
Don't run the program until you want to wipe the drive.

Best Laptop Backup: Purchase a laptop drive and an USB 2.0 drive enclosure (Total cost $100.00USD). Assemble the lappy drive into the external enclosure. Plug the external drive into the lappy USB port, and boot with The Knoppix live CD. Launch a terminal. This command will backup the existing drive:
Code:
dd if=/dev/hda of=/dev/sda bs=64k conv=notrunc,noerror
This command will restore from the USB drive to the existing drive:
Code:
dd if=/dev/sda of=/dev/hda bs=64k conv=notrunc,noerror
If the existing disk fails, you can boot from the external drive backup and have your system back instantaneously.

This series will make a DVD backup of hard drive partition:
Code:
dd if=/dev/hda3 of=/home/sam/backup_set_1.img bs=1M count=4430 
dd if=/dev/hda3 skip=4430 of=/home/sam/backup_set_2.img bs=1M count=4430  
dd if=/dev/hda3 skip=8860 of=/home/sam/backup_set_3.img bs=1M count=4430
And so on. This series will burn the images to DVD+/-R/RW:
Code:
wodim -dev=/dev/hdc --driveropts=burnfree /home/sam/backup_set_1.img
and so forth. To restore the from the backup, load the DVDs in order, and use commands like these:
Code:
 dd if=/media/dvd/backup_set_1.img of=/dev/hda3 bs=1M conv=sync,noerror
Load another DVD
Code:
dd if=/media/dvd/backup_set_2.img of=/dev/hda3 seek=4430 bs=1M conv=sync,noerror
Load another DVD
Code:
dd if=/media/dvd/backup_set_3.img of=/dev/hda3 seek=8860 bs=1M conv=sync,noerror
and so forth.

If you wrote chat messages and emails to another girl, on your girlfriend's computer, you can't be sure the files you deleted are unrecoverable. But you can make sure if anyone were to recover them, that you wouldn't get busted.
Code:
dd if=/dev/sda | sed 's/Wendy/Janet/g' | dd of=/dev/sda
Where every instance of Wendy is replaced by Janet, over every millimeter of disk. I picked names with the same number of characters, but you can pad a smaller name with blanks.

This command will overwrite the drive with zeroes
Code:
dd if=/dev/zero of=/dev/sda bs=4k conv=notrunc
I just want to make sure my drive is really zeroed out!!
Code:
dd if=/dev/sda | hexdump -C | grep [^00]
... will return output of every nonzero byte on the drive. Play around with it. Sometimes drives don't completely zero out on the first try.

The following method of ouputting statistics applies to any dd command invocation. This is an example dd command so you can try it.
Code:
/bin/dd if=/dev/zero of=/dev/null count=100MB
When you want to know how far dd has gotten throwing 100MB of 512 byte blocks of zeroes into digital hell, open another terminal and do:
Code:
ps aux | awk '/bin\/dd/ && !/awk/ {print $2}' | xargs kill -s USR1 $1
In the terminal running the dd command you will find something like this:
Code:
33706002+0 records in
33706002+0 records out
17257473024 bytes (17 GB) copied, 34.791 s, 496 MB/s
If you enter the command again, you see more statistics:
Code:
58596452+0 records in
58596452+0 records out
30001383424 bytes (30 GB) copied, 60.664 s, 495 MB/s
Again
Code:
74473760+0 records in
74473760+0 records out
38130565120 bytes (38 GB) copied, 77.3053 s, 493 MB/s
and so on ... Until the command completes
Code:
100000000+0 records in
100000000+0 records out
51200000000 bytes (51 GB) copied, 104.193 s, 491 MB/s
How To Scan a dd Bitstream for Viruses and Malware:
Code:
 dd if=/home/sam/file.file | clamscan -
Windows users will find help in the second post, way at the bottom

FYI: duplicating smaller partition or drive to larger partition or drive; or vice versa:
Code:
rsync -avH --exclude=/other_mount_point/ /mount_point/* /other_mount_point/
You want to duplicate the root directory tree to another drive, but the other drive is larger. If you use dd, you will get a file system that is smaller then the larger destination drive. To duplicate files, not the file system: Format and mount the destination drive. Rsync will duplicate the files as files:
Code:
 rsync -avH --exclude=/mnt/destination_drive/  /* /mnt/destination_drive/
You need to run:
Code:
grub-install
update-grub
from a the rescue menu of an installation CD/DVD for the target to become bootable. If target was previously bootable, it remains bootable.

Making a NTFS partition, is not easy without using Windows based tools. I was formatting an external drive for my brother, who uses MS Windows XP. I wasn't going to admit Linux couldn't make a NTFS partition.

Make an ext3 partition on the drive. Open a hex editor and make a file containing
Code:
07
Save the file as file.bin. Change the ext3 partition to NTFS:
Code:
dd if=/home/sam/file.bin of=/dev/sdb bs=1 seek=450 count=1
Will change the partition type byte at offset
Code:
0x1c2
from Linux type:
Code:
0x83
, to NTFS type:
Code:
0x07
Please use a drive without important data on it. And, If you use a text editor to make the binary 07 file, you will ruin the existing partition table, because ascii 07 is two hexadecimal bytes (0x3037).

The four primary partition type byte offsets are:
Code:
0x1c2=450 
0x1d2=466
0x1e2=482
0x1f2=498
If the dd seek= parameter is changed from 450 to a one of the other values, it will change partition (hd0,1), (hd0,2), or (hd0,3) to NTFS type, rather than partition (hd0,0).

To be revised at a later date:
To make a bootable flash drive: Download 50 MB Debian based distro here:
http://sourceforge.net/projects/insert/

Plug in the thumb drive into a USB port. Do:
Code:
dmesg | tail
Look where the new drive is, sdb1, or something similar. Do:
Code:
dd if=/home/sam/insert.iso of=/dev/sdb ibs=4b obs=1b conv=notrunc,noerror
Set the BIOS to USB boot, and boot.
End to be revised

This command will duplicate the MBR and boot sector of a floppy disk to hard drive image:
Code:
dd if=/dev/fd0 of=/home/sam/MBRboot.image bs=512 count=2
To clone an entire hard disk. /dev/sda is the source. /dev/sdb is the target:
Code:
dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror
Do not reverse the intended source and target. It happens once in a while, especially to the inexperienced user. Notrunc means 'do not truncate the output file'. Noerror means to keep going if there is an error. Dd normally terminates on any I/O error.

Duplicate MBR, but not partition table. This will duplicate the first 446 bytes of the hard drive to a file:
Code:
dd if=/dev/sda of=/home/sam/MBR.image bs=446 count=1
If you haven't already guessed, reversing the objects of if and of, on the dd command line, reverses the direction of the write.

To wipe a hard drive: (Boot from a live CD distro to do this.)
Code:
dd if=/dev/zero of=/dev/sda conv=notrunc
This is useful for making the drive like new. Most drives have 0x00h written to every byte, from the factory.

To overwrite all the free disk space on a partition (deleted files you don't want recovered):
Code:
dd if=/dev/urandom of=/home/sam/bigfile.file
When dd ouputs
Code:
no room left on device
all the free space has been overwritten with random characters. Delete the big file with
Code:
rm bigfile.file
.

Sometimes one wants to look inside a binary file, looking only for clues. The output of the command line:
Code:
less /home/sam/file.bin
is cryptic, because it's binary. For human readable output:
Code:
dd if=/home/sam/file.bin | hexdump -C | less
You may also use:
Code:
 dd if=/home/sam/file.file | strings -n 8 -t d | less
Recover deleted JPEG files. Look at the header bytes of any JPEG.
Code:
dd if=/home/sam/JPEG.jpg bs=1w count=2 | hexdump -C
The last two bytes are the footer.
Code:
dd if=JPEG.jpg | hexdump -C
Using the JPEG header and footer bytes, search the drive. Command returns the offsets of the beginning and end of each deleted JPEG.
Code:
dd if=/dev/sda3 | hexdump -C | "grep 'ff d8 ff e0' | 'ff d9'"
If
Code:
grep
returned JPEG header bytes at offset:
Code:
0xba0002f
and footer bytes at offset:
Code:
0xbaff02a
Convert the hex offsets to decimal offsets, using one of the many logic capable calculators for Linux. Decimal offsets corresponding to the beginning and end of the JPEG are 195 035 183 and 196 079 658. (196 079 658) - (195 035 183) = rough idea of proper bs= and count= parameters. To find the proper count= figure: (<decinal offset of footer bytes> - <decimal offset of header bytes>) / <block size> = <number of blocks in the deleted JPEG file>. (195 035 183 – 196 079 658) = (1 044 475) / (bs=4096) = (254.998). That's really close to 255. If we could land exactly at the header bytes using bs=4096, we could use count=255. But I'm going to use count=257, because random chance dictates the probability of landing dead on the header bytes, using 2^x block size is remote. So we start reading before the header bytes.

We need to use skip= parameter to skip to our start point: 195 035 183 / bs=4096 = 47 616.011. We always round down, so dd will start reading before the beginning of the file. In this case we round down to skip=47615. The following writes a file containing the JPEG with some unwanted bytes before and after.
Code:
dd if=/dev/sda3 skip=47615 of=/home/sam/work_file.bin count=257 bs=4096
This sequence yields the desired JPEG.
Code:
hexdump -C work_file.bin | "grep 'ff d8 ff e0' | 'ff d9'"
dd if=work_file.bin skip=<offset_of_first_header_byte_in_decimal_format> count=<offset_of_last_footer_byte_in_decimal_format +1> - <offset_of_first_header_byte_in_decimal_format> bs=1c of=JPG.jpg
That's the way to get your hands dirty deep in digital data. But this process it automated in the file carving program, foremost.

The principle of file carving negates the need for Linux undelete programs. So if your from a MS Windows world, don't google for linux undelete, but rather, foremost NEXT ...

I put two identical drives in every one of my machines. Before I do anything that most probably spells disaster, like an untested command line in a root shell, that contains
Code:
find / -regex ?*.???* -type f | xargs rm -f "$1"
, I do:
Code:
dcfldd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror
and duplicate my present working /dev/sda drive system to the /dev/sdb drive. If I wreck the installation on sda, I boot from a live CD distro, and do:
Code:
dd if=/dev/sdb of=/dev/sda bs=4096 conv=notrunc,noerror
And I get everything back exactly the same it was before whatever daring maneuver I was trying didn't work. You can really, really learn Linux this way, because you can't wreck what you have an exact duplicate of. You also might consider making the root partition separate from /home, and make /home big enough to hold the root partition, plus more. Then, To make a backup of root:
Code:
dd if=/dev/sda2 (root) of=/home/sam/root.img bs=4096 conv=notrunc,noerror
To write the image of root back to the root partition, if you messed up and can't launch the X server, or edited /etc/fstab, and can't figure out what you did wrong. It only takes a few minutes to restore a 15 GB root partition from an image file:
Code:
dd if /home/sam/root.img of=/dev/sda2 (root) bs=4096 conv=notrunc,noerror


How to make a swap file, or another swapfile on a running system:
Code:
dd if=/dev/zero of=/swapspace bs=4k count=250000
mkswap /swapspace
swapon /swapspace
This can solve out of memory issues due to memory leaks on servers that cannot easily be rebooted.

How to pick proper block size:

Code:
dd if=/dev/zero bs=1024 count=1000000 of=/home/sam/1Gb.file
dd if=/dev/zero bs=2048 count=500000 of=/home/sam/1Gb.file
dd if=/dev/zero bs=4096 count=250000 of=/home/sam/1Gb.file
dd if=/dev/zero bs=8192 count=125000 of=/home/sam/1Gb.file
This method can also be used as a drive benchmark, to find strengths and weaknesses in hard drives:
Read:
Code:
dd if=/home/sam/1Gb.file bs=64k | dd of=/dev/null
Write:
Code:
dd if=/dev/zero bs=1024 count=1000000 of=/home/sam/1Gb.file
When dd finishes it outputs (total size)/(total time). You get the idea.
Play with 'bs=' and 'count=', always having them multiply out to the same toal size. You can calculate bytes/second like this: 1Gb/total seconds = Gb/s. You can get more realistic results using a 3Gb file.

Rejuvenate a hard drive
To cure input/output errors experienced when using dd. Over time the data on a drive, especially a drive that hasn't been used for a year or two, grows into larger magnetic flux points than were originally recorded. It becomes more difficult for the drive heads to decipher these magnetic flux points. This results in I/O errors. Sometimes sector 1 goes bad, resulting in a useless drive. Try:
Code:
dd if=/dev/sda of=/dev/sda
to rejuvenate the drive. Rewrites all the data on the drive in nice tight magnetic patterns that can then be read properly. The procedure is safe and economical.

Make a file of 100 random bytes:
Code:
dd if=/dev/urandom of=/home/sam/myrandom bs=100 count=1
/dev/random produces only as many random bits as the entropy pool contains. This yields quality randomness for cryptographic keys. If more random bytes are required, the process stops until the entropy pool is refilled (waggling your mouse helps). /dev/urandom does not have this restriction. If the user demands more bits than are currently in the entropy pool, it produces them using a pseudo random number generator. Here, /dev/urandom is the Linux random byte device. Myrandom is a file.

Randomize data over a file before deleting it:
Code:
ls -l
to find filesize.
In this case it is 3769
Code:
ls -l afile -rw------- ... 3769 Nov 2 13:41 <filename>
Code:
dd if=/dev/urandom of=afile bs=3769 count=1 conv=notrunc
duplicate a disk partition to a file on a different partition.

Warning!! Do not write a partition image file to the same partition.
Code:
dd if=/dev/sdb2 of=/home/sam/partition.image bs=4096 conv=notrunc,noerror
This will make a file that is an exact duplicate of the sdb2 partition. You can substitue hdb, sda, hda, etc ... OR
Code:
dd if=/dev/sdb2 ibs=4096 | gzip > partition.image.gz conv=noerror
Makes a gzipped archive of the entire partition. To restore use:
Code:
 dd if=partition.image.gz | gunzip | dd of=/dev/sdb2
For bzip2 (slower,smaller), substitute bzip2 and bunzip2, and name the file
Code:
< filename >.bz2
.Restore a disk partition from an image file.
Code:
dd if=/home/sam/partition.image of=/dev/sdb2 bs=4096 conv=notrunc,noerror
Convert a file to uppercase:
Code:
dd if=filename of=filename conv=ucase
Make a ramdrive:
The Linux kernel makes a number a ramdisks you can make into ramdrives. You have to populate the drive with zeroes like so:
Code:
dd if=/dev/zero of=/dev/ram7 bs=1k count=16384
Populates a 16 MB ramdisk.
Code:
mke2fs -m0 /dev/ram7 4096
puts a file system on the ramdisk, turning it into a ramdrive. Watch this puppy smoke.
Code:
debian:/home/sam # hdparm -t /dev/ram7
/dev/ram7:
Timing buffered disk reads:   16 MB in  0.02 seconds = 913.92 MB/sec
You only need to do the timing once, because it's cool. Make the drive again, because hdparm is a little hard on ramdrives. You can mount the ramdrive with:
Code:
mkdir /mnt/mem
mount /dev/ram7 /mnt/mem
Now you can use the drive like a hard drive. This is particularly superb for working on large documents or programming. You can duplicate the large file or programming project to the ramdrive, which on my machine is at least 27 times as fast as /dev/sda, and every time you save the huge document, or need to do a compile, it's like your machine is running on nitromethane. The only drawback is data security. The ramdrive is volatile. If you lose power, or lock up, the data on the ramdrive is lost. Use a reliable machine during clear skies if you use a ramdrive.

Duplicate ram memory to a file:
Code:
dd if=/dev/mem of=/home/sam/mem.bin bs=1024
The device
Code:
/dev/mem
is your system memory. You can actually duplicate any block or character device to a file using dd. Memory capture on a fast system, with bs=1024 takes about 60 seconds, a 120 GB HDD about an hour, a CD to hard drive about 10 minutes, a floppy to a hard drive about 2 minutes. With dd, your floppy drive images will not change. If you have a bootable DOS diskette, and you save it to your HDD as an image file, when you restore that image to another floppy it will be bootable.

Dd will print to the terminal window if you omit the
Code:
of=/dev/output
part.
Code:
dd if=/home/sam/myfile
will print the file myfile to the terminal window.

To search the system memory:
Code:
dd if=/dev/mem | strings | grep 'some-string-of-words-in-the-file-you-forgot-to-save-before-the-power-failed'
If you need to cover your tracks quickly, put the following commands in a script to overwrite system ram with zeroes. Don't try this for fun.
Code:
mkdir /mnt/mem
mount -t ramfs /dev/mem /mnt/mem
dd if=/dev/zero > /mnt/mem/bigfile.file
This will overwrite all unprotected memory structures with zeroes, and freeze the machine so you have to reboot (Caution, this also prevents committment of the file system journal, and could trash the file system).

You can get arrested in 17 states for doing this next thing. Make an AES encrypted loop device:
Code:
dd if=/dev/urandom of=/home/sam/aes-drv bs=16065b count=100
modprobe loop
modprobe cryptoloop
modprobe aes
losetup -e aes /dev/loop1 ./aes-drv
password:
mkreiserfs /dev/loop1
mkdir /aes
mount -o loop,encryption=aes,acl ./aes-drv /aes
password:
mv /home/sam/porno /aes
to get the porno on the aes drive image.
Code:
umount /aes
losetup -d /dev/loop1
rmmod aes 
rmmod cryptoloop
rmmod loop
to make 'aes-drv' look like a 400 MB file of random bytes. Every time the lo interface is configured using losetup, according to the above, and the file 'aes-drv' is mounted, as above, the porno stash will be accessible in /aes/porno. You don't need to repeat the dd command, OR, the format with reiserfs, OR, the mv command. You only do those steps once. If you forget the password, there is no way to recover it besides guessing. Once the password is set, it can't be changed. To change the password, make a new file with the desired password, and move everything from the old file to the new file. Acl is a good mount option, because it allows use of acls. Otherwise your stuck with u,g,o and rwx.

If you are curious about what might be on you disk drive, or what an MBR looks like, or maybe what is at the very end of your disk:
Code:
dd if=/dev/sda count=1 | hexdump -C
Will show you sector 1, or the MBR. The bootstrap code and partition table are in the MBR.
To see the end of the disk you have to know the total number of sectors, and the MAS must be set equal to the MNA. The helix CD has a utility to set this correctly. In the dd command, your skip value will be one less than MNA of the disk. For a 120 GB Seagate SATA drives
Code:
dd if=/dev/sda of=home/sam/myfile skip=234441646 bs=512
,
So this reads sector for sector, and writes the last sector to myfile. Even with LBA addressing, disks still secretly are read in sectors, cylinders, and heads.
There are 63 sectors per track, and 255 heads per cylinder. There is a total cylinder count. 512_bytes/sector*63_sectors/track*255heads=16065*512bytes/cylinder=8,225,280_bytes/cylinder. 63_sectors/track*255_heads=sectors/cylinder. With 234441647 total sectors, and 16065 sectors per cylinder, you get some trailing sectors which do not make up an entire cylinder: 14593.317584812_cylinders/drive. This leaves 5102 sectors which cannot be partitioned, because to be in a partition you have to be a whole cylinder. It's like having part of a person. That doesn't really count as a person. These become surplus sectors after the last partition. You can't ordinarily read past the last partition. But dd can. It's a good idea to check for anything writing to surplus sectors. For our Seagate 120 GB drive, 234,441,647_sectors/drive - 5102_surplus_sectors = 234,436,545 partitionable sectors.
Code:
dd if=/dev/sda of=/home/sam/myfile skip=234436545
writes the last 5102 sectors to myfile. Launch midnight commander (mc) to view the file. If there is something in there, you do not need it for anything. In this case you would write over it with random characters:
Code:
dd if=/dev/urandom of=/dev/sda bs=512 seek=234436545
Will overwrite the 5102 surplus sectors on our 120 GB Seagate drive.

Block size:
One cylinder in LBA mode = 255_heads*63_sectors/track=16065_sectors=16065*512_bytes=8,225,280_bytes. The b means '* 512'. 32130b represents a two cylinder block size. Cylinder block size always works to cover every sector in a partition, because partitions are made of a whole number of cylinders. One cylinder is 8,225,280 bytes. If you want to check out some random area of the disk:
Code:
dd if=/dev/sda of=/home/sam/myfile bs=4096 skip=2000 count=1000
Will give you 8,000 sectors in myfile, after the first 16,000 sectors. You can open that file with a hex editor, edit some of it, and write the edited part back to disk:
Code:
dd if=/home/sam/myfile of=/dev/sda bs=4096 seek=2000 count=1000
Image a partition to another machine:
On source machine:
Code:
dd if=/dev/hda bs=16065b | netcat < targethost-IP > 1234
On target machine:
Code:
netcat -l -p 1234 | dd of=/dev/hdc bs=16065b
Variations on target machine:
Code:
netcat -l -p 1234 | bzip2 > partition.img
makes a compressed image file using bzip2 compression.
Code:
netcat -l -p 1234 | gzip > partition.img
makes a compressed image file using gzip compression. I back up a 100 GB lappy disk on a desktop drive, over a lan connection, and the 100 GB compresses to about 4.0 GB. Most of the drive is empty, so it's mostly zeroes. Repetitive zeroes compress well.
Alert!! Don't hit enter yet. Hit enter on the target machine. THEN hit enter on the source machine.

Netcat is a program, available by default, on most linux installations. It's a networking swiss army knife. In the preceding example, netcat and dd are piped to one another. One of the functions of the linux kernel is to make pipes. The pipe character looks like two little lines on top of one another, both vertical. Here is how this command behaves: This byte size is a cylinder. bs=16065b equals one cylinder on an LBA drive. The dd command is piped to netcat, which takes as its arguments the IP address of the target(like 192.168.0.1, or any IP address with an open port) and what port you want to use (1234).

You can also use ssh.
Code:
dd if=/dev/sdb2 | ssh sam@192.168.0.121 "sudo dd of=/home/sam/sdb2.img"
CONTINUED ... SEE NEXT POST

Dd is like Symantec Norton Ghost, Acronis True Image, Symantec Drive Image. You can perform disk drive backup, restore, imaging, disk image, cloning, clone, drive cloning, transfer image, transfer data, clone to another drive or clone to another machine, move Windows XP to a new hard drive, clone Windows XP, clone Windows, transfer Windows, hard drive upgrade, duplicate a boot drive, duplicate a bootable drive, upgrade your operating system hard drive, Tired of reinstalling WinXP Windows XP?

Copyright 2008, 2010 by AwesomeMachine.
All Rights Reserved.

Last edited by AwesomeMachine; 06-19-2011 at 03:07 PM. Reason: revision
 
Click here to see the post LQ members have rated as the most helpful post in this thread.

Thursday, 31 March 2016

Tinjauan buku buku. Book revews

Buku-buku yang menarik:
================

Kesukaan kami sekeluarga ialah singgah di kedai-kedai buku di mana sahaja kami pergi. MPH, Popular dan Konikunya...


1. Tajuk: THE MAGIC OF THINKING BIG

Penemuan: Sangat baik untuk semua peringkat umur. 

Disyorkan untuk bacaan anda 100%! :-)
 

 
Inilah buku pengembangan diri [self-improvement] pertama saya beli "THE MAGIC OF THINKING BIG", First UK paperback edition 1984 karya Dr David J Schwartz (1959). Buku ajaib ini saya beli  di MPH Bukit Bintang Plaza, Kuala Lumpur pada tahun 1991. Harganya pada masa itu cuma RM14.90.

Buku pengembangan diri terbaik dalam kehidupan saya. "Ajaib" kerana dengan izin Allah, buku ini telah membuka minda saya tentang kehidupan ini dari sudut yang lebih positif dan bermakna sekali. Tidak dapat saya nyatakan dengan perkataan... tetapi saya sangat bersyukur dapat membaca buku ini. 



Penemuan: Sangat baik untuk semua peringkat umur. 

Disyorkan untuk bacaan anda 100%! :-)
 


2. Tajuk buku : Berpikir & berjiwa besar.


Penemuan: Sangat baik untuk semua peringkat umur. 

Disyorkan untuk bacaan anda 100%! :-)

Buku versi Bahasa Indonesia, saya jumpai di sebuah kedai buku di Batam, Indonesia pada tahun 2012. Berpikir & berjiwa besar, KARISMA Publishing Group, Batam, Indonesia. Harga Rp40,000.[RM12]
Alih bahasa Oleh Drs F.X. Budiyanto
Editor Dr. Lyndon Saputra



Penemuan: Sangat baik untuk semua peringkat umur. 

Disyorkan untuk bacaan anda 100%! :-)


========================================================================



3. Tajuk buku : "IMAM GHAZALI, UMPAMA LAUTAN TIDAK BERTEPI".

Penemuan: hanya utk pencinta Imam khomeini. 

Tidak Disyorkan untuk bacaan :-(




     TAJUK = "IMAM GHAZALI, UMPAMA LAUTAN TIDAK BERTEPI".
     Penulis:     Syed Mahadzir Syed Ibrahim
     Penerbit:    GREEN DOME (2014).

Kata-kata Imam Ghazali di muka belakang buku ini membuat saya terpesona untuk membaca buku ini dan terus membelinya.

Setelah membaca sehingga muka surat 51, saya menjadi curiga kerana penulis buku mengisahkan "Imam Khomeini"... Siapa "Imam Khomeini" ini???

Di dalam hati saya bertanya "Astargfirullah.... Apakah tujuan penulis buku ini???"  Setahu saya Imam Khomeini ini pemimpin Negara Iran yang berfahaman syi'ah....

Pendek cerita, saya terus ambil pen, tandakan ??? di muka surat 51 dan terus tutup buku ini.

Saya fikir buku ini merepek, cuba meracuni fikiran pembaca.


Penemuan: TIDAK baik untuk semua peringkat umur. 

Tidak Disyorkan untuk bacaan :-(


Kesimpulan.
========

JAUHI BUKU INI!!!

JANGAN BELI BUKU INI: perkara sebenar yang saya ingin tulis di blog kali ini ialah kerana saya tersilap beli buku! Ya, saya menyesal membeli buku ini:

Wednesday, 2 March 2016

Petua menghalau Anai-anai


Petua menghalau Anai-anai

Kaedah tradisional:

Petua ini sebagaimana Acit dah cuba sendiri di beberapa tempat ,Alhamdulillah, Sang Anai-anai terpaksa akur dengan pukulan "KO" sehingga merajuk bawa diri. Petua ini diajar oleh Guru Acit. Ambil hati pari ( kalau boleh ikan pari yang besar - minta free je kat pasar tu... ) ditanam di keliling rumah mengikut anggaran jarak yang berpatutan atau ditanam di dalam lubang yang yang dikorek dalam rumah ( ditepi lubang anai-anai ). Kalau dalam rumah , tutop lantai tersebut dengan filler atau simen supaya tidak dihurungi semut. Begitu juga ia boleh ditanam pada pangkal pokok ( seperti Durian ) yang mengalami masalah yang sama.Tapi awas ! gunakan glove untuk memegang hati pari ; bau hati pari yang sudah lama akan melekat pada tangan anda , takut nanti anda pula yang "KO" , bukannya anai-anai... Rumah yang baru dibina juga lagi bagus tanamkan hati pari terlebih dahulu dibawahnya atau ditepi foundation atau beamnya.Kata Guru Acit,guna ikan buntal pun boleh kerana ada rumah kawan-kawan saya yang tanam IKAN BUNTAL, maklumlahlah rumah deme tu dekat pantai, senanglah nak dapat ikan buntal  tapi saya sendiri tak pernah cuba.

Kaedah Kimia:

Ni ada lagi satu petua yang acit baru cuba sebab rumah orang tua acit rumah separuh kayu di kampung memang eloklah buat xperiment lagi pun kawasannya tanah berpasir dan memang menjadi tempat anai-anai membina Bandar Teknologinya. Lagi pun kosnya MURAH tetapi berkesan.Acit beli racun serangga FURADAN yang berbiji-biji halus berwarna unggu/purple dijual dalam peket. Ia boleh dibeli di kedai menjual baja racun atau alat pertanian.



Dari segi ekonomi, kalau beli racun anai-anai sebotol kecil 70ml harganya RM7.00, sekali guna dah habis dan tak bertahan lama. Sejenis lagi racun yang mempunyai kandungan sama seperti Furadan iaitu KENFURAN dan harganya lebih murah. Kalau Furadan harganya RM14, Kenfuran ini hanya RM10.Terpulanglah samada nak guna Hang Tuah atau Si Jebat.. walaupun kedua-duanya mempunyai kandungan peratus bahan kimia yang sama malah harganya berbeza , tentulah di antara keduanya itu ada yang lebih baik. mungkin ada yang lebih ummph !. Ada juga jenama yang lain tetapi kandungan Bahan Aktif Carbofuran sama sahaja iaitu 3.0%. Harganya RM12 sepeket. Jenis berbutir atau berbiji halus, sama juga seperti jenama yang lain. Walaupun sama tetapi tidak serupa kerana kesan tindakan atau keberkesanan FURADAN lebih pantas.. terbaeek !


Kaedah:

Buat camna, gali atau korek di sekeliling rumah dan tanamkan beberapa sudu. Ceduk racun tu gunakan sudu atau gunakan corong dan sarong tangan plastik kerana ia satu racun yang kuat kesannya. Jikalau disiram air atau terkena air hujan, racun tersebut akan meresap ke seluruh bahagian dalam dan laluan anai-anai itu menyebabkan ia mati atau meninggalkan sarangnya. Racun tersebut pula selagi belum habis, ia masih berada dikawasan sarang tersebut. Hati-hati bila memeriksa kembali sarang anai-anai yang ditinggalkan itu dibimbangi tangan yang kita terkena racun yang masih ada atau melekat pada sarang anai-anai itu; sebaiknya gunakan sarong tangan atau dikuis menggunakan kayu. Kalau anai-anai ni berumah kat tiang atau pada dinding atau pada pangkal/batang pokok , Racun Furadan ini dicampurkan air, dikacau dan disiramkan pada sarangnya. Maka anai-anai akan jatuh 'gedebuk' serta merta. Gambar Sarang Anai-anai bawah rumah yang telah dibubuh Furadan.



Babi

Kalau Racun Furadan digaul dengan perut ikan atau nangka cempedak atau ubi kayu ke.. dan diberi jamu pada babi, semua babi yang memakannya KO.. KO..satu persatu. Champion betul lah Furadan nih.


Sarang atau busut anai-anai

Kalau ada sarang atau busut anai-anai tu, korek atau cangkul sedikit dan taburkan racun tu dan kalau ada nampak lubang-lubangnya, bubuhkan dengan sudu yang kecil atau guna paip getah atau corong kecil supaya racun tu terus masuk ke dalam lubang dan laluan anai-anai itu, kadang-kadang lama juga nak tunggu lubang tu penuh kerana mungkin lubang tu berlengkar-berlengkar di dalamnya. Kemudian kawasan tu dibasahkan dengan air. Maka racun tersebut telah bertindak dengan ganasnya dan boleh bertahan lama..Yang ni pun boleh cuba try, hasilnya bagus ! Telah dicuba.. Samaada anai-anainya semuanya mati di situ atau lintang pukang lari meninggalkan sarangnya dan mati di tempat lain ! Yang pastinya, sarang anai-anai itu telah kosong..kosong..kosong.

Terima Kasih kepada:
http://acitbudi-tujohbintang.blogspot.my/2009/07/petua-menghalau-anai-anai.html

Anai-anai? Pencegahan dan rawatan


Salam alaik,

        Jika ingin membuat tindakan preventif supaya anai-anai tidak menyerang 
rumah, saya berikan tips. 

A.        Kenal Anai-Anai
        1. Anai-anai suka kelembapan tinggi dan makanan utama ialah serat kayu 
hidup dan mati. 
        2. Anai-anai ada berpuluh species. Yang putih, yang kuning, yang perang 
.... Queen anai-anai ada banyak dalam satu koloni. Askar anai-anai menjaga 
anak-anak. Anai-anai yang berkepak mencari-cari tempat baru membina koloni 
macam kelakatu berterbangan.
        3. Kalau nampak banyak kelakatu berterbangan, pasti berhampiran ada 
koloni anai-anai.
        4. Anai-anai tak tahan matahari. Cepat mati. Sebab tu mereka samada 
membuat lorong tanah atas kayu/simen/konkrit atau menggali terowong dalam tanah.
        5. Anai-anai suap-menyuap makanan kepada rakan masing-masing. 
        6. Dalam perut anai-anai ada ribuan protozoa ( hidupan macam kuman ) 
yang mengkhadamkan serat kayu yang ditelannya.

B.        Dah kenal. Maka tiba masa mengurangkan minat anai-anai dari rumah kita:

        1. Pastikan laman rumah bersih dan pokok-pokok kecil di-trim. Rumput 
dan lalang dicantas.
        2. Pastikan tiada sampah, timbunan kayu, perabut reput, pokok mati dan 
tunggul pokok berhampiran rumah
        3. Pastikan air parit mengalirkan air terus ke saliran parit besar. 
Pastikan parit rumah tak pecah dan berumput.
        4. Pastikan bawah rumah tiada takungan air.
        5. Tutup rekahan-rekahan yang dijumpai pada bahagian dinding dengan 
simen atau kapur.
        6. Pastikan paip-paip bocor berhampiran tanah dibaiki segera. 
Tanah-tanah yang lembap menarik anai-anai buat sarang.
        7. Kalau terjumpa koloni anai-anai di halaman, jangan cuba buang 
sendiri sebab nanti yang saki-baki akan mencari tempat baru terutama sekali 
rumah. Panggil pakar.
        8. Pastikan perabut buruk, buku-buku, kertas, pakaian, akhbar lama, 
kayu dan apa saja barang dah tak mahu pakai lagi, dikeluarkan dari rumah dan 
dibuang terus.

        Bermakna, kita kena rajin dan suka laman rumah yang bersih dan cantik. 
Dan juga rajin menjaga kebersihan dalam rumah. Kalau kita buat di atas, kita 
juga mengurangkan serangan nyamuk, ulat gonggok, ular, tikus, kutu anjing, 
lipas dan cicak. 

 C.       Tiba masa untuk buat kubu pertahanan. Kalau nak cantik, suruh 
kontraktor yang buat. 
        > Buat kubu pasir sekeliling rumah atau sekeliling bahagian rumah yang 
jejak pada tanah, terutama sekali berhampiran foundation rumah. Jarak dalam 
beberapa inci lah dari bahagian tu.
        > Gali 6 inci ke dalam tanah dan 6 inci lebar. 
        > Masukkan pasir yang saiznya standard iaitu diameter 1mm majoritinya. 
Kalau pakai ayak besi atau aluminium saiznya mesh 16. Mesti saiz tu. Sebab 
kalau pasir terkecil, anai-anai boleh pikul dan kalau terbesar, anai-anai boleh 
lalu kat celah. 
        > Tutup bahagian atas dengan simen atau bahan composite yang tak 
disukai anai-anai.
        > Sapukan bahagian-bahagian kayu yang berhampiran tanah dengan air yang 
telah dicampurkan serbuk BORAX. ( NOTA: BORAX ni dulu banyak digunakan oleh 
pembuat mee kuning, kuey teow, chee cheong fun, nasi putih masakan Siam, Indon 
dan Cina. Dah berkoyan-koyan orang Melayu dok makan racun ni, sebelum 
diharamkan kerajaan. Borax ini adalah salahsatu punca Barah Hati). 
        > BORAX tak bunuh terus anai-anai. Apabila anai-anai suap-menyuap serat 
kayu pada rakan-rakan sekerjanya, ia akan tersuap sekali BORAX ni. Bila BORAX 
masuk perut, ia akan bunuh kuman pengkhadaman anai-anai. Lalu anai-anai mati 
kerana kekurangan zat.

D.        Pembasmian anai-anai yang telahpun berhimpun di dalam rumah:
        Panggil pakar.

        Jika inginkan kepastian di dalam perkongsian saya ini, tanyalah pakar pembasmian anai-anai dan gali maklumat dalam internet :)

=================================== tamat ===================================

        --- On Tue, 5/4/10, Puan Sofie <fiesay...@yahoo.com> wrote:


          From: Puan Sofie <fiesay...@yahoo.com>
          Subject: [sim] KONGSI INFO : Menghapuskan Anai-Anai (Termites)
          To: SahabatInteraktif@yahoogroups.com
          Date: Tuesday, May 4, 2010, 7:11 PM


            

               

                Salam 

                Tuan Mod, harap beri laluan untuk email saya .  Terima kasih ..

                Sahabat2 sim,

                Seperti yang kita semua ketahui, anai-anai adalah sejenis 
makhluk perosak kepada harta benda dan sekiranya tidak dihapuskan,  boleh 
mengakibatkan kita kerugian beribu ribu ringgit.

                Ada kawan menyatakan, bateri kereta lama yg tidak digunakan 
boleh mengelakkan rumah kita daripada didatangi anai-anai.  Caranya ialah 
dengan menanam bateri lama yang tidak digunakan tersebut di kawasan  tanah 
berdekatan dengan rumah kita. .  

                Sekiranya sahabat lain mempunyai info / petua macam mana atau 
cara-cara untuk 
                membasmi dan mencegah anai-anai, selain daripada semburan from 
pest control, harap boleh share.

                Terima kasih
                Puan Sofie
               

Wednesday, 27 January 2016

Lessons learned: Mexico after 10 years of NAFTA (North American Free Trade Agreement)

Malaysia hari ini (27/1/2016) menerima untuk menyertai TPPA!

Sebagai rakyat Malaysia, terkedu membaca laporan penilaian terhadap NAFTA di bawah ini oleh Laura Carlsen menunjukkan pemisahan yang amat besar di antara janji-janji dan pencapaian sebenar Mexico selepas 10 tahun menerima NAFTA !! Hari ini sangat bersejarah kerana Pemimpin-pemimpin Politik Malaysia telah mengundi untuk menerima untuk menyertai TPPA ini. Semoga Malaysia tidak terjerat oleh TPPA ini.. 

Seperti yang berlaku kepada Mexico, kesan jangka-panjang TPPA kepada Malaysia akan dapat dirasai pada 2026 iaitu selepas 10 tahun ia dipersetujui, di mana pemimpin-pemimpin dan orang-orang yang bertanggung-jawab meneliti dan menyetujui TPPA ini telahpun bersara ataupun meninggal dunia...

Ada dua kemungkinan; mati membawa amal-jariah ataupun mati membawa maksiat-jariah!

Jika pelaksanaan TPPA benar-benar memberi manfaat kepada rakyat Malaysia, maka sudah tentu segala kebaikan TPPA ini menjadi amal-jariah, pahala dan ganjaran nikmat yang berterusan kepada mereka yang bertanggung-jawab. 

                                     Dan begitulah sebaliknya... iaitu:

Jika pelaksanaan TPPA ini membawa bencana kepada rakyat Malaysia, maka sudah tentu segala keburukan TPPA ini menjadi maksiat-jariah, dosa dan balasan siksa yang berterusan kepada mereka yang bertanggung-jawab. 


Mexico after 10 years of NAFTA: The price of going to market

As the developing-country partner in the North American Free Trade Agreement (NAFTA) with the US and Canada, Mexico's decade-long experience has major lessons for other nations negotiating FTAs. In this evaluation of an agreement which its promoters claimed would usher Mexico into the First World, Laura Carlsen reveals the huge chasm between promise and reality.

LAST year was the 10th anniversary of the North American Free Trade Agreement (NAFTA), which brings together Canada, the United States and Mexico, and nearly all evaluations of the agreement conceded that the period showed negligible or negative results for Mexico. As the developing-country partner of the agreement, Mexico's experience under NAFTA has major implications for other developing nations negotiating FTAs, particularly with the United States.
More than a decade later, there is a huge gap between the promises and the reality of NAFTA. In the early 1990s, NAFTA promoters asserted that the agreement would usher Mexico into the First World, leaving behind decades of intransigent poverty and underdevelopment.
This clearly did not happen. The NAFTA decade showed growing gaps between Mexico and its northern partners in the areas of growth, wages, employment, immigration, agricultural subsidies, and environment. Since entering the trade agreement, poverty and unemployment have grown and Mexico's average growth for the period has been just over 1% per capita.

Serious disadvantages

These poor results have to do with several factors.
First, NAFTA did not adequately take into account the asymmetries existing between the three countries. Therefore Mexico entered the competition with serious disadvantages that it was not able to overcome and that in many cases were exacerbated. Unlike the European Union, NAFTA did not offer compensation or adjustment funds, or major infrastructure projects. Investment financing in Mexico was, and continues to be, non-existent or extremely expensive, making conversion or expansion difficult for companies not already linked to international sources of capital.
Second, NAFTA opened the economy to investment and trade liberalisation to benefit sectors of interest to the global economy. The historically impoverished southern part of the country, where subsistence farming dominates, was effectively excluded from any benefits. At the same time, Mexico's southern region was exposed to the massive influx of imports that competed with its traditional production, especially corn. Thus NAFTA not only did not work to alleviate poverty where it was the worst but actively deepened it. NAFTA also stripped the government of many tools for promoting a more even integration of varying regions under a coherent national development plan. This led to more profound regional divisions in the country and heavy out-migration from the southern states to other parts of Mexico and to the United States.
Another factor was the low linkage of NAFTA investment to the national economy. Almost 40 years since its inception and 12 years after NAFTA, the offshore assembly sector still uses an average of only 3-4% national inputs. At the same time, NAFTA broke down some already established regional productive chains, such as the barley-beer chain in northern Mexico, when beer makers began to import the grain from the United States.

Market access fails to lead to development

One of the biggest disappointments of NAFTA has been in the area of expectations of increased market access. Access to the US market - the largest in the world - has always been the grand allure of FTAs with the United States. In the 1990s, the Mexican government was convinced that profound integration into the world economy was the only ticket to national development, and that the United States was the ideal if not only partner to achieve this. The government conceded considerable ground to obtain access that they claimed would serve to reorient the Mexican economy outwardly based on its absolute and comparative advantages.
More and more we are seeing, however, that access to the US market is poor compensation for the concessions that Latin American governments are required to make in FTAs with the United States. One reason for this failure is that the United States picks and chooses what access to give, while demanding near-total liberalisation for entry of its own products. The United States routinely maintains protections in the form of quotas and non-tariff barriers that it rarely allows for its trade partners. Given the US surplus production in key agricultural products and the impact of imports on small and medium industries that produce for the domestic market, the social, economic, and political costs of domestic markets lost to cheap, often subsidised imports are very high.
Moreover in the current context, the export advantages of FTAs with the United States are likely to be short-lived. As the United States negotiates FTAs and trade liberalisation rules with nations all over the world, the privileged access of its previous partners becomes less of a competitive edge. For example, a recent study indicates that the Central American Free Trade Agreement will do little or nothing to alleviate the plight of the Central American textile industry in the face of the end of the multi-fibre pact and the influx of Chinese exports on the world market. Likewise Mexican economic officials warn that Mexico is losing its ability to compete in offshore production for the US market and will continue to lose as other countries offer an even cheaper labour force and transportation costs decrease. Thus, even the limited dynamism in trade and investment that resulted from NAFTA is likely to fade considerably in the coming years, according to the government itself.

Farm woes

Agriculture offers the best example of the fallacy of the argument that market access can achieve major development goals.
Since market access goes both ways, access to the US market for Mexican fruits and vegetables led to high growth in the horticulture sector but came at the expense of losing national markets for other products. While Mexico experienced over 50% growth in the value of its exports of major fruits and vegetables to the United States, the earnings have been more than offset by the cost of its burgeoning imports in grains, especially corn, which tripled. Some domestic sectors have been virtually wiped out - a recent study notes that 99% of soybeans are imported and wheat cultivation fell by half. With imports accounting for 80% of rice, 30% of beef, pork, and chicken and a third of Mexico's staple - beans, serious concerns about food dependency have arisen.
The benefits of fruit and vegetable export have been limited to a very small number of large farmers concentrated in the northern part of the country, while grain imports have devastated thousands of farm livelihoods throughout the country. Nearly two million farmers have left the land since the onset of NAFTA, eight of every 10 live in poverty, and 18 million earn less than $2 a day.
The displacement caused by massive imports can be difficult to calculate and compensate. Mexican planners anticipated a need for maize farmers to convert but overestimated the growth of livelihood alternatives in other sectors and underestimated cultural resistance to abandoning rural communities. The result was emigration to the United States, rural poverty, increased illegal drug production in some regions, and intensification of farm labour, especially for women.
Moreover, liberalised corn imports had an impact on other crops as well. As the price of corn dropped, livestock producers converted to corn as feed, causing devastation in the sorghum sector. Similarly, although Mexico does not import white corn, processors replaced it with cheap yellow corn in foodstuffs, eroding the domestic white corn market.
Providing access for US agricultural products, instead of 'levelling the playing field' as US trade negotiators claim, allows severe distortions in the value of these goods since many US exports are so heavily subsidised. The 2002 US Farm Bill authorises an 80% increase in subsidies over the next 10 years. The United States has refused to discuss its agricultural subsidies in every one of the bilateral FTAs negotiated to date.
Due to these subsidies, particularly grains are being sold on the international market with dumping margins of 25% or more. This puts domestic production in developing countries, where these grains constitute not just products but the staples of the local diet, at an unfair disadvantage. The resulting dependence on imports also poses a serious threat to food security and sovereignty.
Finally, NAFTA did not even necessarily assure fair market access. In key horticultural crops and others, Mexico has met with protectionist measures from the US in the form of dubious phyto-sanitary barriers, anti-dumping complaints, and other pretexts. The US government also has no qualms about protecting sectors it considers politically strategic.

New free trade agreements: CAFTA and AFTA

NAFTA was negotiated over a decade ago. Since then, many countries in Latin America have seen the growth of civil society movements in opposition to the NAFTA trade model. The governments of several nations, notably Brazil, Venezuela, Argentina, and Uruguay, have criticised the model and urged modifications while emphasising alternative forms of regional integration like Mercosur (the Southern Common Market which comprises Brazil, Argentina, Uruguay and Paraguay). The Free Trade Agreement of the Americas (FTAA) is at an impasse.
In this new context, has the United States changed its negotiating style or stance?
The answer, with few exceptions, is no. Instead of heeding this wave of opposition, the United States has dug into its trenches, and in economic policy those trenches are the bilateral trade agreements. From the FTAs, the US government hopes to gain the strength to launch renewed trade offences in broader multilateral organisations like the WTO and any eventual FTAA. Each NAFTA-style FTA signed not only locks the partner country into a series of pro-corporate measures but also sets a precedent for later negotiations.
This summer the US Congress ratified the Central American Free Trade Agreement (CAFTA). The time it took to negotiate and ratify this agreement was much longer than what the Bush administration had anticipated. Some of the problems are illustrative of what's in store for future negotiations.
In the end CAFTA is indeed a close cousin of NAFTA. Despite being given side-room status, for example in El Salvador, civil society actors failed to modify the agreement. Their proposals were consistently squelched either by the negotiating teams of their own governments or US refusals.
Popular protest broke out in most of the nations involved, led by farmers and labour organisations. The political costs for the governments involved are high. Just as the Bush administration was forced to delay ratification in the US Congress due to lack of votes, Central American governments fear ratification will meet with major opposition in their legislatures and in the streets. In Guatemala, the CAFTA debate took a life when a demonstrator against ratification was killed by police. Nicaragua, the Dominican Republic, and Costa Rica still have not ratified, and the Costa Rican president is said to be waiting out his term to pass the hot potato on to his successor. Demonstrations against the incorporation of the telecommunications sector in that normally docile country nearly caused Costa Rica to pull out of the agreement.
In the Andean countries, the situation is even worse. Bolivia is out of the picture because a showdown over the Andean Free Trade Agreement (AFTA) could easily cause the fall of yet another government, caught between the dictums of the economic model and the anger of a people fed up with empty promises. Venezuela under the US nemesis, Hugo Chavez, has denounced all prospects of an FTA with the United States. Both Ecuador and Peru face possible referendums on the issue in their countries and may be barred from participating anyway by the United States, which - acting openly as a corporate advocate rather than a government - has premised their participation on resolution of several cases of investor claims by major US transnationals.

Playing hardball

In both CAFTA and AFTA, rather than take a conciliatory stance faced with the probable negative and destabilising impacts of the agreements, US negotiators have played hardball. First, they threatened to withdraw or not renew the current trade preferences these countries enjoy - under the Andean pact for Trade Promotion and Drug Eradication in the Andean case and the Caribbean Basin Initiative and others in Central America. Since many industries had already oriented production toward markets assured under these measures, the threat had real weight. Even government officials have complained that in effect the FTA process means that these nations are forced to concede in non-trade areas such as intellectual property and investor protection only to assure the market access they already have.
Negotiating teams in several countries have complained that the United States gives little and asks a lot. Rice has been particularly sticky. The Central American agreement allows 10 years for tariff-free entry but farmers argue that time is not the problem - US subsidies make it impossible to compete, ever. Andean countries are being pressured to increase their quotas for US rice although a study by the Latin American Economic Commission recommends the total exclusion of rice from the agreement be considered due to the pivotal role of rice as a source of food and employment.

Some lessons learned

1. The trade-offs between gaining greater access to the US market and the displacement caused by loss of national markets to imports often lead to negative net results. When compounded by a decrease in participation in other regional and global markets, the result is both politically and economically negative.
2. Concessions to US demands in FTA negotiations can have long-term detrimental effects. Mexico has seen the erosion of the smallholder farmer economy, the loss of traditional knowledge of land and biodiversity use in rural communities, food dependency, obstacles to the construction and consolidation of South-South links, and greater inequality in income distribution. It is also losing national sovereignty, cultural diversity, and important policy tools for national development.
3. Special product protection, safeguards, or longer liberalisation periods are insufficient to solve the problems caused by massive imports. A strategic product cannot be left to distorted market forces. Moreover, the examples of sorghum and white corn displaced by yellow corn imports illustrate the insufficiency of offering special protection to specific products.
4. The FTAs with Mexico, Chile, Central America, and potentially the Andean region severely hamper the development of other potentially more advantageous options of economic integration. The value of regional integration is not merely to create a trading bloc to compete and negotiate more effectively with developed countries but to rethink regional integration and develop joint tools for sustainable production and trade. When done ideally - in a more horizontal manner, among nations that share common challenges, with national development and well-being cast as primary goals - regional integration could be a far more equitable and sustainable course than the FTA model currently imposed by the United States.
5. Washington's divide-and-conquer strategy forces nations to concede in other areas in order to assure market access, and uses sticks over carrots to impose a model that benefits US economic and security interests and large corporations. For this reason, FTAs with the United States should be avoided. Nations must evaluate alternative forms of economic integration and assess all options. The gains offered are limited and short-lived; the price is likely to be the long-term sustainability and stability of the country.

Some final caveats

For nations entering into free trade negotiations with the United States, Mexico's experience provides some additional caveats.
The first regards the need to incorporate the silent voices in the negotiations process and debate. Large industrialists typically come to the table with considerable influence and a convincing case - we make this, we need a market, the United States offers the largest in the world, ergo we need an FTA with full market access. But market access cuts both ways and never constitutes an unmitigated gain for a developing country. Gain in access to the US market can be offset by the loss of the developing country's own domestic markets in key sectors. Small producers, especially farmers, are particularly vulnerable and have a weak voice in national politics. Incorporating them into talks is necessary not only to enhance democracy and transparency but also to arrive at a better agreement. They hold important truths about the productive and social structures of their countries.
Second, not all costs are quantifiable and among the highest costs of FTAs with the United States today are the political costs. In US FTA negotiations, everything - trade being often a minor issue - is on the table, whether explicitly or implicitly. And in the centre is the renewed US drive for global hegemony. Trade policy is an instrument for this hegemonic control, and it is now closely tied to security policy. Political costs of trade dependency on the United States can be very high. In the 'with us or against us' mentality of the war on terrorism, trade relations become another lever of control. Mexico learned this when, as a rotating member of the UN Security Council, it faced extreme pressure to break its tradition of non-intervention and support the US invasion of Iraq. Another cost is the erosion of possibilities for greater regional economic integration.
Finally, it is important to remember in any cost/benefit analysis that many sectors produce values that will never be reflected on the international market but that are vital to developing countries and the world. These include livelihood generation, cultural diversity, food sovereignty, protection of ecosystems, and biodiversity.
To fully incorporate these values requires going back to a basic guiding principle. We must invert the current equation that has trade policy driving national development policy - or in many cases supplanting national development policy since many governments no longer formulate real national development policies - and assure that trade policy serve sustainable and equitable national development goals.


Laura Carlsen directs the Americas Program of the International Relations Center, online at www.irc-online.org. The above is based on presentations by the author at the Asian Regional Workshop on Bilateral Free Trade Agreements, held in Kuala Lumpur on 26-28 August and organised by the Third World Network. Comments welcome at laura@irc-online.org.