Close

LVM Root Disk

Computers need disks to store their operating system, programs and data. Good old disk partition management has not changed much over time. Using either MBR (created in 1983) or modern GPT paritions you are still using statically allocated partitions and filesystems. It can be challenging to deal with static partitions because initial choices can not be changed easily.

Unfortunately it is more complex to use Logical Volume Manager for Linux (wikipedia). Most factory installed computers use traditional partitioning. The added complexity is not usually needed but when it is needed it is really needed. The benefits of using LVM include the ability to more easily resize partitions and backup via snapshots. Server hardware can even replace disks using hot swapping. LVM is commonly used along with virtualization via LXC, Eucalyptus, OpenStack or other similar systems. Here are the steps needed to convert a root partition to LVM and mirror it on a redhat system.

1. Create a tar backup of your filesystem.

# tar czpf /root/redhat.tar --exclude=/var/tmp/portage/* --exclude=/root/* --exclude=/usr/portage/* --exclude=*.deb --exclude=/tmp/* --exclude=*.rpm --exclude=/sys/* --exclude=/proc/* --exclude=/dev/* --exclude=/mnt/* --exclude=/media/* --exclude=/home/*  --exclude=/var/lib/libvirt/images/* --exclude=/oracle/*  --exclude=redhat.tar

2. Use fdisk to create /boot  and 1 LVM partition on the new disk.

/dev/sda1   *   1    100      803218+  83  Linux
/dev/sda2 101121601  975956782+ 8e Linux LVM

3. Set /dev/sda1 to be bootable.

# parted /dev/sda set 1 boot on

4.  Create the new LVM partition.

# pvcreate /dev/sda2
# vgcreate vg /dev/sda2
# lvcreate -L 200G /dev/vg -n root
# mkfs /dev/vg/root
# mkfs /dev/sda1
# mount /dev/vg/root /mnt
# mount /dev/sda1 /mnt/boot

5. Extract the tar file to /mnt

# tar xpf /root/redhat.tar -C /mnt/

6. Modify the following files:

/mnt/grub/menu.list:

Modify the kernel line to support LVM by adding the following LVM details:

rd_LVM_VG=vg rd_LVM_LV=root

Also ensure that initrd and kernel does not have /boot/ in the location.

Example:

kernel /vmlinuz-2.6.32-279.2.1.el6.x86_64 ro root=/dev/mapper/vg-root LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=128M  rd_LVM_VG=vg rd_LVM_LV=root rhgb quiet
initrd /initramfs-2.6.32-279.2.1.el6.x86_64.img

/mnt/etc/fstab:

Change the /boot and / entries to LVM:

/dev/sda1 /boot ext4 defaults 0 0
/dev/mapper/vg-root /      ext4    defaults        1 1

7. Mount and configure the new environment:

# mount /dev/vg/root /mnt
# mount /dev/sda1 /mnt/boot
# mount -o bind /sys /mnt/sys
# mount -o bind /dev /mnt/dev
# mount -o bind /proc /mnt/proc
# grep -v rootfs /proc/mounts  > /mnt/etc/mtab

Modify /mnt/etc/mtab and add:

/dev/sda1 /boot ext4 rw 0 0

Change the apparent root directory for the current running process and its children:

# chroot /mnt

8. Install GRUB and reconfigure the ram disk image:

# grub-install --recheck /dev/sda
# dracut --force

9. Unmount and reboot:

Type exit to exit the chroot environment

# cd /
# umount /mnt/*
# umount /mnt
# reboot

Set your system to boot from the disk known as /dev/sda

10. Initialize and format your original boot disk.

Just like we did for /dev/sda.

 Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1       100      803218+  83  Linux
/dev/sdc2             101    121601   975956782+  8e  Linux LVM

11. Add /dev/sdc to the volume group.

# vgextend /dev/vg /dev/sdc2

12. Format the boot partition on the drive and set it bootable:

# mkfs /dev/sdc1
# parted /dev/sdc set 1 boot on

13. Mirror the boot disk:

# lvconvert -m1 /dev/vg/root

We hope this helps you with your disks. Berkeley LUG meetings continue every second and fourth Sunday each month at Bobby Gs Pizzeria from noon to three in Berkeley. Please join us.

Our Mobile Future

Computing device choices of US consumers seem to increasingly indicate we prefer mobile devices, the web and the mobile web. Unix-like operating systems play a big role underneath it all. It will be interesting to see how these trends converge in the coming year.

There are about as many mobile phone subscriptions as people in the world with penetration averaging over 100% in Europe and many other countries. Developing countries are still catching up but are doing so quickly. the ITU released fascinating numbers in May, 2013 For smartphones, penetration is over 60% of in the US according to comscore in Oct, 2013. Every Android phone is a Linux device and every iOS device is based on Darwin. Though HTML5 can do amazing things, mobile apps are still a much more customized and compelling user experience so far. How do you think the mobile trends like Bluetooth low energy, Wi-Fi (Direct and more conventional 802.11n and 802.11ac just approved), cameras, mobile phones, tablets and wearables fit into our future?

We meet on the second and fourth Sundays of each month in Berkeley near the Downtown Berkeley BART station. We hope you join us at Bobby G’s Pizzeria.

LUG Podcast

Listen to the first two dvlug.org podcasts with Ian, Bethany and I. We cover a lot of ground. We are new at this and improving our show as we go. Feedback posted to comments on the website are encouraged. We invite all Berkeley LUG folks to comment and/or take a short BART ride to join us. We just recorded and will soon release a third episode with Jono Bacon of Canonical and Ubuntu about his book, Art of Community.

2012-06 Trusting Open Source

2012-07 Raspberry Pi $35 Computer

Berkeley LUG meetings continue every second and fourth Sunday each month from noon to three. Dvlug.org’s new schedule is the second and fourth Friday each month at 7 PM.

Trusting Open Source – Questions

This is going to be a series of blog posts on trusting open source. I am first introducing some questions that newcomers ask when first trying to understand the nature and model of open source software. These questions are crucial to getting answered adequately so that people can move on to using the software. I will talk about the security and reliability of open source and then alternatives to open source.

When you think about it, how can anyone trust the open source process and the code it produces? You don’t know who is coding what is running on your computer. If you aren’t a coder you aren’t looking at the code. Why does this work so well?

Few technical folks will use something they do not understand and/or trust. For others they need to know they have someone who can answer their questions. Tim O’Reilly calls these people alpha geeks. You may call them your nephews or nieces. Since nobody is born knowing everything about technology and because it changes we all need to learn sometime.

Some people still are trying to spread fear, uncertainty and doubt (FUD) about open source. These efforts have largely been shown to be specious. While science, technology engineering (somtimes art is included) and mathematics (STEM fields) is now the hot topic for the US education system, the scientific method itself seems to be under attack in some newspapers giving fact based arguments equal or less standing to conjecture.

Is open source right for you? I look forward to seeing your comments.

As a reminder for those in our area, our 4th Sunday meeting at Bobby G’s Pizzeria is going on now.

Verisign locked UEFI Bootloaders

What is this? Some vendors want to lock down the new UEFI boot loader on machines they sell you. It seems Red Hat and Fedora have some arrangement with Microsoft. Our own zareason will ship all systems with UEFI Secure Boot disabled until a more workable solution is found. The story has evolved quickly.

http://mjg59.dreamwidth.org/12368.html

http://boingboing.net/2012/05/31/lockdown-freeopen-os-maker-p.html

http://linux.slashdot.org/story/12/06/06/1232243/red-hat-clarifies-doubts-over-uefi-secure-boot-solution

Our usual second (and fourth) Sunday meeting is today too. Please join us.

Raspberry Pi, Take II

They’re here! Following up an excellent January berkeleylug blog entry by goosbears, the Raspberry Pi (raspberry_pi on twitter) is a $25, tiny cheap ARM computer for kids. The $35 version has an extra USB port and built in wired ethernet. USB wifi adapters can be used with it. Just add a monitor, keyboard, mouse and network and it’s a decently powered Linux computer with headers for experimentation. It was created by a UK registered charity and is now starting to ship to the backlog of thousands of orders. Much more is known now than was in January. People are starting to put them to good use.

The demo unit we had in our booth at Maker Faire was the star of the show. People came from all over the faire to our booth in order to try out the increasingly famous Raspberry Pi. The Raspberry Pi Foundation spoke at the Faire twice but I am not sure how many other exhibitors had one running live in their booth for people to see and use. The 1080p video we played raised some eyebrows for both the current movie trailer content as well as the strong performance of the little Raspberry Pi.

