Tag Archives: linux

Linux: Multiple ways to mount a partition in a disk image file

Hi,

there are several ways to mount a partition which is within a diskimage file created for example with dd.

The first and hard way  is to determine the offset of the partition start sector and mounting the disk by specifing the offset as parameter for the loop device.

You can use the  file or fdisk command to examine the file.
root@ubdev:/mnt/RaspberryPI # file 2012-07-15-wheezy-raspbian.img
2012-07-15-wheezy-raspbian.img: x86 boot sector; partition 1: ID=0xc, starthead 130, startsector 8192, 114688 sectors; partition 2: ID=0x83, starthead 165, startsector 122880, 3665920 sectors, code offset 0xb8

or

root@ubdev:/mnt/RaspberryPI # fdisk 2012-07-15-wheezy-raspbian.img

Command (m for help): p

Disk 2012-07-15-wheezy-raspbian.img: 1939 MB, 1939865600 bytes
255 heads, 63 sectors/track, 235 cylinders, total 3788800 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 identifier: 0x000714e9

Device Boot                               Start         End      Blocks   Id  System
2012-07-15-wheezy-raspbian.img1            8192      122879       57344    c  W95 FAT32 (LBA)
2012-07-15-wheezy-raspbian.img2          122880     3788799     1832960   83  Linux

For example the startsector of partition 2 is 122880,  this multiplied with the 512 bytes per sector is the byte offset of the partition. 122880*512=62914560.
Continue reading Linux: Multiple ways to mount a partition in a disk image file

Advertisment to support michlstechblog.info

Linux: Automount Windows or Samba shares

Hi,

today I will explain how to easy it is to automatically mount a windows share on linux.

The following packages are necessary: autofs, cifs/samba client tools

In this example I use a debian linux system.

root@dev # apt-get install autofs cifs-utils

edit the auto.master file with your favorite editor:

root@dev # vi /etc/auto.master

add the following line

/media/cifs /etc/auto.cifs --ghost

  • /media/cifs – is the root directory where the mount points are created (this is not the mount point itself!), the directory must exist.
  • /etc/auto.cifs – the definition file of the mount points
  • --ghost This option will create the mount point permanently, even the share isn’t mounted (there are doubledashes before ghost:-))

Create a new file /etc/auto.cifs and add your share definition. In this example the Windows computer is mediaserver with the share multimedia$ (Note: you have to quote the $ character in auto.cifs file or you got  cifs_mount failed w/return code = -6). The share should be mounted as user michl which has UID 1000 and GID 1000. Insert the following line to /etc/auto.cifs:

root@dev # touch /etc/auto.cifs

root@dev # vi /etc/auto.cifs
Continue reading Linux: Automount Windows or Samba shares

Linux: Switch a idle hard disk into standby mode

Hi,

I have running a debian based multimedia server. The operating systems is installed on a compact flash card (/dev/sda), the data resides on a external USB SATA harddisk (/dev/sdb).
The (Server 🙂 ) Hardware is a Fujitsu Futro A240 ThinClient, with a power consumption of only 7W. I’m using the server for about 2 hours each day, therefore I looked for a method to save power and switch the USB disk to standby mode when its idle for while.

Check first if your hard disk supports the standby mode.  Ensure that the disk is idle, otherwise the disk is immediately active again.

Switch to Standby mode

root@debdev:~# hdparm -y /dev/sdb
 Continue reading Linux: Switch a idle hard disk into standby mode 

Windows: Windows did not start. Howto write a new MBR and recover Windows OS Bootsector

Hi,

if you migrate a Windows Installation to another Computer or virtual environment such as VMWare ESXi or VMWare Workstation it could happen that the system won’t start.

A typical error when the master boot record or the boot sector of the boot partition needs to be updated or must be rewritten is when

  • After Postscreen of the BIOS the console shows “Operating system not found” this means there is no boot code in MBR
  • or it shows only a blinking cursor in the upper left edge. 2 possible reasons are thinkable
  1. MBR boot code is loaded but could not load the operation system => The boot sector of the Windows Boot partition needs to be updated
  2. The boot(active) flag of Windows boot partition  is missing

For all cases you can use the command line program “testdisk” which is part of the most linux live CDs/DVDs to correct this.
Continue reading Windows: Windows did not start. Howto write a new MBR and recover Windows OS Bootsector