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.
Some days ago i did a dd image write of a Linux Mint image. The command i used was the recommended in their page: sudo dd if=~/Desktop/linuxmint.iso of=/dev/sdb oflag=direct bs=1048576
The problem was that i was sleeping and mistaken the drive letter and writed the image to an External USB 2TB hard drive instead of the usb pen drive! This was not so much a problem because i had a backup of that drive.
The real problem is, to put the data that i lost, again in that drive, i erased all partitions in gparted, created a new partition table, formated in NTFS (it has to be), then in windows did the same thing again just to be sure. Gparted, fdisk and windows disk management tool, all show me that the disk only has one partition (what i want). The problem is when i plug the drive into the PC, the Kde device notifier and Dolphin shows like 2 drives have been plugged ( One with the label "Store" with my files, and another with device name's label, with the files of the Mint image that i preveously writed). I can only mount one of that drives at a time.
Fdisk-l output:
Quote:
Disk /dev/sdb: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 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
Disk identifier: 0x00061614
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907020799 1953509376 7 HPFS/NTFS/exFAT
[diogo@ds-desktop ~]$
Well, something wrong is going here. I tried to google for a solution but didnt found anything. Hope someone can help me, specially if i can resolve this without reformatting the hard drive (it takes almost one day to put the data back)
Thanks in advance
1 members found this post helpful.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
Quote:
Originally Posted by [rascas]
...The real problem is, to put the data that i lost, again in that drive, ... Gparted, fdisk and windows disk management tool, all show me that the disk only has one partition (what i want). ...
You lost me there somewhere. You re-created and formatted a NTFS partition as needed. Well, then restore the data and have a look whether your backup worked .
Quote:
Originally Posted by [rascas]
...The problem is when i plug the drive into the PC, the Kde device notifier and Dolphin shows like 2 drives have been plugged ( One with the label "Store" with my files, and another with device name's label, with the files of the Mint image that i preveously writed).
On my box KDE shows (sometimes) the whole device and the partition.
Quote:
Originally Posted by [rascas]
...I can only mount one of that drives at a time.
Definitely "unusual". Looks like you didn't format the whole device but created a new partition. Perhaps a dedicated thread in an appropriate forum here might bring better results, sorry.
Quote:
Originally Posted by [rascas]
...
Fdisk-l output:
Code:
Disk /dev/sdb: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 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
Disk identifier: 0x00061614
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907020799 1953509376 7 HPFS/NTFS/exFAT
That's what I meant: The first block is the device /dev/sdb, the second the partition /dev/sdb1.
Yeah my post seems a bit confusing. I will try to explain better.
Forget the data backup part. I did that already and its not the problem. I did that in windows ( i dont trust linux/fuse to copy/move data between ntfs partitions). They are to WD Caviar green 2 TB.
Now i have 2 virtually identically drives with the same data. Virtually because, now in linux (dolphin) it is showing me one of the disks having 2 partitions. My only issue is that only dolphin and the kde device manager shows me that. Gparted and fdisk tells me that there is only one partition in that disk. Windows "sees" only one partition to. Thats what is confusing me (and maybe you). See the picture:
WDC WD20EARS and Store is the same hard drive. This is the drive that i made the image copy with dd by accident. But on fdisk:
Code:
Disk /dev/sdb: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 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
Disk identifier: 0x00061614
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907020799 1953509376 7 HPFS/NTFS/exFAT
Disk /dev/sdc: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 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
Disk identifier: 0x0002de0f
Device Boot Start End Blocks Id System
/dev/sdc1 2048 3907020799 1953509376 7 HPFS/NTFS/exFAT
[diogo@ds-desktop ~]$
Can you see? The same info for the 2 drives. sdb is the "Store" drive. sdc is the "Backup" drive. Confirmed in gparted.
But i can tell you something is wrong beacause if i try to boot the computer by the "Store" HD (selected it in BIOS) the computer seems to detect a bootloader and tries to boot it but it fails and hangs (have to do a reset). This doesnt happen with the "Backup" drive.
Its stupid because neither hard drives have the "boot flag".
I made a "chkdsk" to the "Store" HD in windows and all seems fine. No errors or bad sectors.
When i made the data backup im pretty sure that i deleted the partition table and all partitions, and created only one partition. All of this with gparted.
I think dd messed up this hard drive... Can you tell at least if there is any dd command that erases all data and all partitons (well, everything), like if it was new? So that i can start from scratch and make the backup again.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
Quote:
Originally Posted by [rascas]
...Now i have 2 virtually identically drives with the same data. Virtually because, now in linux (dolphin) it is showing me one of the disks having 2 partitions. My only issue is that only dolphin and the kde device manager shows me that. Gparted and fdisk tells me that there is only one partition in that disk. Windows "sees" only one partition to....
I think this is a misconception on your part (no slight intended). As hinted in my previous post, KDE shows you the device ("WDC..." aka /dev/sdb) and the partition ("store" aka /dev/sdb1). I don't understand why it isn't doing this for the other drive as well.
Several things.
First, select the left menu (Places) and try pressing <F5>. This will re-read / refresh the data.
If this doesn't work, try the other mode(s) of dolphin. There is not only "Places" but several more choices to be made from "view" (I think. My dolphin looks quite different, there I chose from an icon on the right side...). Play around with dolphin, from your screenshot one can see, that you are using only the barebone abilities of it.
And thirdly, are you booting from "Backup"? If not, umount it and unplug it, then plug it in again. Let's see what then happens.
Quote:
Originally Posted by [rascas]
...But i can tell you something is wrong beacause if i try to boot the computer by the "Store" HD (selected it in BIOS) the computer seems to detect a bootloader and tries to boot it but it fails and hangs (have to do a reset). This doesnt happen with the "Backup" drive.
Its stupid because neither hard drives have the "boot flag".
I made a "chkdsk" to the "Store" HD in windows and all seems fine. No errors or bad sectors.
Well, you dd-ed something over to the MBR of that drive. Your 'puter will try to act on that but an .iso is not organized like a hard disk. This is not dangerous as far as I can tell. Backup has obviously a "clean" MBR, so nothing happens. Linux / GRUB doesn't care for the boot flag, you can boot from anywhere.
Quote:
Originally Posted by [rascas]
...I think dd messed up this hard drive... Can you tell at least if there is any dd command that erases all data and all partitons (well, everything), like if it was new? So that i can start from scratch and make the backup again.
Umm, you issued that command . And yes, there is a command to zero out your drive:
Code:
dd if=/dev/zero of=/dev/sdb bs=1M
Please make really, really sure it is sdb you are wanting to flatten, because everything will be gone irrevocably.
Hi JZL240I-U.
Thank you very much!! Cleaning the MBR with the dd comand you posted did the trick!
I didnt thought too much about the dd command i issued and i was not remembering an .iso is not organized like a hard disk. Thanks for remembering me that!!!
Now dolphin shows me only the partition and not the device name, the normal way, the way i wanted it.
I know how to use dolphin. I just like to get it simple . If i want something with more options i generaly use konqueror.
Anyway, thank you very much for your help and time.
I don't understand why this thread hasn't been made a sticky,so that it's easily found by others. I myself have it bookmarked as there is a lot of information on a continuous basis.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Not Stickied
Quote:
Originally Posted by EDDY1
I don't understand why this thread hasn't been made a sticky,so that it's easily found by others. I myself have it bookmarked as there is a lot of information on a continuous basis.
The dd post is good, but it really doesn't fit as a sticky, because it's not information nearly every newbie should know before embarking on the forum. But I don't make any decisions. That's my opinion.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Just a quick note regarding some posts above: If you image to both an internal drive and a USB drive, the USB drive will probably not boot correctly, because the device files are slightly different. But GRUB2 usually will work if the USB image is the entire drive.
The dd post is good, but it really doesn't fit as a sticky, because it's not information nearly every newbie should know before embarking on the forum. But I don't make any decisions. That's my opinion.
I agree that Learn the DD command should NOT be a sticky. Very useful and informative thread that does elevate within the forum.
But the restored partition appears as if it had no format.
Now I am trying to mount the .dd file with the following command:
Code:
sudo mount -o loop -t auto /media/Maxtor/imagenes/partitionimage.dd /media/carpeta
but I obtain the following error:
Code:
mount: tipo fs incorrecto, opción incorrecta, superbloque incorrecto en /dev/loop0,
falta página de código o programa ayudante, u otro error
En algunos casos se encuentra información en syslog, pruebe
dmesg | tail o algo parecido
If I execute dmesg | tail this is the output:
Code:
0.337:29): apparmor="STATUS" operation="profile_replace" name="/usr/bin/evince//launchpad_integration" pid=2554 comm="apparmor_parser"
[ 137.716848] type=1400 audit(1333351970.341:30): apparmor="STATUS" operation="profile_replace" name="/usr/bin/evince//sanitized_helper" pid=2554 comm="apparmor_parser"
[ 137.718630] type=1400 audit(1333351970.341:31): apparmor="STATUS" operation="profile_replace" name="/usr/bin/evince-previewer" pid=2554 comm="apparmor_parser"
[ 137.723892] type=1400 audit(1333351970.345:32): apparmor="STATUS" operation="profile_replace" name="/usr/bin/evince-previewer//launchpad_integration" pid=2554 comm="apparmor_parser"
[ 137.725525] type=1400 audit(1333351970.349:33): apparmor="STATUS" operation="profile_replace" name="/usr/bin/evince-previewer//sanitized_helper" pid=2554 comm="apparmor_parser"
[ 138.048707] init: plymouth-stop pre-start process (2664) terminated with status 1
[ 648.843419] EXT4-fs (loop0): bad geometry: block count 69594112 exceeds size of device (11676287 blocks)
[ 1109.826664] EXT4-fs (loop0): bad geometry: block count 69594112 exceeds size of device (11676287 blocks)
[ 1204.990716] EXT3-fs (loop0): error: couldn't mount because of unsupported optional features (240)
[ 3981.553666] EXT3-fs (loop0): error: couldn't mount because of unsupported optional features (240)
It seems that the block count is giving me some problems.
Now I am using testdisk on the .dd file in order to correct any wrong value, but there is no geometry correction related to blocks.
So I am stuck here. At present I am analyzing the .dd with testdisk.
That could be the source of your troubles if you really did that and not use "of=", like you did several lines below. If I understand the working of dd correctly, you redirected the standard output to a file. The standard output shows only printed characters and not the full range of hexadecimal values, so you lost lots of information (and in essence stored garbage). Anything of my assumption the more savvy readers would like to correct?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.