LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-24-2021, 03:39 AM   #1
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Rep: Reputation: Disabled
Trying to make copy of the OS/'dd'/USB.


Hello,

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:

Code:
@SolydXK:~$ sudo -i
[sudo] password for: 
root@SolydXK:~# df
S.files 1K blocks Used Available Usable Usage% Mounted on
udev 3986508 0 3986508 0% /dev
tmpfs 803940 11152 792788 2% /run
/dev/nvme0n1p7 40240400 17075028 21091568 45% /
tmpfs 4019696 3684 4016012 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 4019696 0 4019696 0% /sys/fs/cgroup
/dev/nvme0n1p1 258095 5713 252383 3% /boot/efi
tmpfs 803936 12 803924 1% /run/user/1000
/dev/sda1 61423904 32 61423872 1% /media/user/USB STICK

root@SolydXK:~# dd if=/dev/nvme0n1p7 of=/dev/sda1
82296832+0 records read
82296832+0 records written
42135977984 bytes (42 GB, 39 GiB) copied, 2835 s, 14.9 MB/s
root@SolydXK:~#
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:~$

Thank you very much for any advice.

Regards.

Last edited by Camello; 09-24-2021 at 06:46 AM.
 
Old 09-24-2021, 06:26 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
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.
 
Old 09-24-2021, 06:36 AM   #3
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Original Poster
Rep: Reputation: Disabled
I don't have Windows on my PC, this is UEFI Bios and, as i said before, i'm not able to understand Clonezilla ...

Thanks for trying to help!

EDIT: i tried with the same command to install the system, this time, not in the USB but in another partition, and it works.

Last edited by Camello; 09-24-2021 at 06:40 AM.
 
Old 09-24-2021, 07:35 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Quote:
/dev/sda1 61423904 32 61423872 1% /media/user/USB STICK
root@SolydXK:~# dd if=/dev/nvme0n1p7 of=/dev/sda1
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.
 
Old 09-24-2021, 07:38 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Also use /dev/sda not sda1
 
Old 09-24-2021, 07:49 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Since nvme0n1 is 250 GB and the USB drive is 64 GB using /dev/sda would fail.
 
Old 09-24-2021, 08:52 AM   #7
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Original Poster
Rep: Reputation: Disabled
I want to be sure if i understand. The USB always mounted by itself, automatically, and all the time has copied the ISO to the USB without problems.

Are you saying that in this case it is different that we have to dismount first ...?

Thanks
 
Old 09-24-2021, 08:54 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
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.
 
Old 09-24-2021, 11:11 AM   #9
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Original Poster
Rep: Reputation: Disabled
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.
 
Old 09-24-2021, 02:25 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
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.
 
Old 09-24-2021, 03:15 PM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by pan64 View Post
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.
 
Old 09-24-2021, 03:26 PM   #12
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Original Poster
Rep: Reputation: Disabled
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 ...
 
Old 09-24-2021, 07:44 PM   #13
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I think you're missing key concepts discussed in various replies:
  1. The output file destination, of= must be large enough to hold the input file, if=
  2. 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.
 
Old 09-25-2021, 02:23 AM   #14
Camello
Member
 
Registered: Apr 2021
Location: USA
Distribution: MX-LINUX
Posts: 218

Original Poster
Rep: Reputation: Disabled
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 ...

Clonezilla better? -- I don't even understand it.
 
Old 09-25-2021, 05:12 AM   #15
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
this is UEFI Bios a
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can I make a copy of an existing operating system? Brant Linux - Software 8 03-31-2016 06:41 PM
problem operating command with DUAL operating system with ubuntu & windows 7 gne Linux - Newbie 2 02-01-2015 08:12 AM
LXer: The non-operating system operating system LXer Syndicated Linux News 0 06-26-2010 05:42 PM
'Operating system not found' Any operating system installed wont work. TechniSlave Linux - Newbie 55 02-09-2009 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration