isn't quite ashamed enough to present

jr conlin's ink stained banana

2009-12-19

:: Unix Commands I Always Forget

And now, for a list of Linux commands i always forget about:

To get the GUID of a drive (so that a given hard drive ALWAYS mounts up under a given directory):
blkid /dev/drive
(and insert into /etc/fstab as:
UUID=UUID mount path ext3 defaults 0 2

To compare two different directories:
diff -rq dir1 dir2 > dirs.diff

To copy ginormous files:
rsync --inplace --progress --checksum --sparse --whole-file !*

Dav points out that recent versions of rsync don't allow both inplace and sparse. Too bad, really, since previously rsync would automatically handle them. Inplace is good for files (or devices) where you need the disk to flush often (e.g. USB drives), "sparse" is good for large, mostly empty files (like MySQL DBs).

After mounting a drive, make it available for NFS export by adding it to /etc/exports
/d2/ *(rw,sync,no_subtree_check)
and then running
exportfs -a
(This will keep NFS from reporting stale handles and locking on requests, even after a reboot.)

i've also learned to really appreciate Audio::WMA and MP3::Info to help me identify duplicate tracks (and which one to nuke).

Now, i wonder how long before i forget that i created this so i could remember the commands i forget.

(Hopefully, slightly longer than it took for me to figure out what the hell that last sentence meant.)

  1. Derek
    2009-12-20 04:07:53
    Regard the UUID "always mounts", bear this in mind. That UUID to block device "check" only happens at mount time, so if you have: /dev/sda1 UUID=XXXXXX and you mount XXXXXX on /mnt/x, it looks it up, and mounts /dev/sda1 on /mnt/x However, if you now add a removable media device, or you're using something like iSCSI with LUNs that can change on the fly, and all of a sudden you have /dev/sda1 UUID=YYYYYYY /dev/sdb1 UUID=XXXXXX (on a running filesystem), /mnt/x will suddenly be pointing to UUID "YYYYYY". Yes, it's true, it really happens, I see it all the time and it's why we have a policy NEVER to rescan the iSCSI LUN availability live.
  2. 2010-01-03 11:24:54
    Just an FYI, but from Ubuntu, the rsync (3.0.6) command throws an error: rsync: --sparse cannot be used with --inplace
  3. 2010-01-03 12:40:46
    Huh, that must have changed in a recent version. Sparse and inplace used to work. In any case, "inplace" is preferable for single files, "sparse" is preferable for directories of large files (say a MySQL DB).
Wanna join in?

Blogs of note
personal that's my blog
(The Official Blog of the Internet)
memoirs of hydrogen guy matthew shepherd (quebec) rhapsodic.org Henriette's Herbal Blog lynne ydw i slumbering lungfish
geek Y!Cool Thing jeremy z
(The Official Website of the Internet)
dave's picks ultramookie Josh Woodward derek balling simon willison
news ars technica search engine watch

Powered by WordPress
Hosted on Dreamhost.