The North Bay LUG will be hosting a talk June 12th in Sebastopol by Allan Cecil on this incredible little computer. We are finalizing arrangements for a Raspberry Pi speaker for the Bay Area LUG on June 19th in San Francisco.

Since it’s only a printed circuit board (PCB) some additional parts are required to use one. I’ve seen some cool thingiverse 3D printed cases for these small computers. I need to get to noisebridge.net during an appropriate introductory event with the downloaded patterns and make my first 3D printed item on their rep-raps.

Debian is the recommended Linux distribution with Arch and QtonPi also available. Fedora is also supported. Unfortunately Ubuntu does not run on it because it is an ARM v6 board and Ubuntu currently only autobuilds for ARM v7.

A local nonprofit, Partimus, provides repurposed hardware and open source software to schools in San Francisco and Oakland. Full disclosure: one of the hats I wear is as a Partimus Director. We are taking suggestions for how to make best use of a donated Raspberry Pi from james2_0. Keep your eyes on the comments for what we decide to do with it.

Eben gives us the scoop in this Make Faire video.

//www.viddler.com/embed/79adb98a/?f=1&offset=22.288&autoplay=0&secret=76752710&disablebranding=0&view_secret=76752710

btrfs

The btrfs is a new Linux copy-on-write filesystem that will replace ext4. As the author of ext4, Theodore Ts’o agrees this is the right direction. The new filesystem is pronounced as either "butter F S", "better F S" or "B-tree F S".

The main site is hosted by kernel.org.
The biggest problem I heard about was that a user space tool was missing, however that was released in Feb, 2012 for use by sysadmins and Linux distributions.

https://btrfs.wiki.kernel.org/index.php/Getting_started#Enterprise_distributions_with_btrfs_support
Two distributions support it right now, Oracle (where btrfs is developed) and openSUSE. This Chris Mason video recorded April 2012 provides a current overview of the filesystem’s status.

We hope you have enjoyed our regular meetings at Bobby G’s in Berkeley on the second and fourth Sunday of each month. Our next meeting is May 27th. We also talked to an incredibly fun group of faire goers about Bay Area Linux all weekend at Maker Faire May 19th & 20th.

Killer App Alternatives

The Linux Journal covers an iTunes shiny red fruit alternative Juice (homepage) providing cross platform access to podcasts.

A key suite of software many people require when using a computer is word processing, spreadsheet, database and presentation software. The first cross platform one that comes to my mind as a solid alternative to commercial offerings is Libre Office though I don’t know what the state of The Document Foundation vs. Apache Foundation OpenOffice incubation might be to bring the OpenOffice name back to this excellent software product.

What apps do you find people must have when coming to Linux from other platforms?

P.S. As a reminder, our 4th Sunday meeting at Bobby G’s is this Sunday, April 22nd. I hope you can join us. As we skipped the 2nd Sunday due to Easter it’s been quite awhile.

P.P.S. Mark your calendars for the Ubuntu 12.04 LTS Precise Pangolin release party coming up this Thursday at 7PM in SF at the Thirsty Bear and the Ubuntu Developers Summit May 7-11 in Oakland.

My search findings on Learning C/C++ Programming and Using an IDE

My search findings on Learning C/C++ Programming and Using an IDE

Introduction

I’ll have to preface my search findings on these subjects, by mentioning that according to Risto S. Varanka’s Programming Languages mini-HOWTO: Programming Languages ;

C, Lisp and Perl are traditional hacking languages in the
GNU/Linux culture; Python, PHP, Java and C++ have gained new
ground recently

.
Furthermore, and mostly according to Veranka’s mini-HOWTO and to forum threads such as this one at ProgrammersHeaven.com/ ;
A. Perl is a great first programming language to learn for Beginners; Perl has the advantage of being an interpreted language instead of a language that requires a compiler and linker for creating binaries. Perl is an Object Oriented Programming (OOP) language that is especially powerful for handling text and strings. Perl is commonly used for scripting, for sysadmin-type tasks, and for web server tasks.

B. Python and Java are also great first programming languages for Beginners to learn; both Python and Java are modern up-to-date OOP languages used on web servers and for web-processing tasks. Python is especially useful for more general and application-specific scripting while Java is especially useful for cross-platform applications.

