Differences
This shows you the differences between two versions of the page.
tech:others:mounting_usb_drive_in_ubuntu [2018/08/26 06:28] |
tech:others:mounting_usb_drive_in_ubuntu [2018/08/26 06:28] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Steps followed for Ubuntu server ====== | ||
+ | ===== Simple Mount ===== | ||
+ | * One time creation of mount point | ||
+ | * <code>sudo mkdir /media/usb_drive1</code> | ||
+ | * Check device assignment using | ||
+ | * <code>fdisk -l</code> | ||
+ | * Typically you may get something like /dev/sdc1 as the new USB drive | ||
+ | * Assuming the USB drive is NTFS, Mount NTFS USB drive using the command: | ||
+ | * <code>ntfs-3g /dev/sdc1 /media/usb_drive1</code> | ||
+ | * Assuming the USB drive is FAT32: | ||
+ | * <code>mount -t vfat /dev/sdc1 /media/usb_drive1</code> | ||
+ | * Assuming the USB drive is ext4: | ||
+ | * <code>mount /dev/sdc1 /media/usb_drive1</code> | ||
+ | * To use drive | ||
+ | * <code>cd /media/usb_drive1</code> | ||
+ | * To remove (unmount) USB do an | ||
+ | * <code>eject /media/usb_drive1</code> | ||
+ | * or | ||
+ | * <code>eject /dev/sdc1</code> | ||
+ | |||
+ | ===== Permanently mount the USB drive ===== | ||
+ | * Use gparted (GUI) | ||
+ | * To [[http://www.unixmen.com/how-to-format-usb-properly-in-linux/|format]] new USB drive as ext4 | ||
+ | * Label the drive | ||
+ | * Create a mount location | ||
+ | * <code>mkdir /media/usb_drive1</code> | ||
+ | * Confirm Block Device assignment | ||
+ | * <code>fdisk -l</code> | ||
+ | * In this example the drive is sdc1 | ||
+ | * Mount | ||
+ | * <code>mount /dev/sdc1 /media/usb_drive1</code> | ||
+ | * Change Onweership as required (from root to someone else who needs to access, such as backuppc) | ||
+ | * <code>chown -R someuser:someuser /media/usb_drive1</code> | ||
+ | * chmod as required as well | ||
+ | * <code>e.g. chmod 700 /media/usb_drive1/backuppc123/</code> | ||
+ | * check drive | ||
+ | * <code>ls -l /media/usb_drive1</code> | ||
+ | * Issue command to get the UUID of the USB drive | ||
+ | * <code>blkid </code> | ||
+ | * Make [[https://wiki.archlinux.org/index.php/fstab|fstab]] entry as | ||
+ | * <code>UUID=c7b5556e-f814-40fa-a97d-2ac3b78626d6 /media/usb_drive1 ext4 defaults 0 2</code> | ||
+ | * Reboot to make sure the drive auto mounts | ||
+ | |||
+ | ===== Format USB drive ===== | ||
+ | * To format with a cluster size of 32768 | ||
+ | * Use the ''-f, --fast, -Q, --quick'' to avoid zeroing out sectors which can take several hours | ||
+ | * <code bash>mkntfs -c 32768 /dev/sdc1</code> | ||
+ | * Change disk type to NTFS with fdisk | ||
+ | * <code bash>fdisk /dev/sdc</code> | ||
+ | * In fdisk, enter: t - //type//, 1 - //first partition//, 7 - //ntfs//, w - //write to disk// | ||
+ | * Verify | ||
+ | * <code bash>fdisk -l /dev/sdc</code> | ||
+ | |||
+ | ===== References ===== | ||
+ | [[https://help.ubuntu.com/community/Mount/USB]] | ||
+ | |||
+ | ===== Other Info ===== | ||
+ | Use command dmesg to check log on usb drive insertion | ||
+ | |||
+ | lsusb to list usb devices | ||
+ | |||