LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices


Reply
  Search this Thread
Old 11-18-2018, 01:37 PM   #1
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Rep: Reputation: 21
Copy from USB HDD to home


Command line to copy from USB HDD to home? home is on sda1. I want to copy contents of home on sdb1. sda1 has mint 19 V2 Cinnamon on it. sdb1 has mint 18.0 Cinnamon on it. Both have a home partition. Would it be better to drag and drop, I tried drag and drop of one file and that worked.
 
Old 11-18-2018, 01:43 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
so worked. In that case what is the problem?
 
Old 11-18-2018, 01:45 PM   #3
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
How do I do that from the command line?
 
Old 11-18-2018, 01:48 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Hm. You wrote: Would it be better to drag and drop
there is a command: cp. It has two arguments: cp from to
If you wish to copy more than one file you may need to use -r. see man page or examples on the net.
 
Old 11-18-2018, 02:09 PM   #5
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
$ cp /sdb1/home/tom/testfile sda1/home/tom
cp: cannot stat '/sdb1/home/tom/testfile': No such file or directory

I can drag and drop testfile.
 
Old 11-18-2018, 02:16 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
could you check exactly what was dragged? (I'm sure it had a different location/name, probably /home/tom/testfile, without /sdb1). Without seeing what did you really make hard to give better answer.
By the way, do you know the command mount?
 
Old 11-18-2018, 02:45 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I would assume the USB drive is automatically mounted under /media something. As stated the users home on the system that is running /home/tom
 
Old 11-18-2018, 02:49 PM   #8
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by pan64 View Post
could you check exactly what was dragged? (I'm sure it had a different location/name, probably /home/tom/testfile, without /sdb1)
/media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/tom

Quote:
Originally Posted by pan64 View Post
Without seeing what did you really make hard to give better answer.

Quote:
Originally Posted by pan64 View Post
By the way, do you know the command mount?
Only a little.

I also tried cp /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/testfile sda1/home/tom/
cp: cannot stat '/media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/testfile': No such file or directory
 
Old 11-18-2018, 03:08 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Without knowing how your mint 18 was partitioned I can't say the exact path to your home directory nor if the file system where it is located is actually mounted. Post the output of the lsblk command.
Post the output of the command
sudo fdisk -l (that is a small L)
 
Old 11-18-2018, 03:15 PM   #10
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 28G 0 part /
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 3.7G 0 part [SWAP]
└─sda6 8:6 0 899.8G 0 part /home
sdb 8:16 0 698.7G 0 disk
├─sdb1 8:17 0 1K 0 part
├─sdb5 8:21 0 28G 0 part /media/tom/a10e215d-00f5-4218-956b-ecc8ed6fba1f
├─sdb6 8:22 0 3.7G 0 part
└─sdb7 8:23 0 666.8G 0 part /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6
sr0 11:0 1 1024M 0 rom


sudo fdisk -l
[sudo] password for tom:
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xe3a7dfc5

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 58593844 58591797 28G 83 Linux
/dev/sda2 58595326 1953330322 1894734997 903.5G 5 Extended
/dev/sda5 58595328 66406399 7811072 3.7G 82 Linux swap / Solaris
/dev/sda6 66408448 1953330322 1886921875 899.8G 83 Linux

Partition 2 does not start on physical sector boundary.


Disk /dev/sdb: 698.7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000a79b4

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2046 1464844287 1464842242 698.5G 5 Extended
/dev/sdb5 2048 58593844 58591797 28G 83 Linux
/dev/sdb6 58595328 66406399 7811072 3.7G 82 Linux swap / Solaris
/dev/sdb7 66408448 1464844287 1398435840 666.8G 83 Linux
 
Old 11-18-2018, 04:23 PM   #11
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 28G 0 part /
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 3.7G 0 part [SWAP]
└─sda6 8:6 0 899.8G 0 part /home
sdb 8:16 0 698.7G 0 disk
├─sdb1 8:17 0 1K 0 part
├─sdb5 8:21 0 28G 0 part /media/tom/a10e215d-00f5-4218-956b-ecc8ed6fba1f
├─sdb6 8:22 0 3.7G 0 part
└─sdb7 8:23 0 666.8G 0 part /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6
sr0 11:0 1 1024M 0 rom


sudo fdisk -l
[sudo] password for tom:
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xe3a7dfc5

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 58593844 58591797 28G 83 Linux
/dev/sda2 58595326 1953330322 1894734997 903.5G 5 Extended
/dev/sda5 58595328 66406399 7811072 3.7G 82 Linux swap / Solaris
/dev/sda6 66408448 1953330322 1886921875 899.8G 83 Linux

Partition 2 does not start on physical sector boundary.


Disk /dev/sdb: 698.7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000a79b4

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2046 1464844287 1464842242 698.5G 5 Extended
/dev/sdb5 2048 58593844 58591797 28G 83 Linux
/dev/sdb6 58595328 66406399 7811072 3.7G 82 Linux swap / Solaris
/dev/sdb7 66408448 1464844287 1398435840 666.8G 83 Linux
 
Old 11-18-2018, 04:36 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
You posted that /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/tom was the correct directory in #8 and the posted output appears to confirm but you did not use the same path in your copy command. You can always use the cd command to go that directory and use the ls command to view its contents.

Quote:
cp /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/tom/testfile /home/tom/
 
Old 11-18-2018, 05:07 PM   #13
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
cp /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/tom/testfile /home/tom/ - That worked. I want to copy the contents of home on sdb1 to sda1. I could copy the folder and it's contents to home on sda1. I think that would get me a home inside of home. If I copy the contents of home on sdb1 to home on sda1 I think I will then have multiples of the default folders - Audio, Desktop, Documents, etc. I don't see a way to move all my stuff from sdb1 to sda1 in one action. I might delete the default folders in home on sda1. Now that I enabled view to display hidden folders that might be a good idea. Do you have any suggestions?
 
Old 11-18-2018, 05:36 PM   #14
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Have a look at man cp and see if any options deal with recursive copying and/or overwriting, etc.
 
Old 11-18-2018, 07:28 PM   #15
borgward
Member
 
Registered: Apr 2005
Location: Austin, Texas
Distribution: Feather, Darn Small Linux
Posts: 504

Original Poster
Rep: Reputation: 21
I created testfolder in home on sda1 and also in /home/tom on sdb1. I copied some files and folders from there to testfolder on sda1. I then put the same files and folders in testfolder on sdb1 plus some additional files and folders. I did cp -R /media/tom/9983149b-3a05-462b-96a6-939625e6c7b6/tom/testfolder /home/tom/. That worked. No duplicate files or folders. I will next copy home from sdb1 to sda1.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Time taken to copy data from PC to External USB HDD and External USB HDD to PC will same? jegadezz Linux - Newbie 3 11-14-2017 09:22 AM
copy installation from one HDD to another, which directory NOT to copy? bfzhou Linux - Newbie 9 03-16-2016 11:59 AM
Want to change how pasted files are named "(copy)," "(another copy)," "(3rd copy)" L a r r y Linux - Desktop 3 08-24-2013 03:39 PM
[SOLVED] How do I copy root the file system of an internal hdd to a usb hdd completelinuxnube Slackware 8 08-06-2012 02:22 PM
Anyone know of a readily available hdd to hdd copy utility? lumix Linux - Software 1 03-29-2007 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration