Discussion:
Backing up my HD (prior to installation of new OS)
Add Reply
Daniel70
2025-01-10 10:25:36 UTC
Reply
Permalink
Prior to installing MGA9 (which, eventually, I'd then upgrade to MGA10),
my HD looks like ....

[***@localhost daniel]# lsblk -o NAME,FSTYPE,MOUNTPOINT,LABEL,SIZE
NAME FSTYPE MOUNTPOINT LABEL SIZE
sr0 1024M
sda 465.8G
├─sda4 1K
├─sda2 ntfs /media/win_d Programs 19.5G
├─sda12 ext4 24.4G
├─sda9 ext3 / 10.1G
├─sda10 ext3 /MGA4 10.7G
├─sda7 ext3 /MGA3 7.8G
├─sda5 swap [SWAP] 3.9G
├─sda3 ntfs /media/win_e Games 22.5G
├─sda1 ntfs /media/win_c C:\ 60.1G
├─sda13 ext4 / 48.9G
├─sda11 ext4 24.4G
├─sda8 ext4 /home 223.1G
└─sda6 ext3 /MDA2009 10.4G
[***@localhost daniel]#

I want to back-up my 500GB Internal HD to a 2TB External HD. Previously
(i.e. at about the time I installed MGA6), I used a single 'dd' command
to copy the entire 500GB to the ext drive (including the 4GB SWAP
Partition) back some time ago.

Reading up yesterday (which, of course, I can't locate tonight), which
ever web sight it was gave me the impression I could use the 'dd'
command to back-up partition one at a time .... but, on that web-page,
the back-up was onto the same, internal, hard-drive.

To save me backing up the (useless) Swap drive to my external
Hard-drive, can I use 'dd' to back up, one partition at a time, to my
External Hard-Drive??

e,g, dd if sda1 of sdb/240120/Win7Sys/

then

dd if sda2 of sdb/240120/WinEXE/sdb2/240120/WinEXE/

and

dd if sda3 of sdb/240120/WinStuff/

and

dd if sda6 of sdb/240120/MDA2009

and

dd if sda10 of sdb/240120/MGA4

etc ... etc ... etc??

Or might there be a more suitable command to carry out my situation??
--
Daniel
David W. Hodgins
2025-01-10 18:43:58 UTC
Reply
Permalink
Post by Daniel70
Prior to installing MGA9 (which, eventually, I'd then upgrade to MGA10),
my HD looks like ....
NAME FSTYPE MOUNTPOINT LABEL SIZE
sr0 1024M
sda 465.8G
├─sda4 1K
├─sda2 ntfs /media/win_d Programs 19.5G
├─sda12 ext4 24.4G
├─sda9 ext3 / 10.1G
├─sda10 ext3 /MGA4 10.7G
├─sda7 ext3 /MGA3 7.8G
├─sda5 swap [SWAP] 3.9G
├─sda3 ntfs /media/win_e Games 22.5G
├─sda1 ntfs /media/win_c C:\ 60.1G
├─sda13 ext4 / 48.9G
├─sda11 ext4 24.4G
├─sda8 ext4 /home 223.1G
└─sda6 ext3 /MDA2009 10.4G
I want to back-up my 500GB Internal HD to a 2TB External HD. Previously
(i.e. at about the time I installed MGA6), I used a single 'dd' command
to copy the entire 500GB to the ext drive (including the 4GB SWAP
Partition) back some time ago.
Reading up yesterday (which, of course, I can't locate tonight), which
ever web sight it was gave me the impression I could use the 'dd'
command to back-up partition one at a time .... but, on that web-page,
the back-up was onto the same, internal, hard-drive.
To save me backing up the (useless) Swap drive to my external
Hard-drive, can I use 'dd' to back up, one partition at a time, to my
External Hard-Drive??
e,g, dd if sda1 of sdb/240120/Win7Sys/
then
dd if sda2 of sdb/240120/WinEXE/sdb2/240120/WinEXE/
and
dd if sda3 of sdb/240120/WinStuff/
and
dd if sda6 of sdb/240120/MDA2009
and
dd if sda10 of sdb/240120/MGA4
etc ... etc ... etc??
Or might there be a more suitable command to carry out my situation??
The dd command works fine with individual partitions, provideded you are ok including free space
in the backup. For example "dd if=/dev/sda1 of=/sdb/$PATHTOBACKUP/sda1.backup bs=1M".
That puts a backup into a file, which you can compress if needed for the backup.

If you want to copy it to a newly created partition on a new drive, the new partition must be
created first, with exactly the same number of sectors, and then the contents copied
For example, if the new partition has been created as /dev/sdc10, then to copy it from sda10,
"dd if=/dev/sda10 of=/sdc10 bs=1M".

Don't forget the bs=1M whenever copying anything larger than a sector (normally 512 bytes).

My desktop system died recently. I'm currently using my laptop. For my backups I use rsync,
to copy directories and the files only. No free space or swap in the backup, and only backed
up /etc, /home, parts of /var, /root, and /usr/local.

For the backup of each directory I used commands such as ...
rsync -auvxSP --specials --delete --exclude="lost+found" /usr/local/ /s3/usr/local/
That was with the usb backup partition mounted on /s3.

For the restore to my laptop, I used ...
rsync -auvxSP --specials --delete --exclude="lost+found" /run/media/dave/BACKUP/usr/local/ /usr/local/

The --exclude="lost+found" isn't needed in this case. I leave it in as I just copy/paste the line
and change the directories as needed.

I normally run the rsync commands as root. Some of the uid/gid for the file owners are
different, so I then use chown as needed.

As my laptop already had stuff on it, I only restored what I needed from within some of the
backup directories.

Regards, Dave Hodgins
Daniel70
2025-01-12 08:29:29 UTC
Reply
Permalink
On Fri, 10 Jan 2025 05:25:36 -0500, Daniel70
Post by Daniel70
Prior to installing MGA9 (which, eventually, I'd then upgrade to MGA10),
my HD looks like ....
NAME    FSTYPE MOUNTPOINT   LABEL      SIZE
sr0                                   1024M
sda                                  465.8G
├─sda4                                   1K
├─sda2  ntfs   /media/win_d Programs  19.5G
├─sda12 ext4                          24.4G
├─sda9  ext3                /         10.1G
├─sda10 ext3                /MGA4     10.7G
├─sda7  ext3                /MGA3      7.8G
├─sda5  swap   [SWAP]                  3.9G
├─sda3  ntfs   /media/win_e Games     22.5G
├─sda1  ntfs   /media/win_c C:\       60.1G
├─sda13 ext4   /                      48.9G
├─sda11 ext4                          24.4G
├─sda8  ext4   /home                 223.1G
└─sda6  ext3                /MDA2009  10.4G
I want to back-up my 500GB Internal HD to a 2TB External HD. Previously
(i.e. at about the time I installed MGA6), I used a single 'dd' command
to copy the entire 500GB to the ext drive (including the 4GB SWAP
Partition) back some time ago.
Reading up yesterday (which, of course, I can't locate tonight), which
ever web sight it was gave me the impression I could use the 'dd'
command to back-up partition one at a time .... but, on that web-page,
the back-up was onto the same, internal, hard-drive.
To save me backing up the (useless) Swap drive to my external
Hard-drive, can I use 'dd' to back up, one partition at a time, to my
External Hard-Drive??
e,g, dd if sda1 of sdb/240120/Win7Sys/
then
dd if sda2 of sdb/240120/WinEXE/sdb2/240120/WinEXE/
and
dd if sda3 of sdb/240120/WinStuff/
and
dd if sda6 of sdb/240120/MDA2009
and
dd if sda10 of sdb/240120/MGA4
etc ... etc ... etc??
Or might there be a more suitable command to carry out my situation??
The dd command works fine with individual partitions, provideded you are
ok including free space
in the backup. For example "dd if=/dev/sda1
of=/sdb/$PATHTOBACKUP/sda1.backup bs=1M".
That puts a backup into a file, which you can compress if needed for the backup.
If you want to copy it to a newly created partition on a new drive, the
new partition must be
created first, with exactly the same number of sectors, and then the contents copied
For example, if the new partition has been created as /dev/sdc10, then
to copy it from sda10,
"dd if=/dev/sda10 of=/sdc10 bs=1M".
Don't forget the bs=1M whenever copying anything larger than a sector (normally 512 bytes).
My desktop system died recently. I'm currently using my laptop. For my backups I use rsync,
to copy directories and the files only. No free space or swap in the
backup, and only backed
up /etc, /home, parts of /var, /root, and /usr/local.
For the backup of each directory I used commands such as ...
rsync -auvxSP --specials --delete  --exclude="lost+found" /usr/local/
/s3/usr/local/
That was with the usb backup partition mounted on /s3.
For the restore to my laptop, I used ...
rsync -auvxSP --specials --delete  --exclude="lost+found"
/run/media/dave/BACKUP/usr/local/ /usr/local/
The  --exclude="lost+found" isn't needed in this case. I leave it in as
I just copy/paste the line
and change the directories as needed.
I normally run the rsync commands as root. Some of the uid/gid for the file owners are
different, so I then use chown as needed.
As my laptop already had stuff on it, I only restored what I needed from within some of the
backup directories.
Regards, Dave Hodgins
Thank you, Thank you, Thank you, David. So full of information .... as
usual!!
--
Daniel
Loading...