How to mount a LVM partition within a LVM volume? [closed] - lvm

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have built a VG named cinder-volumes. Within this VG, I created a PV named leader-volume. Then I mounted this PV as the root filesystem of a KVM Ubuntu installation. During the installation process, I selected LVM partition.
At last, I created a snapshot for the PV leader-volume.
Now I want to read some files within my Ubuntu installation... What shall I do?

Take a look at kpartx - it's especially useful for managing VMs where entire file systems are often packed into single volumes.
kpartx can create device nodes for partitions nested on a block device or disk image.
Mount (one of the following):
kpartx -av your_vm_disk.img
kpartx -av /dev/mapper/your_device
Where your_device could be an LVM partition. The -v option causes kpartx to display the devices it creates for nested partitions.
Mount the appropriate /dev/mapper/loopXpX:
mount /dev/mapper/loop0p1 /mnt
Unmount (after unmounting loop devices):
umount -d /dev/mapper/loop0
umount -d diskimage.img
Remove the device mappings:
kpartx -dv your_vm_disk.img
kpartx -dv /dev/mapper/your_device

Related

Permanently delete running / stopped / un-used containers using command? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
In case multiple containers are running then deleting one by one is time wasting
docker container stop $(docker container ls –aq) && docker system prune –af ––volumes
The above command tells Docker to stop the containers listed in the parentheses.
Inside the parentheses, you tell Docker to generate a list of all the containers, and then the information is passed back to the container stop command and stops all the containers.
The && attribute tells Docker to remove all stopped containers and volumes.
–af means this should apply to all containers (a) without a required confirmation (f).
Docker cli command :
docker rm -f $(docker ps -qa)
or
docker system prune
Create an Alias to do so every time
vi .bash_profile
alias dockererase='docker rm -f $(docker ps -qa)'
source ~/.bash_profile

Is there any way to move the docker running target disk to a specific disk [duplicate]

This question already has answers here:
Docker changing /var/lib/docker/aufs/diff location
(2 answers)
Closed 3 years ago.
I'm setting up my own project on a server using docker. OS have installed on the hard-disk and docker too and because of that i get into problem to use disk. I read/write with a high speed on the disk so hard disk can't provide what i need. I plugged SSD to my server and moved the swap and ramdisk location to the SSD device.
Docker: latest
CentOS: 7
Now i need to run docker on the SSD device, not on hard-disk.
Is there any way to change move it to the SSD device to increase the read/write speed?
First stop the docker service.
Option 1:
Change /etc/docker/daemon.json according to the official page: https://docs.docker.com/config/daemon/systemd/#custom-docker-daemon-options
You would add something like:
{
"data-root": "/your/new/path",
"storage-driver": "overlay"
}
Option 2:
You need to locate the file /lib/systemd/system/docker.service and open it for edit.
You need to change the line ExecStart=/usr/bin/dockerd -H unix:// into:
ExecStart=/usr/bin/dockerd -g /your/new/path -H unix://
Common for both options:
Copy your files into the new location:
rsync -aqxP /var/lib/docker/ /your/new/path/

Failed to write all bytes for _bisect.so [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I was restoring a MongoDB environment, then it failed for no space in disk.
After that I cannot execute any docker-compose command, in each attempt this error message is displayed:
Failed to write all bytes for _bisect.so
I found some references about to free space in /tmp, although I want to be sure that was the best alternative of solution.
Remove the docker images:
docker rmi $(docker images -f dangling=true -q)
UPDATE:
you can now use prune
docker system prune -af
https://docs.docker.com/engine/reference/commandline/system_prune/
check df
normally you will find 100% for /var/lib/docker and 100% for/
try to free some space, may be stop syslog service.
Then remove and restart your containers
recheck df
now /var/lib/docker should be around 15%
During a docker-compose command, I got a similar error ("Failed to write all bytes for _ctypes.pyd") because my drive had no space left on it.

Docker - free up space after removing all images & containers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have deleted all the images/containers
ubuntu#ubuntu:/var/lib/docker$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu#ubuntu:/var/lib/docker$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
but I notice that there are still about 15GB inside /var/lib/docker
ubuntu#ubuntu:/var/lib/docker$ sudo du --max-depth=1 -h .
12G ./volumes
104K ./aufs
4,0K ./containers
1,3M ./image
4,0K ./trust
4,0K ./swarm
2,6G ./tmp
108K ./network
15G .
Questions:
How can I free up this space?
Is it safe to remove things inside /var/lib/docker?
Try (from docker 1.13):
docker system df
it shows you size of:
Images
Containers
Local Volumes
and remove local volumes using:
docker volume prune
For older Dockers try:
docker volume rm $(docker volume ls -q)
For my current docker version (1.12.1 for both Client & Server) a way to delete all volumes is by using:
docker volume rm $(docker volume ls -q)
but the following is safer: (thanks Matt for your comment)
$(docker volume ls -qf dangling=true)
Also from version: 1.13.0 (2017-01-18) some commands were added:
$ docker system prune
$ docker container prune
$ docker image prune
$ docker volume prune
$ docker network prune
Changelog: Add new docker system command with df and prune subcommands for system resource management, as well as docker {container,image,volume,network} prune subcommands #26108 #27525 / #27525
Most of the space is occupied by docker volume as you can see from your output:
12G ./volumes
Docker volumes are used to persist data for docker container and to share data between containers, and they are independent of the container’s lifecycle. So removing image/container will not free the disk space they occupied. Please refer to their official docs for more details.
If you're using latest version of docker, you can find volume related commands docs for more details(list/remove/create volumes e.g), for older version of docker, you can refer to this script on github for how to clean up volumes.
Hope this could be helpful:-)

Does docker-machine can only mount /c/Users on windows? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
But I want to mount /d because I like to put my projects on /d.
docker-machine uses a boot2docker.iso VM image, based on TinyCore
The original boot2docker project mentioned that you can mount other folders with, at runtime:
mount -t vboxsf -o uid=1000,gid=50 your-other-share-name /some/mount/location
Issue 1814 of docker-machine suggests that, and it seems to work.

Resources