Commands I forget (last update: 2016-12-04, created: 2012-10-03) back to the list ↑
Some console commands (Bash, cmd.exe, Linux-specific, Windows-specific, etc) I use infrequently, but still I need them from time to time, and I waste time to look them up. This note may grow over time.
Linux mount partition from imageStep 1. Find the partition offset (in sectors):
Step 2. Mount the partition (example for partition 2):
Other ways to do it:
1. Extract the partition using dd.
2. Use losetup and a normal mount later.
3. Use partprobe or partx on /dev/loopN to map partition devices - /dev/loopNpM (thx licho).
VirtualBox raw disk imageVirtualBox is unable to directly use raw disk images (as far as I know), but has a built-in raw-to-vdi converter:
It can also convert to other formats, like vmdk or vhd (--format vdi|vmdk|vhd) and has some other variant options (the default variant is "Standard" which is not raw+header, but a kind of sparse format afair).
And the other way around:
VirtualBox real USB device used in VM/guestNote: The VM/guest system can be running. I've tested this with Windows host and Linux guest.
1. [optional] On host, in case you don't won't to mount USB disk on host "by accident"*: run mountvol /N as admin to disable automatic volume mounting.
2. Plug in the device and run vboxmanage list usbhost. It should display a list of USB devices like this:
3. Find your device, note e.g. VendorId and ProductId.
4. Unplug your device.
5. Add a filter using the following command:
6. [optional] Run: mountvol /E as admin.
7. Plug in the device again. It should get detected by the VM.
* Windows FS drivers will "attach" to the volume anyway, you just won't get a letter assigned for it (it won't get mounted). This normally doesn't matter, unless you have a FS exploit on your pendrive that gets triggered on mount/unmount (yes, it did BSoD my host, grr).
Removing lots and lots of files on GNU/LinuxWell, rm * just won't do. Use find:
Deny execute in a directory on WindowsIO - Inherit Only (i.e. this does not apply to the container itself, only to it's children)
OI - Objects Inherit (i.e. this works on files, not on directories; this can be combined with CI which is Container Inherit)
X - eXecute obviously