A reliable backup strategy for a newbie

Okay, I really wanted to come up with a method of backing up my mbr, and I think that may have come up with something.

If I enter gpart show, I get the below information:
Code:
=>        40  1953525088  ada0  GPT  (932G)
          40      532480     1  efi  (260M)
      532520  1945624568     2  freebsd-ufs  (928G)
  1946157088     7368040     3  freebsd-swap  (3.5G)

I noticed that the efi partition is 260MB in size, and that ends at 532480, and that the next partition starts at 532520. So, based upon this information, I issued the below command to create an image file of the first 532500 blocks, which I'm hoping will not interfere with the next partition at 532520, if I should have to restore the image. Please see below code.



Code:
mkdir -p /backup/bootloader
dd if=/dev/ada0 of=/backup/bootloader/bootloader_BCK.img bs=512 count=532500
532500+0 records in
532500+0 records out

Also, below is a screenshot of the image file I ended up with in /backup/bootloader

result_bootloader_img.jpg



So, now I'm wondering what will happen if I try to use the dd command to restore the above image back to its original location at /efi ? Will I destroy my entire partition table, or is it likely to work? Any info greatly appreciated.
 
Another important thing to learn about rsync is what effect a trailing "/" has on the source and the destination.
I think that I noticed that it will sometimes create another directory at the destination, if you leave a "/" at the end of the rsync command. Maybe I'm wrong, but it seemed that way.
 
You are not using MBR (Master boot record). You are using GPT with ESP and you don't need to backup this either as you can create it via the Bootable USB using live system.
Do not use "dd" to make an image of it as you can't restore it on a disk with a differed GUID. It won't work as it's unique for each disk and even if you clone your Disk you will be missing the UEFI boot variable inside your motherboard as it will point to a differed GUID.

So if you need to have a backup of your current loader.efi you can just mount the ESP partition it's FAT file system and you can just copy the file. But again you don't have to do this as it's available on each installed disk.
 
Would the below example work to backup my mbr?
No. As I said, the efi partition is not the MBR.
But don't bother about the MBR too much.

As an ex-Windows user I feel the need with you to be able to save and restore the MBR. Too many times I have also seen the MBR was killed by wrong bootloader installations, and above all Windows itself.
Under Windows you needed to do full partition/drive backups by copying them 1:1 block by block, because simply copying files does not work to save the system under Win...crap.
But as long as you run FreeBSD on the machine exclusively, and don't want to install additionally another OS, especially not Windows, you don't need to care about that at all.
Apart from that, today MBR is only used with simple, single partition drives, like USB flashdrives, sd cards etc. Today's standard is GPT - also under Windows.
When your drive has more than two partitions (not just a primary one, and a secondary one that may contain more than one partition, which was MBR scheme), above all an UEFI partition called efi, and obviously it does, then this disk already is GPT, not MBR. So says your gpart output.
So saving the MBR was pointless, since GPT does not only have a simple MBR like the classic MBR partition scheme, but also additionally a header at the beginning, and one at the end of a drive. To save and restore those can only be done, when you know exactly their positions and size by the very block on the dot precisely, and the other drive you may copy them to has to have also the exact same amount of blocks. Technically this is doable, but I cannot think of any practical usage for that, because you don't need that, above all not as part of your BU plan. Your are not on Windows anymore. :cool:
There is also no need to backup neither the efi partition, nor its contents, because (at least under FreeBSD) it's trivial to recreate it, if its content was deleted.

Under any unix[like] you can save, and restore the whole machine without the need of making exact block-by-block copies of drives, or partitions. Quicker, and more comfortable, and even more comfortable with tools like dump/restore, rsync, et al; and if zfs is used it brings a bunch of very powerful tools of its own. Just copy/save/restore files. Think in files! Think Unix! "Everything is a file." :cool:

