Running Qt for Embedded Linux 4.8.5 Examples - qt

I've installed Qt for Embedded Linux (Qt 4.8.5) using the official installation guide. However, when I run any of the installed examples in QtCreator 3.0.1, I get the following error:
QWSSocket::connectToLocalFile could not connect:: Connection refused
No Qt for Embedded Linux server appears to be running.
If you want to run this program as a server,
add the "-qws" command-line option.
And if I run using the -qws option, I get:
QScreenLinuxFb::connect: Permission denied Error opening framebuffer
/dev/fb0 The program has unexpectedly finished.
From google results, I can see that it's related to permission settings, probably with framebuffer device (/dev/fb0). Following is the output of ls -al /dev/fb0 on my ubuntu 12.04 LTS system:
$ ls -al /dev/fb0
crw-rw---- 1 root video 29, 0 Apr 21 22:43 /dev/fb0
I've added the currently logged in user to the video group that /dev/fb0 belongs to. Still I'm getting the permission denied error.
If I run the /examples/qws/framebuffer example using sudo, I'm getting the following output:
The framebuffer device was opened successfully.
Fixed screen info:
id: inteldrmfb
smem_start: 0xc0073000
smem_len: 5763072
type: 0
type_aux: 0
visual: 2
xpanstep: 1
ypanstep: 1
ywrapstep: 0
line_length: 6400
mmio_start: 0x0
mmio_len: 0
accel: 0
The framebuffer device was mapped to memory successfully.
Was in graphics mode already. Skipping
Variable screen info:
xres: 1600
yres: 900
xres_virtual: 1600
yres_virtual: 900
yoffset: 0
xoffset: 0
bits_per_pixel: 32
grayscale: 0
red: offset: 16, length: 8, msb_right: 0
green: offset: 8, length: 8, msb_right: 0
blue: offset: 0, length: 8, msb_right: 0
transp: offset: 0, length: 0, msb_right: 0
nonstd: 0
activate: 0
height: -1
width: -1
accel_flags: 0x1
pixclock: 0
left_margin: 0
right_margin: 0
upper_margin: 0
lower_margin: 0
hsync_len: 0
vsync_len: 0
sync: 0
vmode: 0
Frame Buffer Performance test...
Average: 916 usecs
Bandwidth: 6000.102 MByte/Sec
Max. FPS: 1091.703 fps
Will draw 3 rectangles on the screen,
they should be colored red, green and blue (in that order).
Done.
However, I do not see the 3 rectangles on screen.
Could someone please help outline how to run these Qt for Embedded Linux (Qt 4.8.5) examples on the Ubuntu desktop environment?

I am also using a 12.04 system only but with Qt 4.6.1.
I ran into the same issues as you and found that, when I run using -qws from console (Ctrl + Alt + F1) terminal the GUI can be seen.
When run from the GUI terminal or Qt Creator, though the window is presented, the OS's GUI (X11) overwrites the screen with its contents during screen refresh.
If you want to be able to run Qt GUI apps from Qt Creator or a GUI OS, qvfb needs to be running in the background.
This link throws some information on this : http://qt-project.org/doc/qt-4.8/qvfb.html
Hope this helps !

Related

Strange "attempt to access beyond end of device", where to look?

I am running a few Xen servers on my company network. Recently, on one of them, I have been trying to rsync (on the Dom0 console) a big server image from another machine, but every time run in to a system crash after somewhere between 30 and 100 GB. The syslog and kernel log show me something like this:
Sep 12 16:41:19 ampxen1 kernel: [ 1730.917516] attempt to access beyond end of device
Sep 12 16:41:19 ampxen1 kernel: [ 1730.917518] dm-1: rw=1, want=8878402463988083936, limit=3759505408
Sep 12 16:41:19 ampxen1 kernel: [ 1730.917520] EXT4-fs warning (device dm-1): ext4_end_bio:323: I/O error 10 writing to inode 33030164 (offset 47354740736 size 5881856 starting block 1109800307998510491)
...continuing with several hundred thousands of similar lines per second, eventually making the machine unreachable. The very high number of the starting block of the EXT4-write operation (that's 10^18 or the exabyte range) is clearly what to look at, but I am unable to find any mention of what could be the cause.
The server is based on ubuntu-18.04.03, standard xen install from the repositories. Storage is two 2TB disks in RAID1, configured as seen below, EXT4 filesystem on the large partition used for our server images. I have checked the disks with smartctl and the file system(s) with e2fsck, for what it's worth. It seems to be a file system issue, but I am wondering whether the xen kernel could be involved. Any ideas of what to look for would be appreciated!
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 500G 0 loop
sda 8:0 0 1,8T 0 disk
├─sda1 8:1 0 476M 0 part /boot/efi
├─sda2 8:2 0 1,8T 0 part
│ └─md0 9:0 0 1,8T 0 raid1
│ ├─ampxen1.0-ampxen1.dom0 253:0 0 23,3G 0 lvm /
│ └─ampxen1.0-ampxen1.vms0 253:1 0 1,8T 0 lvm /srv/vms0
└─sda3 8:3 0 46,5G 0 part [SWAP]
sdb 8:16 0 1,8T 0 disk
├─sdb1 8:17 0 476M 0 part
├─sdb2 8:18 0 1,8T 0 part
│ └─md0 9:0 0 1,8T 0 raid1
│ ├─ampxen1.0-ampxen1.dom0 253:0 0 23,3G 0 lvm /
│ └─ampxen1.0-ampxen1.vms0 253:1 0 1,8T 0 lvm /srv/vms0
└─sdb3 8:19 0 46,5G 0 part [SWAP]
I finally figured out that the problem was something as trivial as a faulty RAM block – running a memtest showed lots of errors on one of the four 16GB blocks. It seems that memory was only maxed out exactly when copying large files, while my existing virtual servers on the machine were running just fine at all other times.

Problems in executing mpi with machinefile Ubuntu 18.04

following these guidelines MpichClusterUbuntu, I'm trying to execute my very first mpi program with a PC with Ubuntu 18.04.01 Server Edition and a laptop with Ubuntu 18.04.02 Desktop. Till step 11 of this guideline, everything went fine, with no problems at all.
I set up a machinefile called hosts
with these two lines:
192.168.1.7 # first 'master' node: the PC
192.168.1.5 # second node: the laptop
After compiling the very simple example file contained in the guidelines without:
#include <stdio.h>
#include <mpi.h>
int main(int argc, char** argv) {
int myrank, nprocs;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
printf("Hello from processor %d of %d\n", myrank, nprocs);
MPI_Finalize();
return 0;
}
mpiu#pc01:~$ mpicc mpi_hello.c -o mpi_hello
Executing without considering the machinefile 'hosts', this is the output:
mpiu#pc01:~$ mpiexec -n 8 ./mpi_hello
------------------------------------------------------------------
[[27419,1],0]: A high-performance Open MPI point-to-point messaging
module was unable to find any relevant network interfaces:
Module: OpenFabrics (openib)
Host: pc01
Another transport will be used instead, although this may result in
lower performance.
NOTE: You can disable this warning by setting the MCA parameter
btl_base_warn_component_unused to 0.
----------------------------------------------------------------
Hello from processor 1 of 8
Hello from processor 2 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 0 of 8
Hello from processor 3 of 8
Hello from processor 7 of 8
Hello from processor 4 of 8
[pc01:25010] 7 more processes have sent help message help-mpi-btl-
base.txt / btl:no-nics
[pc01:25010] Set MCA parameter "orte_base_help_aggregate" to 0 to see all
help / error messages
And when executing calling the machinefile 'hosts', the execution remains idle without producing any output:
mpiu#pc01:~$ mpiexec -n 8 -machinefile hosts ./mpi_hello
PS:
this is the content of /etc/netplan/50-cloud-init.yaml in the "master" node (PC):
network:
ethernets:
enp3s0:
#addresses: []
#dhcp4: true
addresses: [192.168.1.7/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
dhcp4: no
version: 2
Updates:
after the correct comment of Gilles, I removed openmpi which I guess it was installed previously.
Now executing the step 11 of the guidelines MpichClusterUbuntu18.04 :
A) without calling the machinefile:
marco#pc01:/mirror$ mpiexec -n 8 ./mpi_hello
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 3 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 7 of 8
Hello from processor 2 of 8
Hello from processor 4 of 8
B) But calling the machinefile "hosts":
marco#pc01:/mirror$ mpiexec -n 8 -machinefile /home/mpiu/hosts
./mpi_hello
ssh: Could not resolve hostname pc0: Temporary failure in name resolution
ssh: Could not resolve hostname riccarcohp: Temporary failure in name
resolution
^C[mpiexec#pc01] Sending Ctrl-C to processes as requested
[mpiexec#pc01] Press Ctrl-C again to force abort
[mpiexec#pc01] HYDU_sock_write (utils/sock/sock.c:286): write error (Bad
file descriptor)
[mpiexec#pc01] HYD_pmcd_pmiserv_send_signal (pm/pmiserv
/pmiserv_cb.c:177): unable to write data to proxy
[mpiexec#pc01] ui_cmd_cb (pm/pmiserv/pmiserv_pmci.c:79): unable to send
signal downstream
[mpiexec#pc01] HYDT_dmxu_poll_wait_for_event (tools/demux
/demux_poll.c:77): callback returned error status
[mpiexec#pc01] HYD_pmci_wait_for_completion (pm/pmiserv
/pmiserv_pmci.c:198): error waiting for event
[mpiexec#pc01] main (ui/mpich/mpiexec.c:340): process manager error
waiting for completion
After putting in machinefile 'hosts' only the IP Addresses:
mpiu#pc01:/mirror$ mpiexec -n 8 -machinefile /home/mpiu/hosts ./mpi_hello
Permission denied, please try again.
Permission denied, please try again.
mpiu#192.168.1.5: Permission denied (publickey,password).
But I can ssh with no problems at all from the PC to the laptop:
mpiu#pc01:/mirror$ ssh 192.168.1.5
mpiu#192.168.1.5's password:
mpiu#riccardo-HP-Laptop-15-da0xxx:~$
Now it seems SOLVED, even if I repeated for the third time, right the same procedure:
these are the steps I followed for setting up passwordless SSH between pc01 (the and riccardohp (laptop):
marco#pc01:/$ su - mpiu
Password:
mpiu#pc01:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mpiu/.ssh/id_rsa):
Created directory '/home/mpiu/.ssh'.
To make it simpler, I left out the passphrase:
Your identification has been saved in /home/mpiu/.ssh/id_rsa.
Your public key has been saved in /home/mpiu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:..... mpiu#pc01
The key's randomart image is:
+---[RSA 2048]----+
...................
...................
+----[SHA256]-----+
I copied the public key from pc01 to the laptop:
mpiu#pc01:~$ ssh-copy-id 192.168.1.5
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home
/mpiu/.ssh/id_rsa.pub"
The authenticity of host '192.168.1.5 (192.168.1.5)' can't be
established.
ECDSA key fingerprint is SHA256:.......................
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to
filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are
prompted now it is to install the new keys
mpiu#192.168.1.5's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.1.5'"
and check to make sure that only the key(s) you wanted were added.
mpiu#pc01:~$ ssh '192.168.1.5'
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-16-generic x86_64)
mpiu#riccardo-HP-Laptop-15-da0xxx:~$
So, apparently, it seems that the ssh connection between pc01 and the laptop works fine...
mpiu#riccardo-HP-Laptop-15-da0xxx:~$ ^C
mpiu#riccardo-HP-Laptop-15-da0xxx:~$ logout
Connection to 192.168.1.5 closed.
mpiu#pc01:~$ cd /
mpiu#pc01:/$ cd mirror
mpiu#pc01:/mirror$ mpicc mpi_hello.c -o mpi_hello
gcc: error: mpi_hello.c: No such file or directory
mpiu#pc01:/mirror$ nano mpi_hello.c
mpiu#pc01:/mirror$ mpicc mpi_hello.c -o mpi_hello
mpiu#pc01:/mirror$ mpiexec -n 8 ./mpi_hello
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 2 of 8
Hello from processor 3 of 8
Hello from processor 4 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 7 of 8
I put in file hosts in /mirror:
192.168.1.7
192.168.1.5
mpiu#pc01:/mirror$ mpiexec -n 8 -machinefile hosts ./mpi_hello
Hello from processor 2 of 8
Hello from processor 4 of 8
Hello from processor 6 of 8
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 3 of 8
Hello from processor 5 of 8
Hello from processor 7 of 8
Marco

Video play on arm-Preemption disabled at <>

I am currently using an ARM Freescale processor board to perform video playback:
When I use the Qt Multimedia libraries over the application I get a Preemption before the video playback freezes:
root#sanuser:~# /home/app.sh start
====== AIUR: 4.1.4 build on Mar 2 2018 10:49:12. ======
Core: MPEG4PARSER_06.09.36 build on Aug 23 2016 05:18:47
file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm11_elinux.so.3.2
------------------------
Track 00 [video_0] Enabled
Duration: 0:02:07.280000000
Language: und
Mime:
video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)640, height=(int)480, framerate=(fraction)25/1, codec_data=(buffer)014d401effe10018674d401eda0280f6c044000003000400000300c83c58ba8001000468ef3c80
------------------------
------------------------
Track 01 [audio_0] Enabled
Duration: 0:02:07.317000000
Language: und
Mime:
audio/mpeg, mpegversion=(int)4, channels=(int)6, rate=(int)48000, bitrate=(int)384039, stream-format=(string)raw, codec_data=(buffer)11b0
------------------------
====== BEEP: 4.1.4 build on Mar 2 2018 10:49:24. ======
Core: AAC decoder Wrapper build on May 30 2016 12:33:44
file: /usr/lib/imx-mm/audio-codec/wrap/lib_aacd_wrap_arm12_elinux.so.3
CODEC: BLN_MAD-MMCODECS_AACD_ARM_03.09.00_CORTEX-A8 build on Jul 13 2016 18:15:25.
[INFO] bitstreamMode 1, chromaInterleave 0, mapType 0, tiled2LinearEnable 0
BUG: scheduling while atomic: vqueue:src/642/0x00000101
Preemption disabled at:[<80101544>] __do_softirq+0x5c/0x3b4
However the video play back is smooth while using gstreamer pipeline without any issues:
gst-launch-1.0 -v filesrc location=/home/SampleVideo_720x480.mp4 typefind=true ! qtdemux !queue max-size-time=0 !vpudec ! videoconvert ! imxipuvideosink framebuffer=/dev/fb0
Qt multimedia system happens to trigger a kernel bug. It may be bug in Qt too, but no userspace application should be triggering a kernel panic. And that's what BUG: scheduling while atomic is. It's a driver bug somewhere in the kernel code, possibly the video driver for the board. Probably gstreamer has a workaround for that kernel bug, or does something differently and the kernel bug isn't hit. But it's definitely a kernel bug, no doubt about it.

Determine Which Hard Drive the Database-Files/Transaction-Files are Stored

I have an old Sybase server whose database is acting up. I have tried rebuilding the file-system and the database file. But the problem returns. I want to replace the hard drive that the database-files and transaction-files are stored. I want to determine exactly which hard drive it is because I am not familiar with Unix. Moreover, I also want to see if those files are stored in the same hard drive as the operating system or not; if they are, I will need to re-install the operating system as well as restoring the database to the new hard drive. Obviously this will be better if the database-files and the transaction-files are not in the same hard drive as the operating system. Please help me to determine these two things.
So far, I have found these:
(1) I use sp_helpdb command and find that the database files and the transaction files are stored in these logical devices:
sybdbs
syblogs
master
sybdbs2
(2) I use sp_helpdevice command to look into those 4 logical devices shown above, and find that those logical devices are in these physical devices:
/dev/rdsk/c0t0d0s1
/dev/rdsk/c0t3d0s4
d_master
/dev/rdsk/sybdbs2
(3) When I use sp_helpdevice to show all the physical devices, I see this:
device_name physical_name description status cntrltype device_number low high
------------------ ------------------------------------------- ------------------------------------------------ ------ --------- ------------- -------- --------
historydump /export/home/syb11.dump/history.dump disk, dump device 16 2 0 0 0
isproddump /export/home/syb11.dump/isprod.dump disk, dump device 16 2 0 0 0
istestdump /export/home/syb11.dump/istest.dump disk, dump device 16 2 0 0 0
master d_master special, physical disk, 100.00 MB 2 0 0 0 51199
masterdump /export/home/syb11.dump/master.dump disk, dump device 16 2 0 0 0
modeldump /export/home/syb11.dump/model.dump disk, dump device 16 2 0 0 0
prodtestdump /export/home/syb11.dump/prodtest.dump disk, dump device 16 2 0 0 0
sybdbs /dev/rdsk/c0t0d0s1 special, default disk, physical disk, 2000.00 MB 3 0 3 50331648 51355647
sybdbs2 /dev/rdsk/sybdbs2 special, physical disk, 1.00 MB 2 0 5 83886080 83886591
syblogs /dev/rdsk/c0t3d0s4 special, physical disk, 850.00 MB 2 0 4 67108864 67544063
sybscurty /dev/rdsk/c0t3d0s5 special, physical disk, 100.00 MB 2 0 2 33554432 33605631
sybsecuritydump /export/home/syb11.dump/sybsecurity.dump disk, dump device 16 2 0 0 0
sybsystemprocsdump /export/home/syb11.dump/sybsystemprocs.dump disk, dump device 16 2 0 0 0
sysprocsdev /dev/rdsk/c0t0d0s4 special, physical disk, 100.00 MB 2 0 1 16777216 16828415
tapedump1 /dev/rmt4 tape, 625 MB, dump device 16 3 0 0 20000
tapedump2 /dev/rst0 disk, dump device 16 2 0 0 20000
uniface724dump /export/home/syb11.dump/uniface724.dump disk, dump device 16 2 0 0 0
uniface7dump /export/home/syb11.dump/uniface7.dump disk, dump device 16 2 0 0 0
(4) I want to know more about those physical devices. I use the df command to examine them:
df -k /dev/rdsk/c0t0d0s1
df -k /dev/rdsk/c0t3d0s4
df -k d_master
df -k /dev/rdsk/sybdbs2
The df command complains that the first three devices are “not a block device, directory or mounted resource”.
On the other hand, the df command shows the following info for the last device:
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t3d0s0 576558 371019 147889 71% /
In any case, this doesn’t tell me which drive(s) those devices are on.
(5) When I use the mount command, I see this:
/ on /dev/dsk/c0t3d0s0 read/write/setuid on Mon Jul 6 11:10:46 2015
/usr on /dev/dsk/c0t3d0s6 read/write/setuid on Mon Jul 6 11:10:46 2015
/proc on /proc read/write/setuid on Mon Jul 6 11:10:46 2015
/dev/fd on fd read/write/setuid on Mon Jul 6 11:10:46 2015
/tmp on swap read/write on Mon Jul 6 11:10:49 2015
/export on /dev/dsk/c0t3d0s7 setuid/read/write on Mon Jul 6 11:10:49 2015
/freespace on /dev/dsk/c0t0d0s5 setuid/read/write on Mon Jul 6 11:10:49 2015
/sybase on /dev/dsk/c0t0d0s0 setuid/read/write on Mon Jul 6 11:10:49 2015
/usr/openwin on /dev/dsk/c0t3d0s3 setuid/read/write on Mon Jul 6 11:10:49 2015
I cannot figure out the connection between the mounted devices above to the physical devices for the database-files and the transaction-files. I also cannot link the mounted devices above to the hard drives shown in the next section.
(6) When I use the cat /etc/vfstab command, I see these:
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
/proc - /proc proc - no -
fd - /dev/fd fd - no -
swap - /tmp tmpfs - yes -
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no -
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 no -
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /export ufs 2 yes -
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /freespace ufs 2 yes -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 /sybase ufs 2 yes -
/dev/dsk/c0t3d0s3 /dev/rdsk/c0t3d0s3 /usr/openwin ufs 2 yes -
/dev/dsk/c0t3d0s1 - - swap - no -
# The following lines have been commented-out to allow Sybase to access these
# partitions and Raw Partitions. Nov-24-1999
# /dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /master ufs 2 yes -
# /dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 /sybdbs ufs 2 yes -
# /dev/dsk/c0t3d0s4 /dev/rdsk/c0t3d0s4 /syblogs ufs 2 yes -
# /dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5 /sybscurty ufs 2 yes -
# /dev/dsk/c0t0d0s4 /dev/rdsk/c0t0d0s4 /sybtemproc ufs 2 yes -
(7) When I use the format command, I see these two hard drives:
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <IBM-DNES-309170-SA30 cyl 11195 alt 2 hd 5 sec 320>
/iommu#f,e0000000/sbus#f,e0001000/espdma#f,400000/esp#f,800000/sd#0,0
1. c0t3d0 <SEAGATE-ST34520N-1206 cyl 9004 alt 2 hd 4 sec 246>
/iommu#f,e0000000/sbus#f,e0001000/espdma#f,400000/esp#f,800000/sd#3,0
(8) I don’t see any external device attached to the Sybase server. Having said this, there is a backup Sybase server, and the backup Sybase server has an external device attached to it (through a SCSI cable). At this point, I assume the database-files and transaction-files are all stored inside the Sybase server.
By the way, the Sybase server uses this Unix operating system:
SunOS <my-server-name> 5.4 Generic_101945-62 sun4m sparc
And the Sybase version is:
SQL Server/11.0.3.2/P/Sun_svr4/OS 5.4/SWR 7578 Rollup/OPT/Mon Nov 3 22:19:21 PST 1997
By the way, what I have tried so far to repair the database are:
• Tried dbcc checkalloc(, fix). Unfortunately, this command could not fix and could not complete.
• Tried drop-db/add-new-db/restore-db-from-backup. Unfortunately the restore failed to complete.
• Tried fsck-to-fix-the-devices. It could not complete and complained about “MAGIC NUMBER WRONG”.
• Tried Analyze-option-in-format-command-to-repair-Disk-0, and then add-new-db and restore-db-from-backup. This method seemed to work. But after one week or so, I found a table has I/O error. Honestly, I don’t even know if the databases are really in Disk-0 or not.
Please help me to determine which hard drive those database-files and transaction-files are stored, and whether they are in the same hard drive as the Unix operating system.
Thanks in advance.
Jay Chan

Openstack Instance does not use the entire hard disk

I created new vm instance using "Ubuntu Server 10.04 LTS (Lucid Lynx) - 32 bits" image and m1.small falvour which has 20 GB Disk (OpenStack Icehouse). When i logging to the vm and run df -h , I found that the VM does not use the entire assigned HD. The command results are shown as the following:
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 1.4G 595M 721M 46% /
none 1005M 144K 1005M 1% /dev
none 1007M 0 1007M 0% /dev/shm
none 1007M 36K 1007M 1% /var/run
none 1007M 0 1007M 0% /var/lock
none 1007M 0 1007M 0% /lib/init/rw
The "fdisk -l" shows the DH size is 20 GB:
Disk /dev/vda: 21.5 GB, 21474836480 bytes
4 heads, 32 sectors/track, 327680 cylinders
Units = cylinders of 128 * 512 = 65536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cb9da
Device Boot Start End Blocks Id System
/dev/vda1 * 17 32768 2096128 83 Linux
I need the vm to take the full space assigned to it. Any idea how could I fix it? I want the solution to be applied on each vm I create, so I do not want to manually update the VM after instantiation. I also must use 10.04 image ( can not upgrdate to 14.04)
The problem here is the image. I grabbed that one and ran it up, it's pretty simple to run a
sudo resize2fs /dev/vda1
which will resize the filesystem to the size of the partition, which seems to be 2GB. Beyond that, you have to increase the partition size. For that I think you're probably best off using virt-resize, there are some good howto's out there e.g. askubuntu, in essence:
SSH into your openstack controller node
source keystonerc_admin (or whatever yours may be called)
nova list --all-tenants | grep <instance_name> or just grab the server guid from horizon
nova show <server_guid> and note which nova host your machine is running on. Also note the instance name (e.g. instance-00000adb)
SSH into that nova node
virsh dumpxml instance-00000adb and look for the image file. On mine, this is /var/lib/nova/instances/<server_guid>/disk but that may not always be the case?
yum install libguestfs-tools
truncate -r /var/lib/nova/instances/d887249a-0d95-473e-b4f2-41f71df4dbb5/disk /var/lib/nova/instances/d887249a-0d95-473e-b4f2-41f71df4dbb5/disk.new
truncate -s +2G /var/lib/nova/instances/d887249a-0d95-473e-b4f2-41f71df4dbb5/disk.new
virt-resize --expand /dev/sda1 /var/lib/nova/instances/d887249a-0d95-473e-b4f2-41f71df4dbb5/disk /var/lib/nova/instances/d887249a-0d95-473e-b4f2-41f71df4dbb5/disk.new
mv disk disk.old ; mv disk.new disk
NB - mine didn't quite work when I booted that up again, not got time to investigate yet but it can't be far off that, and hopefully this helps.
Once you've managed to boot that up again, then you can shut it down and create a snapshot from horizon. You can then use that snapshot just like any other image, and launch all subsequent VMs directly from there.
HTH.

Resources