0

I am using liveCD to clone the file system from one drive (hdd) to an ssd (I am trying to migrate my system to use SSD)

I mounted /dev/sdb1 (my former hdd) to /media/hdd
I mounted /dev/sda1 (my ssd) to /media/ssd
I am using the command

sudo cp -ax /media/hdd/ /media/ssd/  

when I do a dir /media/ssd I see a folder called hdd !??? Why is this happening?

Update:
Now I will edit the /etc/fstab on the ssd to point to the new fs UUID ( I will look it up with blkid ).
Here is the output of the command:

cp -ax /media/hdd/* /media/hdd/.* /media/ssd/

The errors that you see there are the reason why I am migrating to SSD. This PC is always up and the HDD seems to have problems.

Now ..should I worry about the hard links not being created ?

Now I will edit the /etc/fstab on the ssd to point to the new fs UUID ( I will look it up with blkid ).

My next move is to update grub on ssd using the following:

sudo -s
for f in sys dev proc ; do mount --bind /$f /media/ssd/$f ; done
chroot /media/ssd
grub-install /dev/ssd
update-grub 

Considering the above and the errors shown in the picture should I expect any problems?

Edit2: I restored GRUB using the procedure described here https://help.ubuntu.com/community/Boot-Repair very easy for a beginner. The above command lines did not work for me

enter image description here

4
  • As for edit 2, the hard links can be copied over with the rsync way in @A.B.'s answer. The IO errors mean the files there are essentially gone for good. Luckily, though, they're all Linux headers. That means that, once you get everything else copied over and you boot from the SSD, you can use sudo apt-get purge linux-headers-generic then sudo apt-get autoremove then sudo apt-get install linux-headers-generic to reinstall the headers.
    – Olathe
    Jun 18, 2015 at 22:31
  • I am using the computer without those links. What is their purpose and how come that the computer is working fine?
    – MiniMe
    Jun 19, 2015 at 3:12
  • Looking more closely at the hard link error messages, it's saying it's not going to create a hard link from a file to that same file, so never mind on the hard links. The headers can be repaired with apt-get, though.
    – Olathe
    Jun 19, 2015 at 8:06
  • great that means that I am fine. I will fix the headers if I ever need to use them (I guess some app compiled from sources might ask for them down the road) thanks a lot!
    – MiniMe
    Jun 19, 2015 at 11:37

2 Answers 2

1

The cp way

The command:

sudo cp -ax /media/hdd/ /media/ssd/

copies the folder hdd, the command:

sudo cp -ax /media/hdd/* /media/ssd/

copies the files and sub-folders of the folder hdd.

Use:

shopt -s dotglob

for considering dot files.


The rsync way

rsync -az -H --delete --numeric-ids /media/hdd/ /media/ssd/
0

When you copy something to a file, it overwrites the file if it exists.

When you copy something to a directory, it could be rather dangerous to destroy everything that might currently be in the directory to replace it with new contents, so it copies into the directory.

That's why hdd is being copied into the ssd directory.

If you instead do sudo cp -ax /media/hdd/* /media/hdd/.* /media/ssd, it will copy all the files within hdd into ssd.

The * means all the unhidden files inside hdd. The .* means all the hidden files inside hdd.

3
  • 1
    You don't need the p or the R as they are already included in -a. Jun 17, 2015 at 4:20
  • I am marking this as the correct answer because it was the first posted. A.B. s anser is also good and more complete Thanks guys.
    – MiniMe
    Jun 17, 2015 at 11:33
  • @user2059078 Than give me at least an upvote :\
    – A.B.
    Jun 17, 2015 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .