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.
I am trying to make a copy of the operating system. I have tried with Clonezilla and others, I just don't understand the procedures in those graphical forms.
Now I try it from the terminal with the 'dd' command I don't know if I will also be erring in understanding the instructions ... anyway, this is what I”m doing:
But after all this when I go to the Bios, the USB (which was previously formatted in FAT32 -- and it is 64GB/the OS is around the 17GB) is not recognizable.
Also the PC does not recognize the USB after the use of this command, it only recognized it before all this ...
Where can be my mistake, the 'dd' command used here is not the correct one...?
*More information:
Code:
@SolydXK:~$ sudo fdisk -l
Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: PC SN520 NVMe WDC 256GB
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: gpt
Disk identifier: 7D3D13AC-4A54-4810-8257-722BBF55BE3A
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 526335 524288 256M Microsoft basic data
/dev/nvme0n1p2 526336 72937471 72411136 34.5G Linux root (x86)
/dev/nvme0n1p3 72937472 89714687 16777216 8G Linux swap
/dev/nvme0n1p4 89714688 159483903 69769216 33.3G Linux filesystem
/dev/nvme0n1p5 159483904 231698431 72214528 34.4G Linux filesystem
/dev/nvme0n1p6 231698432 304171007 72472576 34.6G Linux filesystem
/dev/nvme0n1p7 304171008 386467839 82296832 39.2G Linux filesystem
/dev/nvme0n1p8 386467840 500117503 113649664 54.2G Linux filesystem
Disk /dev/sda: 58.6 GiB, 62914560000 bytes, 122880000 sectors
Disk model: ProductCode
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: 0xb2034f56
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 122879999 122877952 58.6G c W95 FAT32 (LBA)
@SolydXK:~$
Where can be my mistake, the 'dd' command used here is not the correct one...?
You're right about that, it is not the correct command as it will only copy the partition on which you have Linux. You need to also copy the data from the MBR to make it bootable. Using nvme0n1 in your dd command would do that but that is not what you want as it will also copy all the other partitions. I see you have one Microsoft data partition on a GPT drive. Do you actually have a windows OS installed? I would expect to see an EFI partition but there is none from the fdisk output.
I've never had the need to do this so can't help any more. Have you tried clonezilla to see if there is an option to do this? I'd suggest you check that out and hopefully, someone else here with more knowledge on the subject will see your post.
From the posted information the most likely reason it did not work as compared to the other partition is because /dev/sda1 was already mounted. This "confused" the operating system since metadata changed from VFAT to linux on the fly.
you must not use dd on a mounted usb drive. That is just wrong (even if it worked for you incidentally)
you need to avoid [also] dd-ing a living system, because that may also cause useless result.
No ... i think Yancek is right what it is coping is the partition not the data -- it is a wrong command, if we can say there is 'good command', because for days i have been looking/searching for how to do this operation and i found nothing about it, which make me to think that pan64 is right too when he adviced we need to avoid dd-ing a living system ...
The only thing i still wihout to understand is why the graphics (Clonezilla, etc) can do it but not 'dd').
Well, any way, thank you very much for your orientations, help.
Clonezilla tries to copy file by file from source. On destination it makes a few files that it can later use to re-create the source. It does have options to clone between drives but I rather doubt it will easily go from larger to smaller.
you need to avoid [also] dd-ing a living system, because that may also cause useless result.
I think this is the pertinent bit you (OP) need to understand.
You cannot dd a complete hard drive while it is being used by an operating system.
That's why, you have to boot up from a Live USB system and do your dd'ing while the internal hard drive is passive/dormant.
Thanks jefro, but as i said from the begining i was trying Conezilla and others and i found them out of my understanding, for me it must be something not to complex as MX snapshot -- i was trying to get to install it following somes ideas/instructions from a Debian Forum but it was impossible, problems with 'depecrated keys', etc ...
I think you're missing key concepts discussed in various replies:
The output file destination, of= must be large enough to hold the input file, if=
Do not have the input file mounted when you do this
That's all I have to offer. If you feel clonezilla is better, then suggest continuing to use it. I've used dd for all my copies for probably 25 years and it has always worked correctly.
1-Maybe I'm making a mistake but ... the USB is 60GB and the system is about 17GB.
2-At first I was doing it wrong with the 'mounted' ... but not the last time ...
In your initial post, you posted information from the fdisk command which does NOT show an EFI partition, which is confusing. If you have an EFI system and want to boot EFI, you need an EFI partition on the USB with the proper boot files if you want to boot it separately. If you want to copy the partition which has some Linux OS installed and boot it separately in Legacy mode, you will need to install Grub to the MBR of the USB as copying a partition only will not make it bootable. Additionally, you will then need to set Legacy/CSM to enabled in your BIOS. I doubt this second method is what you want.
As other members have said, you need a USB (or DVD) with a Linux OS on it plus the USB you want to write to as cloning or copying a running system from that same running system is highly likely to create problems. Simply copying one partition (even the root filesystem partition) to another drive will never be bootable. You need to get the boot files either from the MBR on a Legacy install or if it is EFI, the correct EFI files on the USB you are copying to.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.