Erreur lors du démontage de /dev/sda5 : la cible est occupée

Solved
Loumau_91 Posted messages 115 Status Membre -  
Loumau_91 Posted messages 115 Status Membre -

Hello,

I am attaching an error that was reported to me while trying to create an image of my disk.

Thank you for your help.



4 réponses

mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927
 

Hello,

I don't know what software you're using, but I can at least explain the error. When a process is using a folder or a file from a partition (here /dev/sda5), the disk in question cannot be unmounted.

I suspect that in your case /dev/sda5 corresponds to /home (you would need to check the output of the command mount | grep sda5 to confirm), and since this partition is in use because your Ubuntu is running, you cannot unmount it.

I also suspect that your software is making a bit-by-bit copy (with dd?) of the partition, and that’s why it wants to unmount the partition (to ensure that no one is modifying it during the backup).

This means that to perform your backup, you need to proceed differently. For example, you can:

  • back up with your software from a live USB, since it will be the Ubuntu on the USB key that is running and not the one on the hard drive, the partition /dev/sda5 will not be mounted and thus can be backed up
  • back up in another way (some use rsync, others copy over the network the folders they care about, etc.)

Good luck

0
Loumau_91 Posted messages 115 Status Membre 3
 

Hello Mamiemando,

Thank you for your punctuality and especially your recommendations. Ultimately, I wanted to create an image of my hard drive and I am using the commands I found when I display my drive. Indeed, I want to replace my 320GB HDD with a 500GB SSD.

If I cannot create this image, it's not a big deal; I'll reinstall my Linux properly and that will be that. But as always, I'm curious and I wanted to see!!!

While I'm at it, do you think I could change this drive myself or should I take it for repair?

If so, where can I find information on how to disassemble my ASUS laptop and then make the change?

I feel like I'm being a bit reckless, don't you think?

Thanks again and best regards

L

 t

tThere’s no point in rushing; you must start on time.

0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927
 

Hello Loumau_91

Thank you for your punctuality and especially your recommendations. Ultimately, I wanted to create an image of my hard drive and I’m using the commands I found when I display my drive. Indeed, I want to replace my 320GB HDD with a 500GB SSD.

It's perfectly doable, you just need to make sure the copied partition is unmounted during the copying process. However, I think copying the entire 320GB is a bit excessive; presumably, the only files you need to back up are the ones in /home.

  • Regarding /home: Assuming you can connect both your 320GB drive and the 500GB drive simultaneously, you can connect them both at the same time, install Linux on the 320GB drive, and then copy the contents of the /home partition from the 320GB drive to the 500GB drive.
  • Regarding /: You’re better off doing a clean reinstall.

While I’m at it, do you think I could change this drive myself or should I take it for repair?

Installing or removing a hard drive is a simple task. The connections are such that it's hard to go wrong, and there are probably plenty of tutorials online. You just need good lighting (since the screws are small) and a suitable screwdriver. During disassembly, I recommend working on a large table with a light-colored cloth to prevent the screws from rolling away and to see them clearly. Place the screws around your computer to remember which screw goes into which hole, as they are generally not all the same size (especially not the same length). If the cover doesn’t come off, it’s probably because you’ve forgotten a screw. You can gently twist the plastic to find the missing screw, but be careful not to force it to avoid marking or breaking the plastic.

Regarding the file transfer from the old /home to the new /home that I mentioned, it’s not very complicated. During installation, completely ignore the 320GB disk and install on the 500GB disk. If you’re afraid of making a mistake, you can even unplug the 320GB disk during the installation. At the end of the installation, make sure to install grub on the 500GB disk.

Then, plug the 320GB disk back in and boot into the freshly installed Linux. Identify the device associated with the old /home partition using the command:

sudo parted -l

... let’s say it’s /dev/sda5. Mount the old /home partition to an arbitrary folder, let’s say /media/home_old:

sudo mkdir -p /media/home_old sudo mount /dev/sdb5 /media/home_old

Verify that you can see your old /home files in /media/home_old and then copy them to your new /home:

cp -r /media/home_old ~

Finally, unmount the partition /dev/sdb5:

sudo umount /dev/sdb5

There you go, you're done, you can turn off your computer and unplug the old drive (and donate it to a school or organization if you no longer need it).

Good luck

0
Loumau_91 Posted messages 115 Status Membre 3
 

Hello Mamiemndo,

Thank you for your quick and precise answers. The only problem is my eyes and that's something you can't help with.

I marked it as RESOLVED.

Have a nice day

L


0