I just remembered that I have an account in Flickr and updated some photos:) The url is http://www.flickr.com/photos/zation/
Ususally “sudo” requires a login session by default, and if we just use ssh, it returns “Sorry, you must have a tty to run sudo”. If it is easy for us to log in to the remote machine, we can just edit /etc/sudoers to comment out the “requiretty” stuff. Otherwise just use “ssh -t”, which allocates a sudo tty on the remote machine. I prefer the later one.
This is usually ignored, but when using Amazon APIs, if the time on your system somehow doesn’t agree with that in Amazon, you often get the “client.InvalidSecurity: request expired” error. The way to sync the time is “ntpdate ntp.ubuntu.com”.
Sometimes it is very useful to get all the metadata nodes in llvm, for the purpose of, say, find the type name of some fields of a data structure. LLVM does not provide the this complete information via any well-formed APIs, so let’s find some way out.
First about a few introductions of metadata:
I find out that if I really want to enjoy something, I cannot depend on the cafe on the campus.
So here is the mega seafood noodle soup I cook for myself. This is what it means by “MEGA”!!
Previously I posted how to download amazon ec2 ami to local drive. And to use it, I posted there that we can copy it (actually “dd”) to a virtual disk in vmware in order to make use of it. That takes a lot of time (15 hours for a 10 GB disk image). Fortunately, if we don’t need to boot it, and only want to retrieve the content in the disk image, we don’t need to do that. The simplest way is to directly mount it in Linux.
To mount a disk image, we use
mount -o loop,ro,offset=XX image.img /path/to/the/mount/directory
(I didn’t use -t here because the ami is in ext4 and can be recognized directly on my ubuntu)
To determine the offset, we can use “parted” tool. So we type:
GNU Parted 2.3
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
Unit? [compact]? B
Disk /home/zation/amazonec2/vm1/image: 10737418240B
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0B 10737418239B 10737418240B ext4
We see that there is only one partition, starting from 0B. So we put the offset=0
If there are multiple partitions, we can mount each partition separately by inputting the start value to the offset.