C. as appropriate 😉
C and C++ are apparently NOT languages for Beginners to first learn programming. Although executable binaries created from C or C++ generally run faster than interpreted source code, executable binaries (i.e., the actual applications) require the EXTRA steps of compilation and linking from original C/C++ source code, not to mention any necessary required debugging and optimization steps. Both C and C++ programming languages are especially useful for creating applications. C is more of a Procedural than an OOP language such as C++, and many describe C as being the MOST suitable for the system and in-depth OS tasks that Linux distros rely upon using the GNU Compiler Collection’s ‘gcc’.
* Note that “GCC” is the acronym for the overall GNU Compiler Collection whereas “gcc” is the specific acronym specifically for the GNU Compiler Collection’s C compiler itself.

From my own limited experience, I would probably place Perl and maybe Bash shell-scripting ahead of C and C++ for Beginners first learning how to program. I would guess that many of us who have already programmed using Perl and Bash shell-scripting could probably use a refresher or two in these :-).
A good “Perl tutorials” web search using the privacy-minded search engines ixquick and/or Startpage should yield worthwhile hits very similar to these handful :

grantbow has a collection of good Bash shell scripting tutorials and resources within his Learning the Command Line webpage, and also helpful in this regard is chapter 7 of the Rute User’s Tutorial and Exposition.

With all that being said, here are some working links I have found regarding learning and compiling C/C++ programs.

I. Tutorials to learn C/C++

II. Simple C/C++ Compilation

The simplest and probably the best initial manner of learning C/C++ programming in Linux using these tutorials on the command line is to:

  1. Type in and edit your C/C++ source code using whatever text editor you most prefer (e.g., vi/vim/nvi, nano/pico, gedit, nedit, leafpad, mousepad,…whatever else) and then save the file with the suffix `.c’ for C programs or one of the suffixes `.C’, `.cc’, `.cpp’, `.CPP’, `.c++’, `.cp’, or `.cxx’ for C++ programs.
  2. Compile and link your properly-suffixed source code file from the command line using the typical ‘gcc’ or ‘g++’ command+options for C and C++ respectively.
  3. Run the default executable file by entering ‘./a.out’.

For getting more familiar with using gcc and g++ in steps 2 and 3, there are:

  • Cprogramming.com’s aptly-titled gcc compiler and g++ compiler webpages.
    Quick, simple, and these provide appropriate mention of the GNU Debugger, ‘gdb’.
  • develvid’s YouTube video Compiling with GCC (probably should be “gcc” instead)
    This video shows sequence of command line screenshots using the vim editor and a few ways to use gcc to compile and run a pair of simple C programs. Covers the above steps 1 through 3 in a quick 4 1/2 minutes.
  • Brian Gough’s An Introduction to GCC for the GNU Compilers gcc and g++ with a Forward written by RMS.
  • The FSF gnu.org’s Invoking GCC – GCC Command Options.
    Given that the entire site, gcc.gnu.org/onlinedocs/gcc, is the gnu.org’s official guides to GNU compilers, this webpage is as fully complete and as up-to-date as the FSF can make it. It seems a bit too complex for Beginners to proceed very far beyond the basic ‘Invoking GCC – GCC Command Options’ though.
  • The gcc(1) and g++(1) man[ual] reference pages.
    Their SYNOPSES and DESCRIPTIONS sections seem to be the most useful, although their OPTIONS sections can be overwhelming with the vast number of listed options for both gcc and g++.

III. Using an IDE

Instead of creating and testing C/C++ programs through the three-step manual method just described above, I have also discovered a few Integrated Developmental Environments (IDEs) for Linux to handle C/C++ program development all the way from editing C/C++ source code to correcting syntax, compiling, linking, full debugging amd code optimizations.
Using a C/C++ IDE also goes a long way to relieving the need for Beginners to venture too heavily into the more Advanced-level programming processes of contimually running the gcc/binutils toolchain, ‘make’ and ‘gdb’ to create Linux system binaries.

 

____________________________________________________________

Good and better recommendations & suggestions regarding these are always welcome 🙂

—-
Go Open Source Software Bears!

Cool little cheapo Linux device for 2012…

Good news this start-of-year 2012 for some of us Linux DIY tinkerers:
The little Raspberry Pi device is set to be released soon.
The Raspberry Pi comes as a Printed Circuit Board with a processing System on a Chip (also known as a PCB with a SoC). Already eBay is auctioning off the first Beta releases of these boards, see Raspberry Pi – first 10 on eBay!