Take care of backing up your config files (/etc/, /usr/local/etc/, maybe the /boot/loader.conf if you edited that), anyway your /home/ directory, and the list of what packages you have installed pkg prime-list > /path/to/my_packages.txt
Ensure you have copies of those files on a reliable storage, not some cheap USB thumbdrive.
With having those, a restoration of your system as it was before is no biggy, neither to move it to another drive, even another machine. You simply set up a new system on a new drive - with a complete new partition scheme - and simply copy the files from the backup medium to their locations on the new machine (same system [version]). Voilá.
While in the case of changing the machine some of the config entries may need to be adapted to the changed hardware, of course. Mostly the GPU, if you switch from AMD to NVidia for example, and maybe some network settings.

Don't care about BUs too much, as long as you have made them working.
Don't care about backing up MBR or anything like that at all. You don't need to BU that.
Care about the real stuff:
Get into the system.
Get into shell usage.
Pick and learn a texteditor.
Learn a bit sh scripting.
I recommend you get a copy of
Robbins, Beebe, "Classic Shell Scripting", O'Reilly,
or/and maybe
Kochan, Wood, "Shell Programming in Unix, Linux and OS X", Addison Wesley. (If you get both, start with this one, while the first one brings you deeper, and further.)
You get those for a few bucks at used bookstores.
Those do not teach you just scripting, but using Unix in general at all.
Maybe you can get a copy of Lucas, "Absolute FreeBSD", no starch press. It's not mandatory, but a nice to have supplement to the official handbook.
Other books may come later, when you need them. Most you get from the books you already have.
Learn how to read man pages man man, and take a peek into /usr/local/share/doc/ - those are goldmines.

Don't bother too much about to be prepared for the unsolvable trap. That fear comes from Windows. 😁
As long as you have reliable, and up-to-date copies of the files I mentioned above, there is not much that can really go wrong.
As I always say: Particulary when you messed something up:
dp.jpg

You are using FreeBSD. There always is a way.
Use the power under your fingertips, only waiting to serve you.
:cool::beer:
 
You are not using MBR (Master boot record). You are using GPT with ESP ........Do not use "dd" to make an image of it as you can't restore it on a disk with a differed GUID........So if you need to have a backup of your current loader.efi you can just mount the ESP partition it's FAT file system and you can just copy the file......
Well, it sounds like I still have a lot to learn, and clearly I still have a lot of faulty conceptions about how FreeBSD works. - However, what would happen if I tried to use the dd command to restore my image file back to the original hard drive it was copied from?
 
But as long as you run FreeBSD on the machine exclusively, and don't want to install additionally another OS, especially not Windows, you don't need to care about that at all.
Interesting. Also, this information is pushing me towards the decision to completely get rid of both Windows10 and Ubuntu. It makes sense that a simplified system would be a more stable system.

Under any unix[like] you can save, and restore the whole machine without the need of making exact block-by-block copies of drives, or partitions. Quicker, and more comfortable, and even more comfortable with tools like dump/restore, rsync, et al; and if zfs is used it brings a bunch of very powerful tools of its own. Just copy/save/restore files. Think in files! Think Unix! "Everything is a file."
I now see that I no longer need to make backup images of the entire partition, as I have been doing with Windows, and backing up critical directories with rsync seems like the easiest method for me. However, in the comping I will focus on learning about dump/restore, so that I can handle my backups in a more effecient manner.

Don't care about backing up MBR or anything like that at all. You don't need to BU that.
Care about the real stuff:
Get into the system.
Get into shell usage.
Pick and learn a texteditor.
Learn a bit sh scripting.
I recommend you get a copy of
Robbins, Beebe, "Classic Shell Scripting", O'Reilly,
or/and maybe
Kochan, Wood, "Shell Programming in Unix, Linux and OS X", Addison Wesley.
The fact that I no longer have to be concerned with the MBR seems completely incomprehensible to me. For years I have always lived in fear of not being able to fix my MBR, but now it doesn't seem to be an issue. I have a lot to learn.

I think that part of the problem I'm now having is that I skipped over certain sections in the handbook, I didn't pick up critical points of what FreeBSD is, and how it functions, and when I get into trouble, I tend to fall back upon my earlier knowledge from using Windows and Ubuntu. Big mistake. Because while Ubuntu seems a bit like FreeBSD on the surface, they are not the same, and many of the things which work in Ubuntu, don't work in FreeBSD. Also, I have been using Ubuntu for sometime, and since it never crashed or seldom became unstable, I was never forced to learn how to use it in depth, like I am now with FreeBSD. Don't get me wrong, I enjoy learning new things, but I admit that I have a bad habit of taking shortcuts, without sometimes really understanding what I'm doing.

