Sunday 4 March 2012

Some useful tips in linux

# mount -t iso9660 -o loop file.iso /mnt  # Mount a CD image

# mount -t ext3 -o loop file.img /mnt   # Mount an image with ext3 fs

# mount -o loop file.iso /mnt # extract an iso image to mnt

Remount a device without unmounting it.
# mount -o remount,ro /

Copy the raw data from a cdrom into an iso image: 
# dd if=/dev/cd0c of=file.iso

Convert a Nero .nrg file to .iso
   Nero simply adds a 300Kb header to a normal iso image. This can be trimmed with dd
# dd bs=1k if=imagefile.nrg of=imagefile.iso skip=300

Create a memory file system
  A memory based file system is very fast for heavy IO application. How to create a 64 MB partition mounted on /memdisk:

# mount -t tmpfs -osize=64m tmpfs /memdisk

Create a file based Image
  For example a partition of 1GB using the file /usr/vdisk.img. Here we use the vnode 0, but it could also be 1.

 The file based image can be automatically mounted during boot with an entry in /etc/rc.conf and /etc/fstab.

# dd if=/dev/zero of=/usr/vdisk.img bs=1024k count=1024

# mkfs.ext3 /usr/vdisk.img

# mount -o loop /usr/vdisk.img /mnt

# umount /mnt; rm /usr/vdisk.img    # Cleanup






No comments:

Post a Comment