Difference between revisions of "Linux"

From Leaky
Jump to: navigation, search
(Features)
(Added loopback mounting of disk images)
Line 33: Line 33:
  
 
cPanel sets it to 1048576 by default.
 
cPanel sets it to 1048576 by default.
 +
 +
== Mount .img in directory ==
 +
 +
To mount a disk image in a directory.
 +
 +
# losetup -v --show -f /path/to/disk.img
 +
/dev/loop0
 +
# mount -t ext3 /dev/loop0 /mnt
 +
 +
If disk.img is an image of the entire disk, not just a filesystem, you can specify
 +
 +
# fdisk -l /dev/loop0
 +
 +
Disk /dev/loop0: 4022 MB, 4022337024 bytes, 7856127 sectors
 +
Units = sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disk label type: dos
 +
Disk identifier: 0x00000000
 +
 +
      Device Boot      Start        End      Blocks  Id  System
 +
/dev/loop0p1              62    7849447    3924693  83  Linux
 +
 +
This gives the start byte count (62 * 512 = 31744) to use. Remove the original loopback device (-d)
 +
 +
# losetup -d /dev/loop0
 +
 +
Add the new loopback device but specify the offset into the file as 31744 bytes.
 +
 +
# losetup -v --show -f -o 31744 /path/to/disk.img
 +
/dev/loop0
 +
# mount -t ext3 /dev/loop0 /mnt

Revision as of 10:56, 21 June 2016

Distributions

Features

Common stuff

CentOS - max pids

To view the current maximum number

$ cat /proc/sys/kernel/pid_max
32768

To increase the maximum number of processes, you can use sysctl for a temporary or permanent change.

Temporarily update it (until next reboot):

# sysctl -w kernel.pid_max=1048576

or a permanent change:

# echo "kernel.pid_max = 1048576" >> /etc/sysctl.conf
# sysctl -p

cPanel sets it to 1048576 by default.

Mount .img in directory

To mount a disk image in a directory.

# losetup -v --show -f /path/to/disk.img
/dev/loop0
# mount -t ext3 /dev/loop0 /mnt

If disk.img is an image of the entire disk, not just a filesystem, you can specify

# fdisk -l /dev/loop0
Disk /dev/loop0: 4022 MB, 4022337024 bytes, 7856127 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1              62     7849447     3924693   83  Linux

This gives the start byte count (62 * 512 = 31744) to use. Remove the original loopback device (-d)

# losetup -d /dev/loop0

Add the new loopback device but specify the offset into the file as 31744 bytes.

# losetup -v --show -f -o 31744 /path/to/disk.img
/dev/loop0
# mount -t ext3 /dev/loop0 /mnt