Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello i have started to recover data from hard drive using this guide and i have used the command
ddrescue -f -n -a 5120000 /dev/sdc /dev/sdd logfile.log
my question was where will the logfile be saved if i have booted from a bootable usb stick? will it be lost on reboot?. if that is the case then what command should i use to copy it somewhere else. the pen drive is sdb
In whatever directory that you run ddrescue in. If the directory is not writable, or it is a directory on a USB device that does not have persistence, then I would say you won't have a log.
In whatever directory that you run ddrescue in. If the directory is not writable, or it is a directory on a USB device that does not have persistence, then I would say you won't have a log.
Code:
info ddrescue
Make a text file out of the docs
Code:
info ddrescue > ddrescue.txt
i am running it from systemrescuecd live usb. in this case would there be a log?
i am running it from systemrescuecd live usb. in this case would there be a log?
A live usb is not usually writable, although it gives that impression when installing packages, running commands, etc.
The file is actually in memory so all that is needed is to save it to some place that is permanent or copy it there before you log off or reboot.
You could, instead of saving it the way you did, simply give it a path to another device (i.e. mount another usb stick, a drive not being read or written, etc. on /mnt and save the log to /mnt/ddrescue.log) then it would already be saved for you.
A live usb is not usually writable, although it gives that impression when installing packages, running commands, etc.
The file is actually in memory so all that is needed is to save it to some place that is permanent or copy it there before you log off or reboot.
You could, instead of saving it the way you did, simply give it a path to another device (i.e. mount another usb stick, a drive not being read or written, etc. on /mnt and save the log to /mnt/ddrescue.log) then it would already be saved for you.
ah ok so what command should i use for copying it to permanent place. sorry i am a bit unfamiliar with linux.
So the short answer is to stick a USB in, see where it automounts to (been a while since I booted systemrescue) and simply copy the file after ddrescue finishes. Next session make sure the USB is inserted first and use the saved logfile on ddrescue command.
ah ok so what command should i use for copying it to permanent place. sorry i am a bit unfamiliar with linux.
If you are smart enough to use ddrescue then surely you can mount a device and copy a file there, or change the log part of the ddrescue command to write the log there.
ddrescue is quite complex and possibly dangerous for someone who cannot even mount a device or copy a file.
read the man pages. mount, cp, rsync, umount, etc.
So the short answer is to stick a USB in, see where it automounts to (been a while since I booted systemrescue) and simply copy the file after ddrescue finishes. Next session make sure the USB is inserted first and use the saved logfile on ddrescue command.
Code:
cp logfile.log /media/theusb/
i could also copy the file to the internal drive of the computer(the two drives that are involved in the transfer process are externals). the internal drive is sda so i assume cp logfile.log /dev/sda1/ works?
Yeah -
I read the link you posted and had /dev/sda in my head as the broken disk - didn't read your post properly. Typically you wouldn't put it in the root, but somewhere like /dev/sda1/home/${USER}/
Shouldn't really matter in this case, the file will probably be owned by root anyway.
So in your case the ddrescue command could be modified to
Code:
ddrescue -f -n -a 5120000 /dev/sdc /dev/sdd /root/logfile.log
This is assuming you are running ddrescue from the operating OS on your system.
If instead you are running from a live USB then there would be an additional step for mounting the main partition of /dev/sda which I would assume is /dev/sda2 and it would be something like this
Code:
mount /dev/sda2 /mnt
ddrescue -f -n -a 5120000 /dev/sdc /dev/sdd /mnt/root/logfile.log
In either case the logfile.log would be located in /root on the main OS filesystem. The path could be whatever you choose to where you want it saved.
Since you have already started with the log as logfile.log then once ddrescue completes it would be simple to use the mount command above then copy the file to the HDD with "cp -a logfile.log /mnt/root/logfile.log" and the file will be saved. Do that before you reboot.
Last edited by computersavvy; 02-23-2021 at 12:41 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.