Pages sometimes need to ask the user to specify the filename for a physical device, e.g. to reformat that device. Getting this wrong can corrupt the user's hard disk, so this page provides a fairly safe procedure to select the disk.

To include the complete instructions in your page, add this:

<<Include(ChooseADevice,,from="^##TAG:START$",to="^##TAG:END$")>>

You may also want to change the examples on the page to use $TARGET_DEVICE instead of e.g. /dev/sdb.

If you only want to include part of the template (e.g. just the body without the header and footer paragraphs), view the raw text of this page and change the TAGs to whatever you like.

Text to include

Typing the wrong device name can destroy all information on your hard disk, so follow these instructions to select the right device name:

# Make sure your device is disconnected or turned off, then do:
ls /dev/disk/by-id/* | grep -v -- '-part[0-9]*$' | tee /tmp/disks.txt

# Make sure your device is connected and powered up, then do:
ls /dev/disk/by-id/* | grep -v -- '-part[0-9]*$' | diff /tmp/disks.txt -
# You should see something like:
# 10a11
# > /dev/disk/by-id/<identifier-of-your-disk>

# Make a variable with the device from the previous command:
TARGET_DEVICE=/dev/disk/by-id/<identifier-of-your-disk>

# Check you typed it correctly by reading one byte from the disk:
sudo head -c1 "$TARGET_DEVICE" > /dev/null
# Disconnect your device, then try again:
sudo head -c1 "$TARGET_DEVICE" > /dev/null

If you did everything right, the head command should only work when the device is plugged in. You can now use $TARGET_DEVICE instead of the name of your device in future commands.

The instructions below often refer to $TARGET_DEVICE. If you create a variable as described above, you can paste those exact instructions. Otherwise, change $TARGET_DEVICE to your actual device name.

The following pages include the string ChooseADevice: