edgecase_datafeed 78 2018-12-09 This is the date at the time of creation of this datafeed article. A checkpoint article containing a hash of this datafeed article may be created on this date or at a later date. 62 7 2018-10-01 bitcoin 8b53df721231f95e4e1843a74fd560fcfd6512d2e258ba1a2fc0472a8230b467 543904 33jEsi2kqFwMtagFqBuHuzCeYPVdDkR8zP 1DaAgMor4bZiAuLgZWdz4W5RkoYVQFvDKp
Recipe_for_manually_mounting_a_USB_flash_drive stjohn_piano 2018-12-09 yes Parts - Description - Notes - Recipe - Example Description This recipe describes a method of manually mounting a USB flash drive on a computer filesystem. Notes An earlier version of this recipe was published in the article article Storing_bitcoin_on_an_offline_Raspberry_Pi edgecase 75 Storing bitcoin on an offline Raspberry Pi , in the section Recipe For Manually Mounting A USB Memory Stick. The recipe shown here has been rewritten and retested for republication. This recipe was originally derived from work published in the article article How_I_bought_and_stored_some_bitcoin edgecase 3 How I bought and stored some bitcoin . Several points concerning filesystems and mounting: - A filesystem can be considered to be a tree. Directories are branches and may contain subdirectories (subbranches). Files are leaves on a branch. The filesystem tree begins at the root directory /. - Another filesystem (e.g. the one on a flash drive storage device), which is also a tree, can be attached to the existing filesystem on a computer. This allows tools on the computer to access data on the secondary filesystem as if it were simply a normal branch of the primary filesystem. The process of attachment, called "mounting", connects the root of the secondary filesystem to an existing directory (henceforth called the "mountpoint" directory) on the primary filesystem. One can refer to this as "mounting a device to a mountpoint directory". - The reverse process of detachment is called "unmounting". Once unmounted, a storage device can be physically unplugged without causing any problems. Recipe 0) Copy any data that you wish to transfer to the destination computer into a directory named "transfer", located on the top level of the flash drive filesystem. 1) If you are using a command-line interface on the destination computer, skip this step. If you are using a graphical user interface on the destination computer, open a terminal emulator program. 2) Use the following command to: Make a new directory to be the mountpoint for the flash drive. Making this new directory in the /mnt directory requires root permissions (the "root" user owns the /mnt directory), so "sudo" is used. sudo mkdir /mnt/mountpoint_directory 3) Insert the flash drive into a USB port on the destination computer. 4) Use the following command to: Mount the flash drive located at the device file /dev/sda1 to the directory /mnt/mountpoint_directory. sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/mountpoint_directory [ Note that: -o (lowercase letter "o", not the number zero) specifies that an option string follows. uid=pi,gid=pi specifies that the user ID is "pi" and the group ID is "pi" (note there are no spaces allowed between these two terms). /dev/sda1 is the first partition on the first USB flash drive that the computer has detected. [Future: Investigate whether this is accurate.] ] 5) Use the following command to: Make a new directory to hold a copy of the contents of the flash drive. mkdir flash_drive_contents 6) Use the following command to: Copy the contents of the the "transfer" directory on the flash drive to the directory "flash_drive_contents". cp -r /mnt/mountpoint_directory/transfer/* flash_drive_contents/ 7) Use the following command to: Copy a file named "work.log" from the current working directory to the flash drive. This demonstrates how to transfer information from the destination computer onto the flash drive. cp work.log /mnt/mountpoint_directory/ Note: The trailing slash after "mountpoint_directory" is a useful habit that prevents the accidental overwriting of a file. Without a trailing slash, if "mountpoint_directory" were actually a file (but you thought it was a directory), this command would overwrite it with the contents of work.log. With the trailing slash, an error is raised instead. 8) Use the following command to: Unmount the flash drive. Making changes to the /mnt directory requires root permissions, so "sudo" is used. Once unmounted, the flash drive can be physically unplugged without causing any problems. sudo umount /mnt/mountpoint_directory 9) Unplug the flash drive from the destination computer. Example The destination computer: A Raspberry Pi, Model B+ V1.2 [circa 2014]. It has various ports, including 4 USB ports (which allows simultaneous use of a mouse, a keyboard, and a flash drive) and an HDMI port. It does not have an onboard WiFi chip. I have various peripherals for the Raspberry Pi. These are: An 8GB micro SD card with an installed operating system, a Raspberry Pi power cable, a screen with a DVI port, a screen power cable, a DVI male-male connector cable, a DVI female to HDMI male converter, a USB keyboard, a USB mouse, and a plastic case customised for the Raspberry Pi Model B+. The installed operating system is Raspbian GNU/Linux 7 (wheezy) and the Linux kernel version is 4.1.13+. Tools: nano 2.2.6, tee 8.13, Python 2.7.3. USB flash drive: 8 GB, FAT32 format, name = "NO NAME" The FAT32 filesystem is very portable (i.e. supported by many operating systems). Step 0) Copy any data that you wish to transfer to the destination computer into a directory named "transfer". Using a work computer (a Macbook running Mac OS X 10.6.8 Snow Leopard), I have created a directory on the flash drive named "transfer". I have created two files in this directory. File 1 is named "test.txt" and contains the string "hello". File 2 is named "test2.txt" and contains the string "world". Extra Step) Boot and log into the Raspberry Pi. Insert the power cable into the Raspberry Pi. Wait for it to boot up. Log into the Raspberry Pi using the default credentials (username = "pi", password = "raspberry"). Note that the password is not printed to the screen. raspberrypi login: pi Password: Last login: Sun Mar 28 19:13:20 UTC 2016 on tty1 Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv61 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. pi@raspberrypi ~ $ Step 1) If you are using a command-line interface on the destination computer, skip this step. If you are using a graphical user interface on the destination computer, open a terminal emulator program. The Raspberry Pi booted into a command-line interface. Step 2) Make a new directory to be the mountpoint for the flash drive. [Make a new directory to be the mountpoint for the flash drive. Making this new directory in the /mnt directory requires root permissions (the "root" user owns the /mnt directory), so "sudo" is used.] pi@raspberrypi ~ $ sudo mkdir /mnt/mountpoint_directory [List items in the directory "/mnt"] pi@raspberrypi ~ $ ls -1 /mnt mountpoint_directory Step 3) Insert the flash drive into a USB port on the Raspberry Pi. Step 4) Mount the flash drive located at the device file /dev/sda1 to the directory /mnt/mountpoint_directory. [List items in the directory "/dev" that begin with "sda"] pi@raspberrypi ~ $ ls -1 /dev/sda* /dev/sda /dev/sda1 [Mount the flash drive located at the device file /dev/sda1 to the directory /mnt/mountpoint_directory] pi@raspberrypi ~ $ sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/mountpoint_directory [ Note that: -o (lowercase letter "o", not the number zero) specifies that an option string follows. uid=pi,gid=pi specifies that the user ID is "pi" and the group ID is "pi" (note there are no spaces allowed between these two terms). /dev/sda1 is the first partition on the first USB flash drive that the computer has detected. [Future: Investigate whether this is accurate.] ] [List the contents of the top directory in the flash drive filesystem] pi@raspberrypi ~ $ ls -1 /mnt/mountpoint_directory transfer [List the contents of the "transfer" directory in the flash drive filesystem] pi@raspberrypi ~ $ ls -1 /mnt/mountpoint_directory/transfer test2.txt test.txt Step 5) Make a new directory to hold a copy of the contents of the flash drive. [List the contents of the current working directory] pi@raspberrypi ~ $ ls -1 Desktop Documents Downloads indiecity python_games Scratch [Make a new directory to hold a copy of the contents of the flash drive] pi@raspberrypi ~ $ mkdir flash_drive_contents [List the contents of the current working directory] pi@raspberrypi ~ $ ls -1 Desktop Documents Downloads flash_drive_contents indiecity python_games Scratch Step 6) Copy the contents of the the "transfer" directory on the flash drive to the directory "flash_drive_contents". [Copy the contents of the the "transfer" directory on the flash drive to the directory "flash_drive_contents"] pi@raspberrypi ~ $ cp -r /mnt/mountpoint_directory/transfer/* flash_drive_contents/ [List the items in the flash_drive_contents directory] pi@raspberrypi ~ $ ls -1 flash_drive_contents test2.txt test.txt [Check the type of each item] pi@raspberrypi ~ $ file flash_drive_contents/test.txt flash_drive_contents/test.txt: ASCII text, with no line terminators pi@raspberrypi ~ $ file flash_drive_contents/test2.txt flash_drive_contents/test2.txt: ASCII text, with no line terminators [Print the contents of each item] pi@raspberrypi ~ $ cat flash_drive_contents/test.txt hello pi@raspberrypi ~ $ cat flash_drive_contents/test2.txt world [Note: The files test.txt and test2.txt lack final newline bytes, so the next command prompt starts immediately after the printed text ("hello" or "world"). Newlines have been added here in order to make this output easier to read.] Step 7) Copy a file named "work.log" from the current working directory to the flash drive. [Print the path of the current working directory (pwd = "print working directory")] pi@raspberrypi ~ $ pwd /home/pi [Create a file named "work.log"] pi@raspberrypi ~ $ touch work.log [Write "testing123" to work.log. Note: The echo command automatically adds a final newline byte.] pi@raspberrypi ~ $ echo "testing123" \> work.log [List the contents of the current working directory] pi@raspberrypi ~ $ ls -1 Desktop Documents Downloads flash_drive_contents indiecity python_games Scratch work.log [Copy work.log from the current working directory to the flash drive] pi@raspberrypi ~ $ cp work.log /mnt/mountpoint_directory/ [Note: The trailing slash after "mountpoint_directory" is a useful habit that prevents the accidental overwriting of a file. Without a trailing slash, if "mountpoint_directory" were actually a file (but you thought it was a directory), this command would overwrite it with the contents of work.log. With the trailing slash, an error is raised instead.] [List the contents of the top directory in the flash drive filesystem] pi@raspberrypi ~ $ ls -1 /mnt/mountpoint_directory transfer work.log [Print the contents of the resulting file on the flash drive] pi@raspberrypi ~ $ cat /mnt/mountpoint_directory/work.log testing123 Step 8) Unmount the flash drive. [Unmount the flash drive. Making changes to the /mnt directory requires root permissions, so "sudo" is used. Once unmounted, the flash drive can be physically unplugged without causing any problems.] pi@raspberrypi ~ $ sudo umount /mnt/mountpoint_directory [Confirm that the flash drive has been unmounted. This command should produce no output.] pi@raspberrypi ~ $ ls -1 /mnt/mountpoint_directory Step 9) Unplug the flash drive from the destination computer. Extra Step) Shut down the Raspberry Pi. pi@raspberrypi ~ $ sudo halt [a variety of output is printed, then the Raspberry Pi shuts down] Finally, unplug the power cable from the Raspberry Pi.
iQIcBAABCgAGBQJcDTALAAoJEC8RP+HmG9MXLsQQALdELjVIj/YNHjUEY95KAqsf 3Gl74264IkpAEn4aksg0+0BBMEknVdF7Mr3pdmmVRBJPdrLzcutXbm3xhKeHcyl+ IKF6088n0nlYYJSrzI/HXYJj1i6gyT0i2WGUc8yQwmaOnMZSVtWaxar8Iuz6j7Xj fop61TBbtCsI3zzcUj5pgfSqs15WBivdvwKM9vdEHDN1GJ9wBSMwhTczzcDoR4K5 u7n/K1QhugDOVe1VeziqZIISLbKnYh5HUtNUC863ogSFswvuqoPgF2AKrP3iEJiT OY0v3tiRfavtbH/dUtTgmteuMOvKIG8NIdPPuaxG3e/SyCxKW6XVTqzupJk2xB+Z /2P7GVs7BRYCXCwffuo4he9g6Dmae6FZughUKjBjDY+Ma1Joa0jhvswZwsS9BMXY lBd+zTi1D6lN1Sp+R3QJiwk46iebigQFUm2delCKfJ3eBupK0cZqNwIOHKiHhBAn 2+sKVGdaM194dl8ETwBJGDMwQIg1FhIvfGE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