Jump to content

Trying to install linux on a VERY old laptop


ProDave

Recommended Posts

So I now have my Zorin PC working well and all configured as I like it, but as yet not much data on it.  I thought this would be a perfect time to take a backup in a fashion that if the machine crashed I could restore to this point, rather than installing an off the shelf zorin install and then configuring it all.

 

So I thought   dd if=/dev/sda of=zorin.img  would create an image file that I could restore to a clean disk.

 

the disk is a 120GB SSD with about 15GB in use.

 

It soon became clear as the image file just grew and grew that it was trying to image the whole 120GB disk, not just the used bit, so I had to abort that.

 

How else can I take a copy of just the used disk, that I can restore to a blank disk and everything will work?

Link to comment
Share on other sites

39 minutes ago, bgmill said:

conv=sparse

 

I tried that on a 1GB disk image I have for a VM on my SSD and it came out exactly the same number of bytes which didn't surprise me given what the man page says about conv=sparse.

 

How about just compressing the output?

 

dd if=/dev/sda | gzip -c - > zorin.img.gz

 

The -c switch to gzip tells it to write its output to stdout. The lone “-” parameter means to use stdin as the input file.

 

dd just copies its input byte for byte. When given a block device like /dev/sda it'll do as it's told and just copy the blocks not taking a moment's notice of the file system involved. If you've got a fairly fresh disk (or one you've zeroed before formatting it with the file system) then the empty blocks which haven't been used will be all zero and should compress well. If the disk has had a long and hard life then the unused blocks will still have fragments of old files, directories, etc, in them so won't compress so much.

 

I used dd/gzip on the image file mentioned above:

 

$ dd if=max.raw | gzip -c - > max.img.gz

 

which gave a compression of ~7:1,

 

-rw-rw-r--  1 edavies edavies  138077740 Jan 28 20:03 max.img.gz
-rw-r--r--  1 edavies edavies 1073741824 Sep 25  2018 max.raw

 

Restore with something like:

 

gunzip -c zorin.img.gz | dd of=/dev/sdb

 

or whatever.

 

The alternative would be some utility which understands the file system and only copies the directories, files, etc. But it would also have to understand the partitioning and copy the partition table with the flags to make the right partition bootable and what have you. Such a utility wouldn't be entirely mad but I don't know of one. But then, I don't know what Partclone is either.

Link to comment
Share on other sites

Okay my problem was a "senior moment"  I was trying to write the output file to the same disk.

 

Now when I try the same, but sending the output file to the network drive I get "permission denied"  Yet I can read and write to the network drive.

Link to comment
Share on other sites

17 minutes ago, ProDave said:

Now when I try the same, but sending the output file to the network drive I get "permission denied"  Yet I can read and write to the network drive.

 

Because you're running dd under sudo so running as root which might not have permission to access that particular network drive? If it's that then something like:

 

sudo dd if=/dev/sda | dd of=<whatever>/zorin.img

 

would be my first thought. Exactly that would still be copying 120 GB, though.

Edited by Ed Davies
Link to comment
Share on other sites

14 minutes ago, Ed Davies said:

 

I tried that on a 1GB disk image I have for a VM on my SSD and it came out exactly the same number of bytes which didn't surprise me given what the man page says about conv=sparse.

 

It will all depend on the block size and whether you have many empty blocks to seek, I'm guessing you probably had very few.

 

Here's the results from a ~100GB partition with ~80GB free on my machine with and without conv=sparse:

 

bgm@wintermute ~ % du -sh *.dd
12G	sparse.dd
98G	test.dd

 

Link to comment
Share on other sites

10 minutes ago, Ed Davies said:

 

Because you're running dd under sudo so running as root which might not have permission to access that particular network drive? If it's that then something like:

 

sudo dd if=/dev/sda | dd of=<whatever>/zorin.img

 

would be my first thought.

That "worked" in so far as I did not get the permission error, but it was sooooooo sloooooow after about 5 minutes it had written only a few 10's of MB and would take forever.

 

I will try again another time to a USB drive plugged into the laptop rather than a network drive.

 

I thought SUDO had permission to read and write everything?

Link to comment
Share on other sites

14 minutes ago, bgmill said:

It will all depend on the block size and whether you have many empty blocks to seek

 

You're right - the copied file was a tiny bit smaller according to du though ls showed them the same size. I didn't realise it was actually creating a sparse file on the destination rather than just doing a sparse copy.

 

5 minutes ago, ProDave said:

I thought SUDO had permission to read and write everything?

 

Root does on its own system but permissions on the network drive will be different depending on how it's set up and authenticated.

Link to comment
Share on other sites

10 minutes ago, Ed Davies said:

 

Root does on its own system but permissions on the network drive will be different depending on how it's set up and authenticated.

The disk that's now on the network was a new disk, set up partitioned and formatted on the W10 pc, then plugged into the network.

 

Normal users on the Zoron pc can read and write to it without problem, so I can't understand why sudo can't.

Link to comment
Share on other sites

Sometimes I despair at the thought process of programmers.

 

If I let the battery on the laptop get too low, up pops a box, telling me I must either choose to shut down or suspend the computer.  All very logical.

 

Except they forgot the third option.  Plug the bloody charger in.

 

Even if you do that, there is no way to dismiss that pop up box from your screen, other than by shutting down, or suspending the computer.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...