I have a CentOS guest system in a Windows host. The virtual drive was originally 20 GB, then I resized it to 60 using the VBoxManage utility.
VirtualBox reports the expected virtual size (see picture below), but the guest system keeps reporting it's out of storage space. Copying in some files above the limit fails, df reports it having only 20 GB for some reason.
Are there any extra steps I need to take to actually increase the size of the drive?
Guest system:
In my case, after resizing the partition with GParted and booting up the VM, I also had to extend the logical volume and then grow the file system to the available size:
(logged in as root)
lvextend -l +100%FREE /dev/centos/root
xfs_growfs /dev/centos/root
'df -h' then shows the new size.
Your disk is now having more space, but your partition still does not. You have to resize also partition to get the additional "physical" space to be available to the OS. As from you question is not clear what Centos version you use, assuming it's Centos7, i may recommend you to use lvextend
sudo lvextend -L+40G -r /dev/mapper/centos-root
Also, i recommend to make a snapshot of your VM hard drive, before doing any actual changes, so you can quickly rollback changes and start over.
Related
When I use vm a long time, or started operations with big files in my vm, periodially I get bug: process vmware-vmx.exe never stop disk activity and vm stops responding(or very slow).
Host system: windows 10;
Client (usual): ubuntu 16.04.
That problem happened on different disks (samsung, seagate) and different client systems (various ubuntu).
All disks have alot of free place and don't have bad sectors.
This problem resolved: just update vmware with 12.1.0 to 12.5.2 and in a vm-ubuntu system: etc/fstab swap should not be disabled.
(sorry for bad English, I'm German)
I'm trying to write a program on linux that writes data on any inserted USB flash device that is inserted.
But this:
file = fopen("/run/media/abc/xyz/logFile.txt", "w");
will fail if the username is not abc, or the name of the device is not xyz or linux does not want my program to work.
I found a program that outputs this:
sysfs /sys
proc /proc
devtmpfs /dev
securityfs /sys/kernel/security
tmpfs /dev/shm
devpts /dev/pts
tmpfs /run
tmpfs /sys/fs/cgroup
cgroup /sys/fs/cgroup/systemd
pstore /sys/fs/pstore
cgroup /sys/fs/cgroup/freezer
cgroup /sys/fs/cgroup/cpu,cpuacct
cgroup /sys/fs/cgroup/perf_event
cgroup /sys/fs/cgroup/memory
cgroup /sys/fs/cgroup/pids
cgroup /sys/fs/cgroup/net_cls,net_prio
cgroup /sys/fs/cgroup/blkio
cgroup /sys/fs/cgroup/devices
cgroup /sys/fs/cgroup/cpuset
cgroup /sys/fs/cgroup/hugetlb
configfs /sys/kernel/config
/dev/mapper/fedora_msi--linux-root /
selinuxfs /sys/fs/selinux
systemd-1 /proc/sys/fs/binfmt_misc
debugfs /sys/kernel/debug
hugetlbfs /dev/hugepages
tmpfs /tmp
mqueue /dev/mqueue
binfmt_misc /proc/sys/fs/binfmt_misc
nfsd /proc/fs/nfsd
/dev/sda1 /boot
/dev/mapper/fedora_msi--linux-home /home
sunrpc /var/lib/nfs/rpc_pipefs
tmpfs /run/user/1000
gvfsd-fuse /run/user/1000/gvfs
fusectl /sys/fs/fuse/connections
/dev/sdc1 /run/media/username/usbname
But using this looks like bad style to me and I don't know how to differ between "/dev/sdc1 /run/media/username/usbname" (the right one) and "/dev/sda1 /boot" (the false one).
Note: The Program is does not have to run on non-Linux operating systems.
Note: I do not want to write directly into /dev/sdc1
I would be thankful if anyone knows how to find the correct mounting points, or if anyone gives me a link to (official) documentation.
In Linux generally, you need to mount the attached device into a directory on your filesystem for reading and writing from that.
In your case, as I can see your distro (Ubuntu perhaps?) has already mounted the device into /run/media/username/usbname, which has been done automatically for end-user. So, your code may works on this distro and does not work on others(or even in Ubuntu server) which requires the mounting progress should be done manually.
I can suggest you research tutorial like this to understand how to work with usb flash drive on Linux first. How to mount the devices manually using command line.
Then make yourself a directory, name it whatever you want. Automatically mount devices to that directory when it is plugged (a bit of Bash scripting, perhaps)
Finally, you can do whatever you want on your directory using C++ without worrying the name changing.
UPDATE
How can I know if the device has been plugged?
Everytime you plug the usb in, dmesg will write logs for the event. Here is the example from my Ubuntu Desktop when I plug my 32GB Kingston USB.
....
[ 39.647394] scsi 4:0:0:0: Direct-Access Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[ 39.647950] sd 4:0:0:0: Attached scsi generic sg1 type 0
[ 41.108262] sd 4:0:0:0: [sdb] 60632064 512-byte logical blocks: (31.0 GB/28.9 GiB)
[ 41.108722] sd 4:0:0:0: [sdb] Write Protect is off
[ 41.108726] sd 4:0:0:0: [sdb] Mode Sense: 23 00 00 00
[ 41.109185] sd 4:0:0:0: [sdb] No Caching mode page found
[ 41.109190] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 41.114913] sdb: sdb1
[ 41.120164] sd 4:0:0:0: [sdb] Attached SCSI removable disk
And then the mount command (without root privilege) can give you the mount point in your filesystem. Eg:
/dev/sdb1 on /media/nuc/MULTIBOOT type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
Alternative, you can also read /proc/mounts to get the same report.
How can I automatically get all this information to my code?
It's your job. In C/C++, you can trigger the commands to the Shell, get the output string, analyzing it using key-words. The output report from Linux is pretty universal, which mean you expect it will be the same from time to time.
In linux you don't have (in general, it depends on the distribution you use) a fixed path to mount usb devices. Even you don't have them to be mounted automatically (this is something configured in your distribution, but not a general issue). So there's no general standard way to detect that some usb device has been plugged and mounted.
The procedure for mounting automatically usb devices comes from udevd(8) that is, the daemon in charge of detecting the kernel events about plugged devices into the several buses linux can have attached, receives a message telling some special device has been attached and installs the proper device driver to cope with it (normally, for a usb pendrive, this is a chain of device drivers, terminating in a script that creates the device inodes in /dev/... and mounts them if applicable). If you read that daemon documentation, you'll see how to install a shell script that will be executed as soon as you detect a new plugged device and it's ready to be mounted.
What is expected this shell script to do. Well, if you want to be conservative, you'll not overwrite each device plugged, if you don't detect something else, that allows you to identify the plugged device. This can be a special labeled partition or something like this, that allows you to recognise the device you want to overwrite or no. It can be something so simple as a magic name in the root directory of that device.
In order to be pragmatic and give you a solution that works without having to read long manual pages, something that should work is to scan periodically the mount table (you get it from /proc/mounts or reading the output of the mount(8) command) and detecting which entries have changed since the last time you executed them. If some entry has been added, just check (entries from mount(8) command have the format mount_device\tmount_directory\tmount_options\t... and you have to keep the mount_directory to check if some special named file is in there, and then proceed to copy there all the information you want.
To periodically check the mount table, you have to include in your crontab(7) file something like:
* * * * check_mounts.sh
and this shell script will be executed each minute to do this kind of work.
Something that can be also useful is to write a timestamp of when it was the last time you wrote information to the plugged device, so you can get information of what has changed since you last wrote to it (this can be the contents of that special file you use to check if this mount point is suitable to write the information you want to store there)
I installed VirtualBox and I want to install Devstack on ubuntu 14.10, this is just for test, So how much should I specify the RAM memory and Memory to use by the VM?
I have a windows 7 with 32 bits
Intel i3
RAM: 4 Go (2.64 Go usable)
27 Go space left on my disk
Thank you very much
If you are doing for testing, these are recommended settings for VM.
Processor - at least 2 cores
Memory - at least 8GB
Hard Drive - at least 60GB
and Use at least 1 GB of RAM but I would suggest to use 2GB RAM to perform well.
Reference: Setup DevStack
See to it that you provide 2 cores and a minimum of 2 GB RAM. Devstack really needs a lot of CPU and still with this 2GB it will crouch a lot.
But basic configurations can still be done with this minimal settings.
I try to start MINIX in VmWare, however, there it is stucked in "Started VFS:8 worker thread(s)"
I don't know why? does anyone have the problem?
Normal boot process continues with mounting /dev/c0d0p0s0..2
Q: Can't start?
A: Can. Follow the MINIX step-by-step scenario for VmWare hypervisors
http://wiki.minix3.org/UsersGuide/RunningOnVmware recommends for
Running on VMware
This page describes the process of installing MINIX 3 on VMWare.
1. Preliminaries
Please install VMWare. VMWare binaries can be downloaded from their webpage.
2. Virtual Machine Setup
Before you install Minix 3, you will need to create a new virtual machine configuration. The VM configuration specifies the parameters of your Virtual machine, e.g., how much memory you want the VM to use, how big you want the virtual hard disk to be, etc.
2.1. Create a Virtual Machine -- case: VMware Server
In the main menu of VMware, select New Virtual Machine.
Press Next in the Welcoming Screen.
At the Virtual machine configuration menu, we select Typical.
At the Select a Guest Operating System, select Other and Version Other.
For Virtual Machine Name, write Minix3 (anything would work).
At the Network Type screen, select Use bridged networking.
For Disk Capacity, enter something around 2GBs, although even smaller values would work. That is the size of the virtual partition where Minix will be installed. Tick the Allocate all disk space now.
Pressing Finish will create the Disk Image and the Virtual Machine that we will run.
2.2. Create a Virtual Machine -- case VMware Workstation and VMware Player (version > 3)
In the main menu of VMware, select New Virtual Machine.
At the Wizard, select Typical; and then, press Next.
For the Guest Operating System Installation, select I will install the operating system later; and then, press Next.
At the Select a Guest Operating System, select Other and Version Other.
For Virtual Machine Name, enter Minix3 or some other meaningful name.
At the Specify Disk Capacity, enter 2GBs, which is enough for all packages and sources. You can make it larger if you need to add more source files.
At the Ready to Create Virtual Machine, ensure that Power on this virtual machine after creation is not checked; and then, press Finish.
You will need to edit the memory settings according to your needs. In the Devices section, select the Memory, and adjust the memory accordingly. Note that, in order to run the X Window System on Minix, you need at least 384MB.
2.3. Create a Virtual Machine -- case: VMware Player (version < 3)
If you are using the free VMware Player, you do not have the ability to create new virtual machines. The simplest way around that is to use EasyVMX to create your new (empty) virtual machines.
Choose the Super Simple virtual machine creator at http://www.easyvmx.com/.
Name the machine whatever you want.
Operating System: Other OS (Note: choose the one that is NOT 64-bit).
Choose appropriate memory and storage sizes (e.g., 512 MB Memory and 2GB storage).
Don't worry about the LiveCD ISO, leave that blank (it will be dealt with, later).
Press Create Virtual Machine.
Download the compressed file, and unpack it. It should contain a directory with a bunch of VMware files.
Start VMware Player, choose Open an existing virtual machine, and select the .vmx file in the directory you just unpacked.
Once the virtual machine starts, go to the Devices Menu; and, in the CD/DVD item, choose Connect to Disk Image File (iso). Select the Minix3 ISO that you downloaded from the Minix 3 web-site.
If necessary, reset the machine with Ctrl+R; and, it will boot from the ISO.
2.4. Installation
Assuming you have downloaded and decompressed a MINIX 3 ISO image from the download page, you can mount the ISO file:
Select Minix3 in the Inventory List on the left.
In the Devices section, double-click on CD-ROM.
Select Use ISO Image.
Browse, and select the .iso Minix image that you downloaded earlier.
Then you can follow the normal installation instructions.
When the installation is over, type
shutdown
When you get the d0p0s0> prompt, enter off to shutdown the Virtual Machine.
I'm using a barebones tutorial as the basis for an OS I'm working on, and it seems to be an older tutorial: it has be compiling the kernel down to a floppy image, and then loading it with GRUB.
Basically, I still want to use GRUB, but I'd like to have my OS run from a CD instead. The main reason is that I don't actually have a real floppy drive available (I'm testing in VirtualBox currently) and I thus have no way to test my OS on real hardware.
I've been poking around on the net, and I can find lots of utilities that create a bootable CD from a floppy image, but these all seem to require an actual floppy drive, plus it's not really what I'm looking for. I'd like to be able to end up with a bootable CD during my make step ideally, without needing to first place the image on a floppy, which seems rather pointless.
I guess the easy way to answer this: How do I set up GRUB to read my kernel image from a CD? Will I need a special utility to do this from Windows? (The kernel can't compile itself yet, that's not for a looong while)
Thanks!
I found the solution for my project on my own, with some advice from the folks over at OSdev. There is a utility called mkisofs (which can run under Windows using a cygwin dll) that takes a directory, and makes that directory into an ISO image that can be burned to a CD. Using the -b flag, you can specify which file should reside in the boot sector of the disk.
The solution is just to have GRUB in the bootsector, and use GRUB to load the kernel image, which I can compile out in non-floppy form easily.
AFAIK a bootable CD is pretty much the same as a bootable floppy. You need to put the boot loader (GRUB) into the boot sector etc., the BIOS will take care of the low level stuff until you switch to protected mode.
You will probably have to make your image and then dd it to the actual physical disk.
Here's the El Torito Bootable CD specification:
http://www.phoenix.com/NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf
EDIT: An alternative way to test your kernel would be a bootable USB stick. Again, the BIOS will take care of the low level USB stuff until you turn on A20 and jump to protected mode.
If you're interested in looking at code, then the Moblin Image Creator is probably a good application to check out. It's written in python and can create different types of bootable images (CD, USB and NAND) for both Live and installable configurations of Moblin Linux.