Skip to main content

Mounting Disk Image in Linux

How to mount ".img" file with multiple partitions; 


1. First, check partition table of the image by using fdisk;


[root@Linux]# ls Ubuntu.img
hive.img


[root@Linux]# fdisk -l Ubuntu.img

Disk hive.img: 7549 MB, 7549747200 bytes, 14745600 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: 0x244b7fbe

   Device Boot      Start         End      Blocks   Id  System
Ubuntu.img1            2048       43007       20480    e  W95 FAT16 (LBA)
Ubuntu.img2   *       43008    14690303     7323648   83  Linux

2. Now we need to mount hive.img2 means the second partition of the disk image;


Now offset of hive.img2 is "Start Sector" X "Block Size"
mount -o loop,offset=$((43008*512)) Ubuntu.img /mnt


[root@Linux]# df -hP /mnt

Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      6.8G  4.3G  2.1G  68% /mnt

Note: If offset is not specified, mount fails to identify the filesystem automatically as below;


[root@Linux]# mount -o loop Ubuntu.img /mnt
mount: /dev/loop0 is write-protected, mounting read-only
mount: unknown filesystem type '(null)'





Search Engine Indexing:
. mounting image file in Linux
. Crypto Currency mining 
mount: unknown filesystem type '(null)'
. image file mounting in Linux

Comments

Popular posts from this blog

Nvidia GPU Overclocking OC In Linux

Note: Optimizing GPU to its peak means getting maximum out of it and stressing it more. According to me, OC will reduce the life of the GPU. Hence please tune the GPU with some benchmarking tool. Double check GPU temperature. I am keeping the power to as low as possible especially for 1060 which actually give you good hasrate. Enable GPU tuning using nvidia-settings utility sudo nvidia-xconfig -a --allow-empty-initial-configuration --cool-bits=28 --enable-all-gpus For headless systems, you should configure xorg with dummy configuration sudo nvidia-xconfig -a --force-generate --allow-empty-initial-configuration --cool-bits=28 --no-sli --connected-monitor="DFP-0" Tuning Power Consumption for 1070/1060/1050ti GTX 1070 (Expected Hash rate for ETH ~30 MH/s): nvidia-smi -pm 1 nvidia-smi -pl 110 GTX 1060 (Expected Hash rate for ETH ~22 MH/s): nvidia-smi -pm 1 nvidia-smi -pl 90 GTX 1050 Ti (Expected Hash rate for ETH ~

Useful Nvidia Commands

Query GPU name, GPU Bus ID, BIOS Version nvidia-smi --query-gpu=gpu_name,gpu_bus_id,vbios_version --format=csv Query GPU metrics useful for automation nvidia-smi --query-gpu=timestamp,name,pci.bus_id,driver_version,pstate,pcie.link.gen.max, pcie.link.gen.current,temperature.gpu,utilization.gpu,utilization.memory, memory.total,memory.free,memory.used --format=csv -l 5 Enable Persistence Mode nvidia-smi -pm 1 Supported Clock nvidia-smi -ac Set One Of the Supported clocks nvidia-smi –q –d SUPPORTED_CLOCKS Query Current Clock Settings nvidia-smi -q –d CLOCK Query Current Clock Settings nvidia-smi -q –d CLOCK Reset Clock To Base nvidia-smi --rac Set Power Cap. Maximum wattage the GPU will use nvidia-smi –pl N The command that provides continuous monitoring of detail stats such as power nvidia-smi stats -i -d pwrDraw nvidia-smi --query-gpu=index,timestamp,power.draw,clocks.sm,clocks.mem