/home/pi/System maintenance/Dell64 mount USB hard drive from command line.txt df -h list mounted drives fdisk -l list all drives https://www.techwalla.com/articles/how-to-mount-a-usb-hard-drive-in-linux How to Mount a USB Hard Drive in Linux By Silvania Cochrine Before you can use a USB hard drive in the Linux operating system (such as Ubuntu, Kubuntu, Fedora or Linux Mint) you must first "mount" the drive. This is a process where you associate the drive with a folder on the computer so that the operating system can recognize the drive and allow you to write files to and from the folder that it is associated with. Step 1 Log in to your operating system and open a terminal shell from the desktop "Terminal" shortcut. Step 2 Type "fdisk -l" to see a list of drives on your computer and to get the name of the USB hard drive (this name is usually "/dev/sdb1" or similar). >> /dev/sdb1 Step 3 Create a folder to associate with your USB hard drive by typing "mkdir /mnt/usbdrive" and pressing "Enter." >> Howell : $ mkdir /media/bill/usbdrive Step 4 Type "mount -t /dev/sdb1 /mnt/usbdrive" and press "Enter" to mount your USB hard drive to the folder you created. >> Howell : $ mount -t /dev/sdb1 /media/bill/usbdrive mount: can't find /media/bill/usbdrive in /etc/fstab >> This doesn't work!! +-----+ https://community.linuxmint.com/tutorial/view/1513 Editing fstab to automount partitions at startup Written by: jahid_0903014, Created: 3 years ago. but now i am going to show you a staright forward process of automonting partitions by editing /etc/fstab file. this tutorial is not solely for automounting but how to edit fstab efficiently and gaining some knowledge about it. steps: 1. sudo gedit /etc/fstab 2. now the fstab file is open in gedit. you need to add an entry for the partition to automount it at startup. the format of a new entry is like this: file_system mount_point type options dump pass you will see this in the file and you need to add your new entry under this line. brief explanation of the above format: 1.file_system = your device id. use this: /dev/sdax ( you should check it with sudo fdisk -l) it may be /dev/sdbx or /dev/sdcx if you have more than one disks connected. 2. mount_point =where you want to mount your partition. use this: /media/user/label here user is your user name, label is "software", "movies" or whatever label your partiton have. 3. type=fat32,ntfs, ntfs-3g,ext2,ext4 or whatever your partition type is. 4. options =mount options for the partition(explained later). 5. dump=Enable or disable backing up of the device/partition .usually set to 0, which disables it. 6. pass =Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be 2, or 0 to disable checking. so for auto mounting case the above format reduces to: /dev/sdax /media/user/label type options 0 0 (you can check the type with sudo fdisk -l) the options field: sync/async - All I/O to the file system should be done synchronously/asynchronously. auto/noauto - The filesystem will be mounted automatically at startup/The filesystem will NOT be automatically mounted at startup. dev/nodev - Interpret/Do not interpret character or block special devices on the file system. exec / noexec - Permit/Prevent the execution of binaries from the filesystem. suid/nosuid - Permit/Block the operation of suid, and sgid bits. ro/rw - Mount read-only/Mount read-write. user/nouser - Permit any user to mount the filesystem. (This automatically implies noexec, nosuid,nodev unless overridden) / Only permit root to mount the filesystem. This is also a default setting. defaults - Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async. _netdev - this is a network device, mount it after bringing up the network. Only valid with fstype nfs. now the final format reduces to (for auto mount): /dev/sdax /media/user/label type defaults 0 0 for ntfs /dev/sdax /media/user/label ntfs defaults 0 0 for ext4 /dev/sdax /media/user/label ext4 defaults 0 0 etc..... you can change defaults by your own configuration, like /dev/sdax /media/user/label ext4 rw,suid,dev,noexec,auto,user,async 0 0 you need to add entry for each partiton you want to auto mount. 3. save and exit the file then restart and see the result. for more information visit the links below: +--+ same URL as above : Comments 1 year ago, renardesque As said in the fstab file, you can use "UUID= as a more robust way to name devices, that works even if disks are added and removed." Now to get that UUID it's very easy : -get your device's name (e.g. /dev/sda2) with the disk utility gui, or with sudo fdisk -l, or with gparted - use this name to get the UUID : sudo blkid /dev/sdax (your device's name) Then add the entry to fstab replacing "/dev/sdax" by "UUID=[your device's UUID]". >> Howell : $ sudo blkid /dev/sdb1 /dev/sdb1: LABEL="ADATA CH11" UUID="1507-3151" TYPE="vfat" PARTUUID="d374fef1-01" >> My addition to /etc/fstab UUID="1507-3151" "/media/bill/ADATA CH11" fat32 defaults 0 0 >> OK, reboot without USB plugged in (or system hangs) # mkdir "/media/bill/ADATA CH11" # mount -v /dev/sdb1 "/media/bill/ADATA CH11" # mkdir "/media/bill/ADATA CH11/Dell64 full home 170409" Backup of /home/bill : # cp -r /home/bill "/media/bill/ADATA CH11/Dell64 full home 170409" ***************************** 10Apr2017 09:14 Lexar USB memory mount # fdisk -l /dev/sdb1: Type Fat32 # mkdir "/media/bill/ADATA CH11" # blkid /dev/sdb1 /dev/sdb1: LABEL="Lexar" UUID="7260-5B07" Type="vfat" PartUUID="c3072e18-01" https://community.linuxmint.com/tutorial/view/1513 Editing fstab to automount partitions at startup Written by: jahid_0903014 # cat /env/fstab # echo >>/etc/fstab "7260-5B07 /media/bill/Lexar vfat defaults 0 0" Oops, I must remove "garbage entries" # cp /etc/fstab /etc/fstab_messed # cat /etc/fstab_messed | grep --invert-match 7260-5B07 | grep >/etc/fstab --invert-match /dev/sdb1 # echo >>/etc/fstab "UUID=7260-5B07 /media/bill/Lexar vfat defaults 0 0" Oops again - screwed up echo >/etc/fstab "UUID=ceaf6811-fad6-4f4f-9d2c-ed5331f885b6 / ext4 rw,errors=remount-ro 0 1" echo >>/etc/fstab 'UUID=1507-3151 "/media/bill/ADATA CH11" fat32 defaults 0 0' echo >>/etc/fstab "UUID=7260-5B07 /media/bill/Lexar vfat defaults 0 0" # mount -t vfat UUID=7260-5B07 /media/bill/Lexar [ 6487.805563] FAT-fs (sdb1): utf8 is ot a recommended IO charset for FAT filesystems, filesystem will be case sensitive! [ 6487.816456] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. >> Howell - "-N" runs without making repairs # fsck -N /dev/sdb1 fsck from util-linux 2.25.2 fsck: /etc/fstab: parse error at line 3 -- ignore [/sbin/fsck.vat (1) -- /media/bill/Lexar] fsck.vfat /dev/sdb1 >> What does that mean? http://www.linuxquestions.org/questions/linux-software-2/fsck-dies-with-error-code-1-a-550571/ GrapefruiTgirl, Registered: Dec 2006 http://www.go2linux.org/node/108 UPDATE: According to this link and several others, when fsck exits with an error 1, it means filesystem errors were corrected. In other words, if this is the case, it's nothing to worry about. However, if you are constantly needing to fsck on many reboots, something else is in need of attention. >> My code (1) doesn't seem to be like this. Anyways, just ignore for now (Hah!) # enddoc