Difference between revisions of "Disk mounting"

From Noah.org
Jump to navigationJump to search
Line 2: Line 2:
 
[[Category:Disks_and_Filesystems]]
 
[[Category:Disks_and_Filesystems]]
  
== Examples ==
+
== fdisk ==
  
Say you just plugged in a new storage device (IDE disk drive or USB flash or whatever) and now you need to know the device name so you can mount it. This will list all the disks that Linux sees:
+
This will list all the disks that Linux sees, including any hot swapped drives that may have just been plugged in:
  
 
<pre>
 
<pre>
 
fdisk -l
 
fdisk -l
 +
</pre>
 +
 +
== mount individual partitions in a whole disk image ==
 +
 +
If you have a while disk image and you want to mount partitions inside that image then use `losetup` to create a loopback device for the image.
 +
 +
For example, if you copied an entire disk using `[[Dd_-_Destroyer_of_Disks|dd]]` like this:
 +
 +
<pre>
 +
dd if=/dev/sda of=disk.img bs=32768
 +
</pre>
 +
 +
You can later create a loopback device for it and see its partitions with `fdisk` and mount those partitions individually with `mount`.
 +
 +
<pre>
 +
losetup /dev/loop0 disk.img
 +
fdisk -l /dev/loop0
 
</pre>
 
</pre>

Revision as of 15:58, 12 February 2009


fdisk

This will list all the disks that Linux sees, including any hot swapped drives that may have just been plugged in:

fdisk -l

mount individual partitions in a whole disk image

If you have a while disk image and you want to mount partitions inside that image then use `losetup` to create a loopback device for the image.

For example, if you copied an entire disk using `dd` like this:

dd if=/dev/sda of=disk.img bs=32768

You can later create a loopback device for it and see its partitions with `fdisk` and mount those partitions individually with `mount`.

losetup /dev/loop0 disk.img
fdisk -l /dev/loop0