I've requested some books from the local library, but it will probably be a few days before they arrrive.
 
what would happen if I tried to use the dd command to restore my image file back to the original hard drive it was copied from?
You asked VladiBG but let me answer it:
You can do 1:1 copies of drives and partitions with dd. I did it several times myself, and it works. BUT:
You may save any drive to any other, as long as it's equally large, or larger.
But with GPT partition scheme the copy will only work (being not bootable, not finding the correct partitions) if the drive is an identical drive. But you can do this, e.g. to make a full drive backup of e.g. your 500G Windows drive to a e.g. 1T drive (which was half empty then, and not bootable). But when it's needed you can dd it back the same way. I've done this many times myself. It works.
BUT: This ain't no efficient way of doing backups, because you backup everything, the garbage you don't need to backup as also all empty sectors. A 500G drive containing 102G of stuff needs 500G space for the image - and you're waiting hours to "save" 400G empty space 😁.
It's just for saving the state of a whole drive, which you're not going to use for quite a while, and which cannot be backupped otherwise, as I said, for Windows partitions. But it's nothing senseful, neither reasonable, nor useful, nor needed, nor recommended to do that with any unix[like] (BSD, or Linux). Just a waste of time and space producing not useful BU. Because when you restore them, you enter the time machine, and go back to the state when the BU was made... months ago, if not years, and anything you made in between is not contained on that copy; because how often do you BUs that last app. six or twelve hours for a 1T drive, even longer for larger drives? - Uh, and yeah, the system has to be stopped at this time, need to boot a live system instead to do the BU/restore, because the drive you want to BU needs to be not in use - so not really practically usable.
But also I recommend not to BU your Windows partition(s), at least not the main one. Better remove that drive from your machine as it is, store it at a safe place, and spend your machine another, unused drive, maybe a new one instead. Does not have to be large (128...256G was fully sufficient; since larger amounts of your data you don't need everyday (pictures, music, movies,...) you better place not in /home/ but better on another extra drive only for that (or an NAS, if you not already have such.)
AND BUT: With using dd for BU drives you always write all blocks of the whole drive. This does not only last long. With SSDs you're wasting many write cycles uselessly.
So: Doable, but not recommendable.
Also, this information is pushing me towards the decision to completely get rid of both Windows10 and Ubuntu.
Good choice. But ensure you have full 1:1 BU of your Windows system - any old system you ever used, or as I said, store the drive itself at a safe place. By experience you will sooner or later need the one or the other file you saved there. Don't burn that bridge, until you are fully and completely moved to your new system, and being absolutely sure for some years, there is nothing left you may miss. (You can mount [almost] any kind of filesystem from other OS to your FreeBSD [by USB adapter for example] and have access to that drives.)
It makes sense that a simplified system would be a more stable system.
That's true, but it's not what I meant. FreeBSD ain't more stable, because it's simplified, but because it's sophisticated. 😁
What I meant was: There are possibilities to install more than one OS on one drive. Many do have Windows, FreeBSD, several Linux... on one drive. So did I once. For that a bootloader is needed. While I run FreeBSD only exclusively, I think FreeBSD's bootloader may be also capable of doing that, but I don't know, and while Windows for sure is not, GRUB is commonly the most used one for that. Last time I checked it was not really trivial as I knew it twenty years ago - Those "Linux guys" have to bloat everything to a most complicated level 😂.
Anyway I highly recommend to do a full BU of your drive first (dd), or better start on a blank extra drive all over, before you start even think of tinkering with bootloaders at all. If you are not experienced, and do a mistake, you can wipe your drive, and all what's installed with it.
The fact that I no longer have to be concerned with the MBR seems completely incomprehensible to me. For years I have always lived in fear of not being able to fix my MBR, but now it doesn't seem to be an issue.
You and me both. In my Windows days I had a DVD, later USB thumb drive with gparted live by hand, and several HDDs with USB to SATA Adapters, and made the DJ by backing up whole drives over night, sometimes even whole weekends. 😂
So I can comprehend it's hard to let go. But with FreeBSD (any BSD, or Linux) you don't need that anymore. All you need are copies of the files. 😎
I have a lot to learn.
Yes. And it will never end, neither you can learn everything. But don't panic!
When you have BUs you can rely on to restore from, when you messed up things (and you will. 😁), nothing serious can really happen. Feel free to experiment as you like. Do crazy stuff, if you like!
Apart from that all you need is a start where to begin. While I mentioned one above I think was a good, solid start, others will give you other ideas... - this forums is full of newbie question, and what, and how to start. Browse to see other ideas.
FreeBSD is a solid fundamental base system, very flexible, very adaptable, and above all extremely powerful, and very sophisticated, bringing decades of knowledge and experience in computer science.
The "difficulty" with FreeBSD is, even if it's already a full complete OS you can do a lot with (my server in the attic runs a default basic installation with only three packages installed: samba, vim, and svn) at the same time it's a large, almost empty sheet of paper - a very, very large paper. And only you can know, what you want to write or paint on it. 😎
Most things are not really that complicated, and most is well documented. It's just simply a lot of stuff you need to pick from what you need, and want.
Because while Ubuntu seems a bit like FreeBSD on the surface, they are not the same,
They are not. But likewise. FreeBSD comes from BSD, I call it the "West Coast Unix", while Ubuntu is a Linux, which was once made copying some things to do like Unix.
While Unix is a protected name, BSD are not allowed to be named that, even if they were some kind of it. See Unix, the graph at the top right (yes, the german site. you only need the picture. you may read the text on the english site.)
it never crashed or seldom became unstable
Any unix[like] is very stable, including Mac OS.
But why those are stable, or better, why Windows is - was not that stable (95, 98 were terrible! But since XP it became (almost) pretty stable [I stopped using it with 7; can't tell anything about 8, 10 or 11) is another story maybe told in another place another time by others who can tell better.
I admit that I have a bad habit of taking shortcuts, without sometimes really understanding what I'm doing.
No excuses needed. That's not really a bad habit. Everybody does them. Often enough things simply need to be done quickly. And it's also a good way to learn: Just copy paste a template, see something works, and then learn by the example, how it works. I also often don't read all manpages completely top-down, but take a glimpse at the header, skim fast through it, and look at the examples at the bottom. From that I work myself up again, search for a certain option, if there is no example for what I need exactly - if I find it usable.
IMO besides some basics (installation, shell usage and BU) you only need to learn two kinds of things:
1. Things you want to do otherwise, or modify.
2. Curiosity

A bad habit was to do shortcuts only, and don't try to learn anything at all.

But I have the feeling, you're doing it right.
So, enough by me. There are others which can tell you more/better/other, and above all, hanging in the forums does not get the things done. 🥸😁😎😂:beer:
 
Well, it sounds like I still have a lot to learn, and clearly I still have a lot of faulty conceptions about how FreeBSD works. - However, what would happen if I tried to use the dd command to restore my image file back to the original hard drive it was copied from?
You will end up with corrupted GPT scheme because you will miss the secondary GPT header at the end of the disk. You can restore it using gpart recover
But again, making a image of the ESP partition using "dd" is not needed at all. If you check my previous post for how to restore the backup you will see the instructions how to recreate the ESP partition.

Code:
Clear any partition if they exist on disk da0
gpart destroy -F da0

Create new GPT partition scheme
gpart create -s gpt da0

Create 300MB ESP partition
gpart add -t efi -s 300M da0

Format the ESP partition with FAT32
newfs_msdos -F 32 -c 1 /dev/da0p1

Create a mount point for the ESP partition
mkdir /tmp/ESP

Mount the ESP partition to the mount point
mount -t msdosfs /dev/da0p1 /tmp/ESP/

Create EFI boot directory struction. This is the default search path for x64 when there's no UEFI variable specified.
mkdir -p /tmp/ESP/EFI/BOOT

Copy the EFI loader as the default BOOTx64.efi. This will work on all motherboards which follows Intel UEFI spec. You can have other EFI programs or loaders like Memtest or otherdiagnostic tools into the ESP partition which can be loaded during the boot. 
cp /boot/loader.efi /tmp/ESP/EFI/BOOT/BOOTx64.efi

Create a new UEFI record and set it as default boot. 
efibootmgr --create --activate --label "FreeBSD" --loader /tmp/ESP/EFI/BOOT/BOOTx64.efi
 
But also I recommend not to BU your Windows partition(s), at least not the main one
Unfortunately, when I make the jump from Windows, I'm probably going to have to use that particular drive for my real installation of FreeBSD using ZFS, because the drive I have FreeBSD installed on right now is approximately ten years old, and although it doesn't seem to have bad sectors, I know that all mechanical hardrives die sooner or later, and this one is probably closer to the end of its life than it is to the beginning of it.

Initially I was thinking about using the dd command to make an image of /dev/ada0p2 (my root partitioin) onto a second hardrive I'm planning on formating with ZFS, but maybe that isn't such a good idea after all, and maybe I'm better off using the second hard drive to store copies of directories I will made with rysnc. That way, hopefully if I have a disaster, I will be able to boot from a live FreeBSD USB, and then use these files stored on the second physical drive.
 
But I have the feeling, you're doing it right.
I'm the sort of person who enjoys beating his head against the wall until the wall eventually breaks. I feel as though I'm learning slowly, and I think within a few weeks I will be a little more confident with FreeBSD. This coming weekend I will try doing an installation of FreeBSD using ZFS, and if I'm able to copy my settings into the new installation without too much trouble, then FreeBSD and I are going to be husband and wife until death do us part.
 
I know that all mechanical hardrives die sooner or later,
ALL hardware dies sooner or later, either by age, or accident.
But you don't know when. It's all just statistic probability.
One ten year old HDD may live on thirty years, or fail tomorrow. A new drive may fail after a half year.
Sure, that's seldom, but not impossible. And of course it's a case for a warranty claim. You get an exchange drive, or your money back. But not your data written to it, no matter how worthless or crucial important it was to you.
Hence BUs, redundant BUs for important stuff, and hardware redundancy like mirrors, or RAID.
 
ALL hardware dies sooner or later, either by age, or accident.
But you don't know when. It's all just statistic probability.
One ten year old HDD may live on thirty years, or fail tomorrow. A new drive may fail after a half year.
Sure, that's seldom, but not impossible. And of course it's a case for a warranty claim. You get an exchange drive, or your money back. But not your data written to it, no matter how worthless or crucial important it was to you.
Hence BUs, redundant BUs for important stuff, and hardware redundancy like mirrors, or RAID.
Backup is important, but having some method of identifying corruption is also important. It's the main reason that I like ZFS as scrubbing it can identify the damage, and if it's a redundant set up repair it. Otherwise, I'll use par2 to create parity information that can be used to identify and repair damage.

That's a large part of why I use HDDs for local backups rather than other options, it's a lot easier to verify the backups than most other options.
 
but having some method of identifying corruption is also important. It's the main reason that I like ZFS as scrubbing
You are right, and I am fully aware of that, but looking at what this thread is about in its very core, I didn't want to dive into details too deep.

My main intension here were to convince the OP - build trust in - BU are not very important, but mandatory, one of the very first things need to be realized as part of setting up a system, on reliable hardware, not some cheap and milked to death thumb drive. And that BUs not need to have the most sophisticated masterplan with complex fine-tuned scripts, at least not for the start, and that on open source OSs one does not need to care about saving neither the MBR, nor efi partitions, nor whole drive images. So I mentioned mirror or RAID only en passant, which take care of both: increase protection against hardware failure, and correcting data corruption. At least with ZFS, which, when you have access to it, was the only reasonable way to use mirrors or RAID configs anyway - at least to me.
While at the same time I was trying not to dive too deep into details, producing more confusion by giving too much information, open too many possibilities at the same time, than providing real help for a beginner, who not only just installed FreeBSD but a non-turn key open source OS at the first time.

Seeing his other thread, he already switched to ZFS. So he already benefits from this, without the need to care about it how it works in detail, at least not for the start.
That's a large part of why I use HDDs for local backups rather than other options, it's a lot easier to verify the backups than most other options.
Most of my storage capacity also is on HDDs, for the same reason, and simply because I'm more used to how to deal with them. To me HDDs feel less complicated and more reliable than SSDs [beancounters prevention: that's why I said "feel". I know the benefits of SSDs over HDDs.]
Plus they simply cost less B/$, while for my needs their speed is way more than sufficient to me.
The system on my workstation is on a NVMe mirror, but my server is completely on HDDs. Just compare the price for to build a 9 drives RAID server with 15T on HDDs or SSDs. 😁
 
Well, I temporarily installed another one terabyte Seagate Barracuda internal hard drive into my PC, and then I did another installation of FreeBSD onto that drive. After the installation I did a reboot, then I mounted the UFS formatted USB thumb drive which contains all of the directories I had earlier backed up using rsync. Next, I entered the below command, and typed, yes. (Also, that is where I mounted my thumb drive.)

Code:
cat pkglist | xargs pkg /media/da0p1/backup/install

However, for the past hour or so, I've been watching a column of "y" streaming down on the left side of my monitor, with no end in sight. Also, there doesn't seem to be much hard drive activity, which makes me wonder if something has glitched out somewhere. How long should I wait before I hit Ctrl C to try and stop it?
 
Well, the good news is that I'm using the new installation of FreeBSD located on hard drive I installed today, but things didn't go as smoothly as I had hoped that they would.

For example, the process of using rsync to restore the files from my USB thumb drive went smoothly, but the process of reinstalling my packages didn't really work at all. It seemed that I had partial success by moving the file containing package list to my root directory, and then executing the below command.

Code:
cat /package_list.txt | xargs pkg instal

But as near as I can tell, nothing actually got installed after sitting there and watching the hard drive light blink for over an hour. Hmmm.... Incidentally, below is a list of the items listed within package_list.txt

Code:
FreeBSD-kernel-generic
FreeBSD-kernel-generic-dbg
FreeBSD-set-base
FreeBSD-set-lib32
FreeBSD-set-minimal
bsdinfo
chromium
cpufetch
en-freebsd-doc
firefox
gedit
gimp
gutenprint
i7z
inxi
libreoffice
lightdm
lightdm-gtk-greeter
mc
neofetch
nvidia-drm-kmod
nvidia-settings
nvidia-xconfig
pfetch
pinta
pkg
pwcview
py311-pdfarranger
qt5-style-plugins
rsync
sane-backends
screenFetch-nox11
skanlite
ufetch
v4l-utils
v4l_compat
vlc
webcamd
xfce
xfce4-cpugraph-plugin
xfce4-pulseaudio-plugin
xfce4-screenshooter-plugin
xmahjongg
xorg
xsane

However, after entering "package info" in the terminal, none of the items on the above list appeared in the list of installed packages.

Another strange thing is that I cannot log into my old user account from the previous hard drive, so I had to add a new user in single user mode.

I think that this method could work, if I could just overcome the problem with the packages not installing, and also figure out why I cannot log into my original account.

Well, I'm learning, slowly but surely.
 
I can confirm that the below command seemed to reinstall all of the packages from the other FreeBSD installation living on a completely different hard drive.


Code:
xargs pkg install -y < package_list.txt
 
I can confirm that the below command seemed to reinstall all of the packages from the other FreeBSD installation living on a completely different hard drive.


Code:
xargs pkg install -y < package_list.txt

That's pretty cool!

I prefer having a list on a website copy/paste; this is what I'd do on any computer for desktop-use:
Code:
pkg install evince-lite filezilla foliate gbrainy gimp keepassxc libreoffice mate-calc ristretto thunar-archive-plugin thunderbird-esr transmission-gtk vlc xfce4-screensaver xfce4-screenshooter-plugin xfce4-whiskermenu-plugin android-tools aria2 cups en-freebsd-doc en-hunspell gnome-keyring gstreamer1-plugins-good gstreamer1-plugins-ugly gstreamer1-libav gtk-sharp30 htop libressl mesa-demos mesa-dri mesa-devel mesa-libs noto unar wget xarchiver xrandr yt-dlp

If I'm installing in a rush (don't want to wait for extra stuff to download) or might not want Wine, I have it separate but can paste it onto that above line too:
Code:
wine-devel wine-gecko-devel wine-mono-devel winetricks icoutils
 
Well, after using rsync to restore certain directories I had earlier backed up to a USB thumb drive, I could never log into any of the accounts I had created on the previous installation of FreeBSD. I tried changing the password, and deleting temp files, and I tried changing the default shell, but nothing worked. So, this method will give you a desktop with all of your old packages, but you just cannot get into any of your old accounts. Looks like I will have to think about this one for awhile.
 
Well, I made a major discovery today. I realized that every time I tried to login into Xfce, the monitor would flicker a little bit, as if it were about to load my regular desktop, but then I would be returned back to the login screen where I started. There were no messages about incorrect password, my screen was simply returning to the login screen as if nothing had happened.

I tried playing around with the password settings, but that didn't really seem to do anything at all. However, what did the trick was changing the permissions for /home/user and giving my regular user permission to read and write to this particular directory fixed my login problems, and I can now login with the same password which I was using on my earlier installation of FreeBSD on a different drive. So, huge progress, but now I'm not certain that rsync is the best way to go about recovering from a disaster.

Also, when I first logged into this "recovered" installation of FreeBSD, pulseaudio, the printer, and webcam didn't want to work. I have since gotten the audio and webcam to work, but the printer and scanner absolutely refuse to cooperate. It shows up in usbconfig, and it is listed under http://localhost:631/admin. I'm guessing some sort of permission issue must be stopping my printer and scanner from working, but where......
 
Okay, so I got my printer/scanner to working by first removing it under http://localhost:631/admin, and then reinstalling it again. so now my peripheral stuff is working again, just like in the original installation which I copied the directories from, but I'm not certain that I would want to do this again in an emergency, but for someone like me, who is still very new, this may be better than nothing, and in the end it worked. So, below is a quick recap of what I've done to get to this point.

1. With the hard drive containing my original installation still in my computer, I ran the below command to make a list of all the packages installed on my machine, and to store that list into a file called,package_list.txt, in a directory named "backup" located on my USB thumb drive . I dont' know, it seemed to work better with the txt extension at the end of it.

Code:
pkg prime-list > /media/da0p1/backup/package_list.txt

2. Next, I used the below set of commands to copy certain directories to my USB thumb drive:

Code:
rsync -avh --progress /boot/loader.conf /media/da0p1/backup/boot
rsync -avh --progress /usr/local/etc /media/da0p1/backup/usr/local
rsync -avh --progress /home /media/da0p1/backup/
rsync -avh --progress /etc /media/da0p1/backup/

3. Next, I installed a different hard drive into my PC, and I did a fresh installation of FreeBSD. I did not create any users, and I used the same root password as the original installation.

4. Next, I copied the entire backup directory from my USB thumb drive, to the root directory of my hard drive. Then I copied the file named, package_list.txt from the backup directory into the root directory. After that I entered the below command, and it seemed to take about an hour to download and install all of the packages. This would only seem to work if the list were located in root. Also, on my first attempt I forgot to bootstrap pkg, and that caused the process to freeze with a column of "y" on the left edge of the screen. So bootstrap and update before doing the below.

Code:
cat /package_list.txt | xargs pkg install

5. After rebooting I pressed Ctrl+Alt+F2 to get into a different terminal. I logged into root, and then I issued the below command to change the permissions for /home/user. Unfortunately I don't remember the exact command, but I think that it was chmod -R 775 /home/user.

6. I rebooted, and then I was able log into the account I created on my other hard drive, but some of my equipment such as webcam, printer, and sound didn't work at first.
 
Back
Top