T
T
t256e2021-09-24 07:39:55
linux
t256e, 2021-09-24 07:39:55

How to increase disk space after backup?

Made a bit-by-bit copy of one disk to another using the command

sudo dd if=/dev/sda of=/dev/sdb1 bs=4096 conv=noerror


The problem is that there is only 11.93 GB of unused space, although in fact it is much more.
There was no more space on the old disk from where it was copied from, and it was transferred to the new disk, although there is space here.
614d567415804137059642.png

Can't expand space
614d5680ab6dd749988499.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xotkot, 2021-09-24
@t256e

clone disk:

dd if=/dev/sda of=/dev/nvme0n1 bs=100M conv=fsync oflag=direct status=progress

where the size /dev/sda is less than or equal to the size of the disk (not a partition) /dev/nvme0n1
see what partitions you have on the disk nvme0n1
lsblk /dev/nvme0n1
let's say you have two partitions nvme0n1p1 and nvme0n1p2 there
and you need to expand the last nvme0n1p2, that is, the second
one will maximize the last (2 ) the partition in the partition table -N 2 here is the second partition , after which, just in case, re-read the partition table of this disk: and check the file system nvme0n1p2 (before increasing) now directly increase the size of the file system of the second partition itself: and lastly , check again: .with.
echo ", +" | sudo sfdisk /dev/nvme0n1 -N 2
blockdev --rereadpt /dev/nvme0n1
e2fsck -f /dev/nvme0n1p2
resize2fs /dev/nvme0n1p2
e2fsck -f /dev/nvme0n1p2
if you have a GPT disk partition, then it does not hurt to duplicate the partition table entry from the beginning of the disk to the end
sfdisk --relocate gpt-bak-std /dev/nvme0n1

Z
Zzzz9, 2021-09-24
@Zzzz9

What's the point of copying a disk to a partition? There was a vinaigrette. We need to decide on the task. If you need a disk image, use some partclone, if you clone, then from disk to disk. Partclone does not save empty space and the image will be smaller.

R
rPman, 2021-09-24
@rPman

You can copy byte by byte only to a partition of the same size, and when copying to a partition of a larger size, the total size will remain the same and the extra space will not be automatically used.
There are a lot of utilities, for example, partclone (supports all popular file systems, including ntfs) that can very effectively copy the contents of a partition without affecting its logical objects (files, attributes, access rights, etc.) but at the same time skipping the free area, can copy both to a larger partition and reduce the size if the free space on the source disk allows it (unfortunately, this does not always happen, if the mft area area fails, the reduction limit may not be equal to the occupied disk space, for example, a 500GB partition with 100GB occupied, I could only reduce it to about 200GB, there is no way to fix this, only backup format restore)
There is an excellent utility - clonezilla, regular for most linux, incl. has boot images (based on partclone) which, with simple and clear wizards, allows you to do a lot of useful things with disks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question