Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Function to display help message
show_help() {
echo "Usage: $0 [OPTION]... [FILE]"
echo "Set up and mount loop devices for a given file, create new files of specified or random size and mount them, or create a ramdisk of specified size and mount it."
echo ""
echo " --help display this help and exit"
echo " automount <Size> automatically create a file of specified size, set up and mount it."
echo " polymount <Size> <N> create N files of specified size, set up and mount them."
@Knogle
Knogle / mount-loop.sh
Last active April 10, 2024 22:36
EXPLAIN: This Bash script provides functionality to set up and mount loop devices in Linux. It supports creating loop devices for existing files or generating new files with specified or random sizes to be used as loop devices.
#!/bin/bash
# Function to display help message
show_help() {
echo "Usage: $0 [OPTION]... [FILE]"
echo "Set up and mount loop devices for a given file, create new files of specified or random size and mount them, or create a ramdisk of specified size and mount it."
echo ""
echo " --help display this help and exit"
echo " automount <Size> automatically create a file of specified size, set up and mount it."
echo " polymount <Size> <N> create N files of specified size, set up and mount them."
#!/bin/bash
# Function to display help message
show_help() {
echo "Usage: $0 [OPTION]... [FILE]"
echo "Set up and mount a loop device for a given file, or create a new file of specified size and mount it."
echo ""
echo " --help display this help and exit"
echo " automount automatically create multiple files of random sizes between 2G and 10G, set up and mount them"
echo " <FilePath> path to the existing file to set up and mount"
@Knogle
Knogle / mount-loop.sh
Created March 12, 2024 21:23
Optimized for creating of multiple Loop-Devices
#!/bin/bash
# Function to display help message
show_help() {
echo "Usage: $0 [OPTION]... [ARGUMENTS]..."
echo "Set up and mount a loop device for a given file, create a new file of specified size and mount it, or create multiple loop devices of specified size."
echo ""
echo " --help display this help and exit"
echo " automount <Size> automatically create a file of specified size, set up and mount it"
echo " multimount <Size> <Number> create multiple files of specified size and set them up as loop devices"
@Knogle
Knogle / mount-loop.sh
Last active March 12, 2024 19:35
Mount Loop devices. sudo ./mount-loop.sh /path/to/your/file.img
#!/bin/bash
# Function to display help message
show_help() {
echo "Usage: $0 [OPTION]... [FILE]"
echo "Set up and mount a loop device for a given file, or create a new file of specified size and mount it."
echo ""
echo " --help display this help and exit"
echo " automount <Size> automatically create a file of specified size, set up and mount it"
echo " <FilePath> path to the existing file to set up and mount"