What’s a Raspberry Pi?
( NO, NO, NO, a “raspberry pi” is NOT your typical sound of Thhhbbbbbbbbtttt or Tphttphttphtphtphtphtpht or :)~ +plus+ the Greek letter for the infamous mathematical Euclidean constant near 3.14 !!! )
The Raspberry Pi is actually a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We [the Raspberry Pi creators] want to see it being used by kids all over the world to learn programming.
(this from the Raspberry Pi FAQs webpage )

The main Raspberry Pi website is http://www.raspberrypi.org and here is a nice video of Raspberry Pi Foundation’s Executive Director Eben Upton describing and demonstrating the Pi model “B” beta PCBs that are to be auctioned off (in his “blimey mate” UK accent)

Key Features of the Raspberry Pi “B” Model:

  • It is projected to cost $35 USD, it comes with 256MB onboard RAM, and it has built-in 10/100 wired Ethernet capability.
  • It measures 85.60mm x 53.98mm x 17mm (that’s 3.37″ x 2.125″ for its two major dimensions), with a little overlap for the SD card and connectors which project over the edges. It weighs 45g.
  • Its main processor is a 700MHz-speed ARM11 Broadcom BCM2835 SoC.
  • Power to the board (Power to The Peopletoo!) is through a 5V micro USB power supply.
  • The disk used to boot and load an OS on the Pi is a standard-profile SD card. Debian GNU/Linux has already been preloaded onto SD cards and tested for Beta versions of the Pi board. Fedora and ArchLinux have purportedly been SD-preloaded as well. Ubuntu, however, has apparently not yet committed to fully supporting the device at this time, due to issues with newer releases of Ubuntu and the ARM processor the Raspberry Pi Foundation is using.
  • External storage (semi-permanent), mice, keyboards, wireless adapters, and other add-ons will all connect to the Pi via an external USB expansion hub (non-supplied) attached to the Pi’s single built-in USB 2.0 root hub. Further USB add-on devices will connect to the Pi through one or more additionally-supplied USB hubs connected to the first.
  • There is composite and HDMI built into the Pi board, so you can hook it up to a digital or analogue television or to a DVI monitor. There is no VGA support, but adaptors are available.
  • The Pi’s standard 3.5mm jack provides audio to your speakers or headphones.

Cool little tchotchke, eh?

Note that covering-cases are not yet easily available for the Pi, although vendors will probably offer these in the future depending upon how successful the Pi becomes.
DIY’ers might want to use easily-malleable materials to make or mod their own Pi cases, e.g., using wood, plastic, metal or whatever else is suitable for the task.

—————————————

Here is one my first estimates of the breakdown and total cost of a complete computer system using the Pi board (prices in USD):
+ $35 for the Pi “B” board itself
+ $40 for a used, budget-conscious LCD monitor with VGA
+ $30 for the cost of a discounted wireless USB adapter
+ $30 for the cost of a discounted 4-port USB 2.0 hub
+ $20 for the cost of a discounted 4GB SD card
+ $20 for the costs of a used and discounted USB keyboard and USB mouse
+ $20 for the cost of a HDMI-to-VGA converter
+ $10 for the cost of a 4GB USB thumbdrive used for semi-permanent storage
+ $40 for Taxes plus Shipping & Handling of all the above, if ordered from an outside vendor
+ costs for any extra materials & labor (e.g., for constructing a case)
===
~ $250 Total

I’m uncertain exactly HOW realistic this first estimate actually is.
Of course, you would pay far less than this estimate if you already HAVE these items laying around -or- you can get these for far less than the above estimate via eBay/Amazon/Craigslist/other-online/local venues. Then again, maybe my above first estimate may be an UNDERestimate and you might have to pay more.  I suspect that most longtime computer techies already having most of the equipment listed here will realistically have substantially lower total costs for the above-listed items; probably well below $100.

—————————————

I’m further guessing that if a complete computer system containing a Pi board falls well below an $80 pricepoint (e.g., due to mass-production, consolidation of components and deep depreciation of component costs), then such a computer system would be a good deal and more and more persons will want to jump on board, so to speak :-D.

Feedback on all this from anyone reading this post?

I wonder whether more of these Raspberry Pi beta boards will be available at the big Southern California Linux Expo SCALE 10X going on later this month??