Mailbag
This month's answers created by:
[ Amit Kumar Saha, Ben Okopnik, Henry Grebler, Kapil Hari Paranjape, René Pfeiffer, Mulyadi Santosa, Neil Youngman, Aioanei Rares ]...and you, our readers!
Our Mailbag
rsync internals
Amit Saha [amitsaha.in at gmail.com]
Thu, 1 Apr 2010 12:54:33 +0530
Hello TAG:
I have been using 'rsync' off late for backups and helping my Prof. do the same as well.
My prof. has ~6G space left on his hard disk and we are trying to back up everything (~200 G)to a external HDD. As 'rsync' progresses, the disk space on the (source) hard disk gets consumed incrementally and large files (~14G) cannot be copied to the backup hard-disk. rsycn fails saying "No disk space left on device". I wonder why. I can try to look into rsync source to see why this happens. But, why is rsync consuming disk space on the source disk? Its a file copy operation right? It should consume the main memory, not the secondary memory. Or, is it a virtual memory thing?
Thanks for any insights!
Best Regards, Amit
-- Journal: https://amitksaha.wordpress.com ?-blog: https://twitter.com/amitsaha
[ Thread continues here (5 messages/6.01kB) ]
compressing sparse file(s) while still maintaining their holes
Mulyadi Santosa [mulyadi.santosa at gmail.com]
Mon, 29 Mar 2010 21:25:23 +0700
Due to certain reasons, we might have sparse file and want to compress it. However, we want to maintain its sparseness. Can we do it the usual way? Let's say we have this file: $ dd if=/dev/zero of=./sparse.img bs=1K seek=400 count=0 0+0 records in 0+0 records out 0 bytes (0 B) copied, 2.3956e-05 s, 0.0 kB/s
$ ls -lsh sparse.img 4.0K -rw-rw-r-- 1 mulyadi mulyadi 400K 2010-03-29 21:14 sparse.img
$ gzip sparse.img $ ls -lsh sparse.img.gz 8.0K -rw-rw-r-- 1 mulyadi mulyadi 443 2010-03-29 21:14 sparse.img.gz
$ gunzip sparse.img.gz $ ls -lsh sparse.img 408K -rw-rw-r-- 1 mulyadi mulyadi 400K 2010-03-29 21:14 sparse.img
Bad. After decompression, total blocks occupied by the file "grows" from 4KiB to 408 KiB.
The trick is by using tar with -S option: $ tar -Sczvf sparse.img.tgz sparse.img
$ ls -lsh sparse.img.tgz 8.0K -rw-rw-r-- 1 mulyadi mulyadi 136 2010-03-29 21:18 sparse.img.tgz
$ tar -xzvf sparse.img.tgz $ ls -lsh sparse.img 4.0K -rw-rw-r-- 1 mulyadi mulyadi 400K 2010-03-29 21:17 sparse.img
As you can see, the total block size of "sparse.img" are correctly restored after decompression.
-- regards,Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
[ Thread continues here (3 messages/3.53kB) ]
C/C++ autocompletion for Emacs/vim
Jimmy O'Regan [joregan at gmail.com]
Sat, 24 Apr 2010 12:04:21 +0100
https://cx4a.org/software/gccsense/
-- <Leftmost> jimregan, that's because deep inside you, you are evil. <Leftmost> Also not-so-deep inside you.
[ Thread continues here (6 messages/3.63kB) ]
Resuscitating a comatose xterm window?
Kat Tanaka Okopnik [kat at linuxgazette.net]
Sun, 18 Apr 2010 20:15:57 -0700
Hi, gang -
After a history of losing data to dying computers (yes, yes, I know, it's really about not backing up data adequately), I've come to prefer leaving my e-mail on remote servers rather than dealing with it locally. As a result, my non-webmail interaction is done via ssh. I've learned to run screen so that a dropped connection doesn't result in losing half-composed mail, but I haven't figured out what to do with my frozen xterm window.
What I mean by this is that I end up losing the connection, having to reconnect, and then having to kill the frozen-by-dropped-connection window. Is there a way that I can resuscitate the dead session in the existing window, rather than opening up a new xterm window and killing the old one?
Please be gentle as I expose my lack of proper terminology. I'm pretty sure I'm not describing my problem using all the right words, but I'm hoping I've come close enough for someone to figure out how I should have put it. (I'd ask my resident *nix guru to vet my question, but he's up against a deadline while running short on sleep.) I'd wait to ask my question, but I suspect I'd forget to ask, again...
-- Kat Tanaka Okopnik Linux Gazette Mailbag Editor kat at linuxgazette.net
[ Thread continues here (18 messages/30.46kB) ]
how to close connected/listening socket?
Mulyadi Santosa [mulyadi.santosa at gmail.com]
Sun, 18 Apr 2010 15:38:13 +0700
Hi all
Once I read there is a way to close a listening/half open/connected/etc TCP socket using Linux kernel facility i.e using one of /proc entries.
Do any of you recall which /proc (or /sys maybe?) entry that does the job?
Thanks in advance..
-- regards,Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
[ Thread continues here (3 messages/2.31kB) ]
LCA: How to destroy your community
Jimmy O'Regan [joregan at gmail.com]
Tue, 20 Apr 2010 23:54:03 +0100
https://lwn.net/Articles/370157/
Great article. A co-contributor and I have been picking through it point by point to see how many points our project is guilty of (mostly documentation, or the lack thereof
-- <Leftmost> jimregan, that's because deep inside you, you are evil. <Leftmost> Also not-so-deep inside you.
[ Thread continues here (2 messages/1.49kB) ]
how to unmount stale NFS connection
Mulyadi Santosa [mulyadi.santosa at gmail.com]
Mon, 19 Apr 2010 01:05:38 +0700
Hi all
Following my recent question regarding how to close tcp connection, it turns out that in my case, the sockets belong to stale NFS connection. In other words, the client try to maintain a mount toward a server that no longer exist.
So, how to unmount it? If you use the usual umount or umount.nfs, you can't do it and it will yield error messages like below: $ sudo umount.nfs /media/nfs -f -v umount.nfs: Server failed to unmount '192.168.1.2:/opt/data' umount2: Device or resource busy umount.nfs: /media/nfs: device is busy
Thanks to Google, I came to this URL https://www.linuxquestions.org/linux/answ[...]_gone_down_causing_the_applications_thre (hopefully I paste the entire URL correctly).
Essentially, the trick is to "emulate" the dead NFS server. Bring up a virtual interface such as eth0:0 and assign it the IP address of the dead server: # ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 # ifconfig et0:0 up
Then retry the umount or umount.nfs command. It takes times, but eventually it will succeed. Finally, bring down the virtual interface: # ifconfig eth0:0 down
PS: Big credits to Rahul K. who share this valuable information.
-- regards,Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
[ Thread continues here (3 messages/3.28kB) ]
Remote mail usage (Was Resuscitating a comatose xterm window?)
Kapil Hari Paranjape [kapil at imsc.res.in]
Tue, 20 Apr 2010 10:05:28 +0530
Hello,
In the context of remote access to mail, On Mon, 19 Apr 2010, Kat Tanaka Okopnik wrote:
> I tried running a screen session locally, and then ssh to where my > mail lives, but that resulted in some keystrokes getting interpreted in > ways that I didn't like (e.g. the backspace key becomes something else, > IOW not backspacing). This is probably a whole different question that > should go under another subject line...
So I thought I should try to put together some thoughts on remote usage of mail. Since this has nothing to do with the original question, I have broken the thread.
Case 1: Remote system only allows webmail access ------------------------------------------------This is unfortunately all too common nowadays. Possible solutions:
1. Live with it/abandon it entirely 2. If forwarding is allowed, then forward your mail to a "better" server. 3. "freepops" may work for you. This is a program that acts as a POP3 front-end to a number of webmail interfaces.
Case 2: Remote system only allows IMAP/POP access -------------------------------------------------This is slightly more common, yet often sub-optimal!
1. Setup your favourite mail client to access imap/pop. 2. Use one of the many programs that fetches mail from such servers.Each of these has its own problems. In the first case, you do not get offline access to your mail, while in the second case you might end up paying a lot to download an attachment that you did not really need to access right away.
Case 3: Remote system allows shell access -----------------------------------------This is the best case scenario that is increasingly scarce!
1. Login to system and use whatever client is locally available. In addition you may want to run this client under "screen" or "dtach" in order to re-use sessions in case of lost connections. 2. Filter the mail on the remote system (using procmail and friends) to sort out the mail (optionally separating out attachments). Then download the mail you really want to read using a number of different techniques (rsync, unison, git and others or those mentioned in Case 2).Clearly, Kat was using (Case 3, Para 1).
Kapil. --
[ Thread continues here (2 messages/5.71kB) ]
VirtualBox Tricks?
clarjon1 [clarjon1 at gmail.com]
Thu, 25 Mar 2010 09:20:19 -0400
Hey Gang! I don't know how many of you use VirtualBox (OSE or otherwise), but I was wondering if any of you had any cool tricks-of-the trade that perhaps readers might be able to use. To start off with, here's one that makes VBox really easy for my mom to use, a little something I've called the "XP Start Button": It's essentially an icon on the desktop/menu entry. I've upgraded her laptop to find that she's never ever had a need to boot up windows, but unfortunately the tax guy wants her to run windows specific software. Anyways, here's the tip: Create a .desktop file in a folder/desktop, and fill it with the following:
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Terminal=false Name[en_US]=Windows XP Exec=VirtualBox --startvm "Windows XP" Name=Windows XP
Of course, replacing the name of the virtual machine with the one you wish to start on opening of the .desktop file.
Hope to hear more tips, wonder what tweaks i might learn
Sync error: ToC on Homepage and current issue page
Amit Saha [amitsaha.in at gmail.com]
Fri, 2 Apr 2010 10:36:14 +0530
Hello:
The contents for April on the homepage and on the issue page seem to be out of sync: https://linuxgazette.net/173/index.html
Hope, I am not seeing this in the middle of a update.
-Amit
-- Journal: https://amitksaha.wordpress.com ?-blog: https://twitter.com/amitsaha
[ Thread continues here (5 messages/8.42kB) ]