this post was submitted on 14 Jan 2025
31 points (100.0% liked)

Linux

49007 readers
1233 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I bought a laptop with windows 11 instaled in its 256gb nmve ssd. I want to install linux but I want to first create an image of the ssd and store it in an external 4tb ssd with a ext4 filesystem (that I use for different backups) so in case I want to sell the laptop later I can restore windows 11 to the same ssd from the image. So what i'm planning to do is:

  • dd if=/dev/drive_device of=external_ssd/images/windows11.img

for creating the image and swapping if and of for restoring. My question is if creating the image of a drive with a windows 11 filesystem and storing it in a ext4 filesystem is possible or can have any issue. I ask this because I read that in the case of cloning the target drive will end up with the filesystem of the source drive in case they are different, which caused me some hesitation.

top 17 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 16 hours ago

I used to do this frequently "back in the day"....

dd will create a complete bit-for-bit copy of the drive and put its contents into a file. All the way down to the boot sector, partitions, etc. Filesystem doesn't even matter a little.

I used to do something like "dd /dev/sda bs=1M | nc remote.server 1234" and then on the remote server "nc -l 1234 -p > file.img </dev/null". I was swapping back and forth between Linux and Windows on a work laptop that I was using for non-work related things on the weekend, at conferences, etc.

Wasn't perhaps my most intelligent moment, but it worked!

[–] [email protected] 2 points 16 hours ago (1 children)

You 100% want to use Clonezilla for this job. It should be on everyone's Ventoy stick.

[–] [email protected] 4 points 15 hours ago (1 children)

What are the pros of using Clonezilla instead of dd, in terms of simplicity the command that I wrote it's hard to beat.

[–] [email protected] 3 points 9 hours ago

Backups only used blocks. Backup to or from various locations, NFS shares, ftp, WebDAV, ssh server, samba, etc. Encryption of the images, backup of single partitions or whole disks.

If you want to deploy to several machines at once it also has a load of tools for that too.

[–] [email protected] 2 points 17 hours ago (1 children)

As others have said, using dd will be a bit for bit copy of the drive, regardless of the filesystem. If you were only using 10GB, and the rest of the drive was "empty", the output of dd will still be a 256GB file. You could compress this file with gzip if storage is a concern.

With regard to your plan with Windows, there is a hardware check that OS will perform and if the hardware drifts too much, the OS will not be activated anymore and will need a new license. I'm not familiar with recent versions of Windows, but if you have a Pro version of the OS, it might not work on new hardware.

[–] [email protected] 2 points 15 hours ago (2 children)

The idea is to restore Windows to the same laptop in case I want to sell it, so it shouldn't have any issues, right?

[–] [email protected] 2 points 12 hours ago (1 children)

You can just reinstall base Windows at that time, either plain or your OEM version if they provide it. There's not much use in preserving the current image.

[–] [email protected] 2 points 11 hours ago (1 children)

there are. for one because of the license key, but also because it's not rare that its hard to find all the drivers that make all of the laptop work

[–] [email protected] 3 points 10 hours ago (1 children)

OEM license keys have been stored in the BIOS for several versions now: https://en.wikipedia.org/wiki/System_Locked_Pre-installation

For 99% of drivers, the on-disc ones are enough to get up and running, and as long as you have an Internet connection you can download any that aren't on-disc. The remaining 1% can be obtained directly from the OEM. Modem Windows is very good about this.

[–] [email protected] 1 points 9 hours ago

For 99% of drivers, the on-disc ones

op will wipe the disk

as long as you have an Internet connection you can download any that aren't on-disc

if windows update can guess correctly what kind of device you have

The remaining 1% can be obtained directly from the OEM

I did not have that experience last time with an acer laptop

[–] [email protected] 3 points 15 hours ago

Ah I see ok yeah that should be fine. I misread and thought you were going to sell the windows laptop and transfer the OS to a new machine.

[–] [email protected] 7 points 17 hours ago

Apart from dd you can also go for Clonezilla or Rescuezilla. Both not super user friendly but once you get familiar with it makes backups and restore easy and fast for data and boot-loader.

[–] [email protected] 8 points 17 hours ago (1 children)

The file you create using the dd command is just a file. It can live on any filesystem capable of storing a 256 GB file.

Make sure that you compare the checksum between the drive and the file and store a copy of it with the file, so you can check it after restoring the data.

Note that you can even mount that file using a loopback interface, so you can read the content, but if you alter it, the checksum will change.

Welcome to Linux where all manner of magic is built-in.

[–] [email protected] 2 points 17 hours ago (2 children)

Great, I didn't know that you can make a checksum of a drive. Thanks.

[–] [email protected] 2 points 11 hours ago

It's possible because block devices can be read just like files (except often the permission differences)

you can use the sha256sum command to do this. there are a few siblings of it with different algs. gui tools also existof course

[–] [email protected] 3 points 17 hours ago

Pretty much everything on Linux is a "file", which is a metaphor used throughout the operating system.

https://en.m.wikipedia.org/wiki/Everything_is_a_file

[–] [email protected] 3 points 17 hours ago

No, a dd image is just a raw stream of bits. It doesn't care about filesystems, neither inside nor outside the file.