The Official *nix Thread

Inane baanter or words of wisdom - you decide...
Post Reply
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

Well, bit the bullet and upgraded my Samsung N120 netbook from 9.10 to 10.04 - no problems at all. Might upgrade my 9.10 desktop tomorrow.

Fedora 13 is out in a couple of weeks as well, so I'll probably upgrade my Fedora server at some point :)
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
galaxis
Baaaaa!
Baaaaa!
Posts: 1099
Joined: Fri Feb 25, 2005 10:01 pm 0

Re: The Official *nix Thread

Post by galaxis »

Oh yeah, another oddity I ran into with the Ubuntu upgrade was that xinput now seems to want to have the device ID instead of a device name as parameter. (I'm using xinput in an Xsession script to remap the buttons on my VerticalMouse, if it is connected.)

On another note, does anyone know how to detect events like undocking a notebook?

The T60 can only address two screens, so if I use two external monitors with the dock (DVI and VGA), I have to disable the internal display (xrandr --output LVDS --off). The problem is that it stays off when I undock it... So I would need to (automatically) run xrandr to reenable the internal display...
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

galaxis wrote:On another note, does anyone know how to detect events like undocking a notebook?
I'm guessing a quick "tail -f /var/log/messages" when undocking to see how the OS spots it, then frigging together a script in the /etc/event.d/ dir to react accordingly.

mm... interesting one. I may have to look into that, purely for compulsive fascination.
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

How can I limit the amount of CPU % usage any particular process takes up?

I'm trying to run BOINC on my server at home and I couldn't work out why, when running the process, it would eventually shut down my machine. Anyway ran it again and then ran "top" and it's taking up 99.9% of my dual core CPU until I assume the whole thing just overheats and shuts down.

Is there a standard Linux way to limit how much CPU resources is used by a particular process?
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

Meh, s'okay - you can apparently have a BOINC global preferences override: -

http://boinc.berkeley.edu/wiki/Global_p ... erride.xml
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

Check /etc/security/limits.conf - you can affect limits on a per-user or per-group basis using that file.

Many of the other files in the /etc/security dir are for account restrictions.
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

Thanks - looking into that now. After doing a fair bit of research, it's surprising how many modern operating systems (Linux and Windows 7 at least) don't have a flexible way of limiting job processes. I mean, it can be done but it's pretty clunky. Moreso on Windows 7 than Linux and that's hardly much cop. Got it sorted now, but not exactly as functional as I could have wished.
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

Resource restriction is a bit of a pig, I'll agree.

I think most situations generally involve launching the process and letting (a) the kernel "nice" it accordingly or (b) let it grow up to it's allotted filesystem quota/process limitations of the owner. I don't know of any way that a user can specify fractions of their allotted usage per-process.

It's possible PolicyKit has something to manage resource allocation, but I've not heard of it meself.
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

Fedora 13 "Goddard" is out today - I know I should wait, but hell - I'm installing the bugger :)

http://fedoraproject.org
http://torrent.fedoraproject.org
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
WiteWulf
Sheepie Whore
Sheepie Whore
Posts: 10125
Joined: Mon Aug 23, 2004 11:20 am 0
PSN: WiteWulf
Location: Loughborough(ish)

Re: The Official *nix Thread

Post by WiteWulf »

Limiting the %age of CPU/core a process can use is actually quite difficult and, in itself, quite processor intensive. That's why most unices have a system of process prioritisation instead, allowing you to make sure the most important processes get the right amount of time.
:::G:::

PSN: WiteWulf
Switch: SW-3941-2878-7584
Steam: WITEWULF66
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

I'm trying to learn about partitions and LVM although I'm still getting my head around it. I've set up my RHEL test server with LVM. As I understand it (mostly from Dave's notes - thanks Dave!) it goes like this: -

Setup up several partitions for this, in this case hda5 - 7. hda1 is my boot partition which has to be on primary. hda2 is a regular 10GB primary partition that holds the OS and hda3 is the swap partition. hda4 is the extended partition which houses hda5 to 7. They're 5GB each. I assume I cannot access partition 4 directly as it's simply the holder for the logical partitions?

So I've set hda5 - 7 partitions with type '8e' (LVM). I then created a Volume Group called VolGroup01 and since the drive is only 80GB, stick with the default Physical Extent size of 4MB. I assign this Volume Group to /dev/hda5 (why does a Volume Group as an abstraction have to be assigned a partition?).

I then create a Logical Volume called LogVol01 of 500MB and assign it to the new VolGroup01. I format this with ext3 and created a /etc/fstab entry to automount it. First I tried to use /dev/VolGroup01/LogVol01 as this seemed logical but this threw me into maintenance mode and I had to remount the drive as read-write to change the fstab :) Why do I have to use /dev/mapper/VolGroup01-LogVol01 instead? Doesn't seem very consistent.

So I assume I can add as many Logical Volumes as I like, presumably across any of the partitions I've created with type '8e'. But I'm uncertain about the relationship between the various parts. Creating a Volume Group I get as it's a virtual holder for the partitions that I can add across many disks. So are Logical Volumes an abstraction of partitions? Since partitions themselves can be any size, why have added functionality to size Logical Volumes as well? Not sure I get that part.

Now I need to learn how to either resize the current Logical Volume or add more :)
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

RageMatrix wrote:I assume I cannot access partition 4 directly as it's simply the holder for the logical partitions?
Correct. "fdisk -l" should show it as a EXT partition, which then contains logical partitions 5-8. I often tell people to think of 1-4 as buildings, 1-3 are homes but 4 is subdivided into flats (5-8). people live in 1-3 and 5-8 but not in 4 "directly".

BTW: this is the DOS world's interpretation of "Logical Volume" - it's not to do with Linux LVM.
RageMatrix wrote:So I've set hda5 - 7 partitions with type '8e' (LVM). I then created a Volume Group called VolGroup01 and since the drive is only 80GB, stick with the default Physical Extent size of 4MB. I assign this Volume Group to /dev/hda5 (why does a Volume Group as an abstraction have to be assigned a partition?).
You can create one large hda5 _disk_ partition, set it to 8e, THEN run "pvcreate" on it to "make" a physical volume - appears to LVM as a HD itself.

You then add this "disk" (the PV) into the VG. It's not the VG that needs to be assigned partitions, it's the VG that needs to be built up from PVs.
RageMatrix wrote:I then create a Logical Volume called LogVol01 of 500MB and assign it to the new VolGroup01. I format this with ext3 and created a /etc/fstab entry to automount it. First I tried to use /dev/VolGroup01/LogVol01 as this seemed logical but this threw me into maintenance mode and I had to remount the drive as read-write to change the fstab :) Why do I have to use /dev/mapper/VolGroup01-LogVol01 instead? Doesn't seem very consistent.
The original path you mentioned is correct: LVM2 uses this new "mapper" path since it's going through a different device mapper than the older LVM. The backwards-compatible path still works.
RageMatrix wrote:Now I need to learn how to either resize the current Logical Volume or add more :)
"lvextend", amongst other commands.

http://www.yakyak.org/viewtopic.php?p=1333342#p1333342 <-- before you ask any more questions. You're on the right track, but I think some of the terminology is somewhat confusing.
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

RageMatrix wrote:So I assume I can add as many Logical Volumes as I like, presumably across any of the partitions I've created with type '8e'. But I'm uncertain about the relationship between the various parts. Creating a Volume Group I get as it's a virtual holder for the partitions that I can add across many disks. So are Logical Volumes an abstraction of partitions? Since partitions themselves can be any size, why have added functionality to size Logical Volumes as well? Not sure I get that part.
Okay, quick explanation:

1. Take all scraps from various different chopping board after chef has finished
2. bung together into one large pie and bake it.
3. slice up pie
4. give people slices of pie.

5. if you want a bigger pie, search for more scraps, throw them into the pie and let it expand the pie.

1 = partitions on different disks, set to 8e, and "pvcreate" run against them
2 = Volume group
3 = Logical volume, in LVM terms - NOT in "fdisk" terms (lvcreate)
4 = mkfs.ext3 and mount /dev/volgroup/logvolname

5 = same as 1, then "vgextend".

The idea is that LV slices can be abstracted and extended over several disks, rather than think of the actual physical HD they're on. You see storage in terms of VGs containing LVs, rather than HDs containing partitions.
User avatar
RageMatrix
Baaaaaaa!
Baaaaaaa!
Posts: 5515
Joined: Fri May 10, 2002 12:52 pm 0
XBL Gamertag: Jon256
Location: East Sussex

Re: The Official *nix Thread

Post by RageMatrix »

Cheers for the explanation, I'll check out that link.
Dungeon-Dave wrote: You can create one large hda5 _disk_ partition, set it to 8e, THEN run "pvcreate" on it to "make" a physical volume - appears to LVM as a HD itself.
I realise I could have done that, but I wanted to create a bunch of partitions and mess with them, testing LVM (or LVM2, seeing as that's what I'm using) across partitions. The free space I've still got on that physical drive I'm going to use for other partitions so I can play around with RAID :)
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
User avatar
Dungeon-Dave
Baaaaaa!
Baaaaaa!
Posts: 3925
Joined: Thu Aug 04, 2005 12:01 pm 0
Location: UK
Contact:

Re: The Official *nix Thread

Post by Dungeon-Dave »

Ah, okay.

Another point: when modifying partition tables on a disk that's in use (read: system disk, or secondary disk containing a mounted filesystem) then Linux needs a reboot to re-read the partition tables.

However, create several PVs... those can be added/removed from VGs and LVs can be created/deleted/migrated whilst still in use, involving no reboot/downtime.

That - for me - is the single most useful feature of LVM.
Post Reply