I'd like to know if there's some rule (or formula) I can apply to find out how much of disk space will be used by the filesystem in an ext4 partition. for example, in a partition of 100 GB, how much can I actually use? does it depend on other parameters like inode size, etc?
cd1's questions
I need to find out if a disk is IDE or SATA (or anything else, maybe). I know that the device is /dev/sda, so I think it's SATA, but I don't know if I can be sure just by the name. I tried looking at dmesg and it always says "SCSI", but I'm sure it's not...
any ideas?
I created some users with:
$ useradd john
and I forgot to specify the parameter -m
to create the home directory and to have the skeleton files copied to each user. now I want to do that, and I don't want to recreate all users (there must be an easier way). so, is there any way to create the user directories and copy the skeleton files?
I thought about creating the directories, chowning them to the corresponding user, copying all the skeleton files and chowning them to the corresponding user. but if there's a command like useradd -m
that doesn't create the user again, but create the directories, it'd be better.
I have 7 computers running Gentoo Linux with Quad-Core processors and I want to be able do distribute the execution of a program to all of those machines. I have some multi-threaded programs and I wanted to use all the 28 available CPUs on my cluster instead of running 7 copies of the program, in each node.
it's like the idea of distcc: I have my C/C++ project, and if I compile the sources with distcc
instead of gcc
, it will distribute the compilation process to several computers, and I don't have to change anything even in the Makefile.
for the cluster, it'd be better if I didn't have to change anything in my program's source code (although I think that's impossible). but I can change the program to use an external API, if needed.
I'm trying to use distcc to compile C/C++ programs using more than one computer through the network. I'm using only two computers for now, but I intend to use more when it works with those two.
I'm using Gentoo, I installed distcc
in both machines with the command:
[user@pc ~]$ emerge distcc
the IPs/names of the machines I'm using are: 10.0.0.47 (qc7) and 10.0.0.46 (qc6). those computers are identical, I installed exactly the same packages on them all, and I configured distcc
the same way.
I set the machine names with distcc-config
:
[user@pc ~]$ distcc-config --set-hosts "qc6 qc7"
and I changed the file /etc/conf.d/distcc
to allow both machines:
...
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 10.0.0.46 --allow 10.0.0.47"
...
after that, I just started the service:
[user@pc ~]$ /etc/init.d/distccd start
I tried to compile a simple C++ program, with one class (.h
and .cc
) and a file with the main
function. the code is below:
person.h
#include <string>
using namespace std;
class Person {
private:
string name_;
int age_;
public:
Person(string, int);
string name() const { return name_; }
int age() const { return age_; }
void set_name(string name) { name_ = name; }
void set_age(int age) { age_ = age; }
};
person.cc
#include "person.h"
Person::Person(string name, int age)
: name_(name), age_(age) {}
main.cc
#include <iostream>
#include "person.h"
using namespace std;
int main() {
Person cd1("Cristian",22);
cout << "hi, my name is " << cd1.name() << " and I'm " << cd1.age() << " years old." << endl;
return 0;
}
Makefile
CC=g++
CFLAGS=-Wallperson: main.o person.o
$(CC) $(CFLAGS) -o person main.o person.operson.o: person.cc person.h
$(CC) $(CFLAGS) -c person.ccmain.o: main.cc person.h
$(CC) $(CFLAGS) -c main.cc
if I run only:
[user@pc ~]$ make
without using distcc
, the code compiles fine. but if I run:
[user@pc ~]$ make CC=distcc
the linking phase gives me an error. here's the output:
distcc -Wall -c main.cc
distcc -Wall -c person.cc
distcc -Wall -o person main.o person.o
main.o: In function `global constructors keyed to main':
main.cc:(.text+0xa): undefined reference to `std::ios_base::Init::Init()'
main.cc:(.text+0x19): undefined reference to `std::ios_base::Init::~Init()'
main.o: In function `main':
main.cc:(.text+0x5a): undefined reference to `std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)'
main.cc:(.text+0x80): undefined reference to `std::basic_string, std::allocator >::_Rep::_S_empty_rep_storage'
main.cc:(.text+0xa4): undefined reference to `std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&)'
main.cc:(.text+0xb3): undefined reference to `std::cout'
main.cc:(.text+0xb8): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0xc5): undefined reference to `std::cout'
main.cc:(.text+0xce): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0xe3): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0xed): undefined reference to `std::basic_ostream >::operator<<(int)'
main.cc:(.text+0x102): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0x182): undefined reference to `std::basic_ostream >::put(char)'
main.cc:(.text+0x18a): undefined reference to `std::basic_ostream >::flush()'
main.cc:(.text+0x1d9): undefined reference to `std::__throw_bad_cast()'
main.cc:(.text+0x208): undefined reference to `std::basic_string, std::allocator >::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+0x243): undefined reference to `std::basic_string, std::allocator >::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+0x277): undefined reference to `std::basic_string, std::allocator >::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+0x292): undefined reference to `std::basic_string, std::allocator >::~basic_string()'
main.cc:(.text+0x2af): undefined reference to `std::basic_string, std::allocator >::~basic_string()'
main.cc:(.text+0x2bc): undefined reference to `std::basic_string, std::allocator >::~basic_string()'
main.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
person.o: In function `Person::Person(std::basic_string, std::allocator >, int)':
person.cc:(.text+0x15): undefined reference to `std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&)'
person.o: In function `Person::Person(std::basic_string, std::allocator >, int)':
person.cc:(.text+0x45): undefined reference to `std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&)'
person.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
distcc[26001] ERROR: compile (null) on localhost failed
make: *** [person] Error 1
[the line in bold is the only one relevant to distcc
, all the others are the compiler output.]
it's as if distcc
couldn't find the basic libraries. what should I do to make distcc
compile this program using several computers on the network? is it some configuration that I've missed?
I want to use SSH between two computers on the same domain with the same user, and I don't want to type the password. here's an example:
[user@pc1 ~]$ ssh pc2
if pc1 and pc2 are on the same domain, with NIS authentication, and I'm logging in through SSH with the same user (as I didn't specify one), I wish I didn't have to type the password again, as I already did it when logging in at pc1.