UFS How to migrate installed FreeBSD from HDD to SSD?

Hi dear friends 🌹
I bought a "Samsung 870 EVO 500GB 2.5 Inch SATA III Internal" SSD and I want to transfer installed FreeBSD from my hard disk drive to SSD (without reinstall the system).

I want the whole operating system, all software, files and configs to be completely transferred to SSD except one directory that contains many videos, books, musics and etc... how can I do that?

My OS version is "FreeBSD 13.0-RELEASE-p7 amd64" and file system is "UFS".

P.S. I read handbook/disks and many topics in the forum. comments were very different and I didn't get it. I'm very worried that my files will be damage.
I wanted to use DD(1) but users some said it's not good.
I'd really appreciate for any help and thank you for taking the time.
Sorry if my topic is repetitive or inappropriate.
With respect
 
first choose if you want to stay with UFS or go ZFS
then create partitions,,filesystems install bootcode,transfer data with whatever tool you want, tar is probably the easiest

if this sounds complicated remove the old disk and install freebsd from scratch on the new one
boot from the old one and transfer everything needed no the new one
remove the old one
this way you don't have to mess with gpart, boot code, efi, etc
 
Thanks for all replies. I put SSD in the computer case. But the system does not boot.
I see this message:
 

Attachments

  • ۲۰۲۲۰۳۰۸_۲۱۱۳۰۸.jpg
    ۲۰۲۲۰۳۰۸_۲۱۱۳۰۸.jpg
    1.1 MB · Views: 143
I didn't change boot device and default is my main hard drive now.
 

Attachments

  • 16467619525315093817730162073213.jpg
    16467619525315093817730162073213.jpg
    751.7 KB · Views: 106
What's at da0?

Can you disconnect that, before attempting to boot from ada0? Or is ada0 the empty SSD?
Thanks. I disconnect DVD ROM cables, then external HDD, nothing happened. When I disconnected SSD cables my system came up without any problem. I can use my system now but without SSD.
 
You have to do quite a few steps. Configure your system such that it will continue to boot from the HDD, and continue to use the HDD as the root file system, even when a new disk is added. That's the "edit fstab" step covecat alluded to. Better idea: Put partition labels on all the partitions of your old disk, and then consistently use those in fstab.

Next step: Add the SSD hardware, and work with your BIOS (which I don't know) so it continues to boot from the HDD.

Then create a bootable layout on the SSD. That involves adding boot blocks, and setting up the root file system (and perhaps other file systems) on it. We discussed the second question above (you could either dump/restore the file system from HDD to SSD), or you can install a new OS image on the SSD.

Finally, tell your BIOS to boot from the SSD.
 
As you can see SSD is installed correctly.
 

Attachments

  • ۲۰۲۲۰۳۰۸_۲۱۴۸۳۰.jpg
    ۲۰۲۲۰۳۰۸_۲۱۴۸۳۰.jpg
    1.2 MB · Views: 106
  • ۲۰۲۲۰۳۰۸_۲۱۴۹۱۶.jpg
    ۲۰۲۲۰۳۰۸_۲۱۴۹۱۶.jpg
    1.4 MB · Views: 109
ufs:/dev/ada1s1a
Thank you so much! this command solved my problem and my system came up with SSD.

This is my partitions now:

2022-03-08-222918_1024x768_scrot.png


I mounted my external hard drive with this command:
sudo mount_msdosfs /dev/da0s1 /media/usb
But don't know what to do to mount SSD.
 
I mounted SSD drive using sade but still can't see and use it.
After using "lsblk" I don't see unmounted message anymore.
Even my external hard drive mount automatically cause I used Automounting Removable Media.
when I run this command:
$ cat /var/run/dmesg.boot
I see this:
ada0: <Samsung SSD 870 EVO 500GB SVT01B6Q> ACS-4 ATA SATA 3.x device
But when I run this command:
$ ls /dev/da*
what I see is:
/dev/da0
and
/dev/da0s1

Guys I'm stuck here. I spent hours to solve this but I couldn't!
 
Why not just format the SSD, then use a basic File Manager to transfer the files that way? Quick and easy.

Otherwise, SirDice already gave you a solution, given your file system choice.
 
The problem I face is that I can't mount ada0s1.
# mount /dev/ada0s1 /media/ssd

I get this error:
mount: /dev/ada0s1: No such file or directory

Beastie7 I want do that but still stuck in this issue and I have to mount drive, before using dump or restore.

2022-03-09-035355_1024x768_scrot.png
 
The problem I face is that I can't mount ada0s1.
# mount /dev/ada0s1 /media/ssd

I get this error:
mount: /dev/ada0s1: No such file or directory

Beastie7 I want do that but still stuck in this issue and I have to mount drive, before using dump or restore.

View attachment 13250

The drive is still naked. You'll have to partition, then format the drive before you can mount it.

try this:

gpart create -s GPT ada0

then

gpart add -t freebsd-ufs -a 1M ada0

after that you can format the drive and mount it

newfs -U /dev/ada0

mount /dev/ada0 /mnt or /media

if you want it mounted upon boot, add it to your fs table.
 
It looks like your original system disk was ada1, 1TB in size, and it is using MBR partitioning.

Your new SSD appears to be ada0, 500GB in size, with no partitioning.

You have a USB hard drive, da0, of 1TB. It's got an msdos file system, so not relevant.

Your new SSD is half the size of your original boot disk. How much free space do you have on your existing system disk? You must have at least ~500GB free...

You need to partition your new SSD. The handbook offers little assistance with MBR-only partitioning. That's a shame.

Enumerate your disks and make sure that you know which is which:
Code:
sudo camcontrol devlist
sudo camcontrol identify ada0
The FreeBSD Handbook is lamentably shallow on detail for disk partitioning.

However, Warren Block's Disk Setup On FreeBSD is an excellent reference.

You can stick with MBR partitioning if you wish. But do consider a switch to the newer (and current) GPT method. Warren has them both covered in detail.

Once you have your new disk partitioned, I suggest you look at using dump and restore to copy your file system, as suggested by SirDice.
Warren also has an excellent document on how to use dump and restore to copy file systems.

When you have the root copied to SSD, edit /mnt/etc/fstab on the new root to reflect the use of ada0, and not ada1, before you try to boot it.

You will also need to change the boot order in the BIOS.
 

Phishfry I did what you said but I got this error:​

mount: /media/ssd: No such file or directory

even I tried this in my home directory:
# mount /dev/ada0s1a newfolder

and I got this error:
mount: /dev/ada0s1a: No such file or directory
 
Beastie7 I exactly did what you did and and only one folder called .snap has been created in /mnt that that there's nothing in it.
Please see log:
Code:
hbsd@freebsd:~ $ sudo su
Password:
[root@freebsd /usr/home/hbsd]# gpart create -s GPT ada0
ada0 created
[root@freebsd /usr/home/hbsd]# gpart add -t freebsd-ufs -a 1M ada0
ada0p1 added
[root@freebsd /usr/home/hbsd]# newfs -U /dev/ada0
/dev/ada0: 476940.0MB (976773168 sectors) block size 32768, fragment size 4096
    using 763 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
    with soft updates
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224,
 12804672, 14085120, 15365568, 16646016, 17926464, 19206912, 20487360, 21767808, 23048256,
 24328704, 25609152, 26889600, 28170048, 29450496, 30730944, 32011392, 33291840, 34572288,
 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,
 47376768, 48657216, 49937664, 51218112, 52498560, 53779008, 55059456, 56339904, 57620352,
 58900800, 60181248, 61461696, 62742144, 64022592, 65303040, 66583488, 67863936, 69144384,
 70424832, 71705280, 72985728, 74266176, 75546624, 76827072, 78107520, 79387968, 80668416,
 81948864, 83229312, 84509760, 85790208, 87070656, 88351104, 89631552, 90912000, 92192448,
 93472896, 94753344, 96033792, 97314240, 98594688, 99875136, 101155584, 102436032,
 103716480, 104996928, 106277376, 107557824, 108838272, 110118720, 111399168, 112679616,
 113960064, 115240512, 116520960, 117801408, 119081856, 120362304, 121642752, 122923200,
 124203648, 125484096, 126764544, 128044992, 129325440, 130605888, 131886336, 133166784,
 134447232, 135727680, 137008128, 138288576, 139569024, 140849472, 142129920, 143410368,
 144690816, 145971264, 147251712, 148532160, 149812608, 151093056, 152373504, 153653952,
 154934400, 156214848, 157495296, 158775744, 160056192, 161336640, 162617088, 163897536,
 165177984, 166458432, 167738880, 169019328, 170299776, 171580224, 172860672, 174141120,
 175421568, 176702016, 177982464, 179262912, 180543360, 181823808, 183104256, 184384704,
 185665152, 186945600, 188226048, 189506496, 190786944, 192067392, 193347840, 194628288,
 195908736, 197189184, 198469632, 199750080, 201030528, 202310976, 203591424, 204871872,
 206152320, 207432768, 208713216, 209993664, 211274112, 212554560, 213835008, 215115456,
 216395904, 217676352, 218956800, 220237248, 221517696, 222798144, 224078592, 225359040,
 226639488, 227919936, 229200384, 230480832, 231761280, 233041728, 234322176, 235602624,
 236883072, 238163520, 239443968, 240724416, 242004864, 243285312, 244565760, 245846208,
 247126656, 248407104, 249687552, 250968000, 252248448, 253528896, 254809344, 256089792,
 257370240, 258650688, 259931136, 261211584, 262492032, 263772480, 265052928, 266333376,
 267613824, 268894272, 270174720, 271455168, 272735616, 274016064, 275296512, 276576960,
 277857408, 279137856, 280418304, 281698752, 282979200, 284259648, 285540096, 286820544,
 288100992, 289381440, 290661888, 291942336, 293222784, 294503232, 295783680, 297064128,
 298344576, 299625024, 300905472, 302185920, 303466368, 304746816, 306027264, 307307712,
 308588160, 309868608, 311149056, 312429504, 313709952, 314990400, 316270848, 317551296,
 318831744, 320112192, 321392640, 322673088, 323953536, 325233984, 326514432, 327794880,
 329075328, 330355776, 331636224, 332916672, 334197120, 335477568, 336758016, 338038464,
 339318912, 340599360, 341879808, 343160256, 344440704, 345721152, 347001600, 348282048,
 349562496, 350842944, 352123392, 353403840, 354684288, 355964736, 357245184, 358525632,
 359806080, 361086528, 362366976, 363647424, 364927872, 366208320, 367488768, 368769216,
 370049664, 371330112, 372610560, 373891008, 375171456, 376451904, 377732352, 379012800,
 380293248, 381573696, 382854144, 384134592, 385415040, 386695488, 387975936, 389256384,
 390536832, 391817280, 393097728, 394378176, 395658624, 396939072, 398219520, 399499968,
 400780416, 402060864, 403341312, 404621760, 405902208, 407182656, 408463104, 409743552,
 411024000, 412304448, 413584896, 414865344, 416145792, 417426240, 418706688, 419987136,
 421267584, 422548032, 423828480, 425108928, 426389376, 427669824, 428950272, 430230720,
 431511168, 432791616, 434072064, 435352512, 436632960, 437913408, 439193856, 440474304,
 441754752, 443035200, 444315648, 445596096, 446876544, 448156992, 449437440, 450717888,
 451998336, 453278784, 454559232, 455839680, 457120128, 458400576, 459681024, 460961472,
 462241920, 463522368, 464802816, 466083264, 467363712, 468644160, 469924608, 471205056,
 472485504, 473765952, 475046400, 476326848, 477607296, 478887744, 480168192, 481448640,
 482729088, 484009536, 485289984, 486570432, 487850880, 489131328, 490411776, 491692224,
 492972672, 494253120, 495533568, 496814016, 498094464, 499374912, 500655360, 501935808,
 503216256, 504496704, 505777152, 507057600, 508338048, 509618496, 510898944, 512179392,
 513459840, 514740288, 516020736, 517301184, 518581632, 519862080, 521142528, 522422976,
 523703424, 524983872, 526264320, 527544768, 528825216, 530105664, 531386112, 532666560,
 533947008, 535227456, 536507904, 537788352, 539068800, 540349248, 541629696, 542910144,
 544190592, 545471040, 546751488, 548031936, 549312384, 550592832, 551873280, 553153728,
 554434176, 555714624, 556995072, 558275520, 559555968, 560836416, 562116864, 563397312,
 564677760, 565958208, 567238656, 568519104, 569799552, 571080000, 572360448, 573640896,
 574921344, 576201792, 577482240, 578762688, 580043136, 581323584, 582604032, 583884480,
 585164928, 586445376, 587725824, 589006272, 590286720, 591567168, 592847616, 594128064,
 595408512, 596688960, 597969408, 599249856, 600530304, 601810752, 603091200, 604371648,
 605652096, 606932544, 608212992, 609493440, 610773888, 612054336, 613334784, 614615232,
 615895680, 617176128, 618456576, 619737024, 621017472, 622297920, 623578368, 624858816,
 626139264, 627419712, 628700160, 629980608, 631261056, 632541504, 633821952, 635102400,
 636382848, 637663296, 638943744, 640224192, 641504640, 642785088, 644065536, 645345984,
 646626432, 647906880, 649187328, 650467776, 651748224, 653028672, 654309120, 655589568,
 656870016, 658150464, 659430912, 660711360, 661991808, 663272256, 664552704, 665833152,
 667113600, 668394048, 669674496, 670954944, 672235392, 673515840, 674796288, 676076736,
 677357184, 678637632, 679918080, 681198528, 682478976, 683759424, 685039872, 686320320,
 687600768, 688881216, 690161664, 691442112, 692722560, 694003008, 695283456, 696563904,
 697844352, 699124800, 700405248, 701685696, 702966144, 704246592, 705527040, 706807488,
 708087936, 709368384, 710648832, 711929280, 713209728, 714490176, 715770624, 717051072,
 718331520, 719611968, 720892416, 722172864, 723453312, 724733760, 726014208, 727294656,
 728575104, 729855552, 731136000, 732416448, 733696896, 734977344, 736257792, 737538240,
 738818688, 740099136, 741379584, 742660032, 743940480, 745220928, 746501376, 747781824,
 749062272, 750342720, 751623168, 752903616, 754184064, 755464512, 756744960, 758025408,
 759305856, 760586304, 761866752, 763147200, 764427648, 765708096, 766988544, 768268992,
 769549440, 770829888, 772110336, 773390784, 774671232, 775951680, 777232128, 778512576,
 779793024, 781073472, 782353920, 783634368, 784914816, 786195264, 787475712, 788756160,
 790036608, 791317056, 792597504, 793877952, 795158400, 796438848, 797719296, 798999744,
 800280192, 801560640, 802841088, 804121536, 805401984, 806682432, 807962880, 809243328,
 810523776, 811804224, 813084672, 814365120, 815645568, 816926016, 818206464, 819486912,
 820767360, 822047808, 823328256, 824608704, 825889152, 827169600, 828450048, 829730496,
 831010944, 832291392, 833571840, 834852288, 836132736, 837413184, 838693632, 839974080,
 841254528, 842534976, 843815424, 845095872, 846376320, 847656768, 848937216, 850217664,
 851498112, 852778560, 854059008, 855339456, 856619904, 857900352, 859180800, 860461248,
 861741696, 863022144, 864302592, 865583040, 866863488, 868143936, 869424384, 870704832,
 871985280, 873265728, 874546176, 875826624, 877107072, 878387520, 879667968, 880948416,
 882228864, 883509312, 884789760, 886070208, 887350656, 888631104, 889911552, 891192000,
 892472448, 893752896, 895033344, 896313792, 897594240, 898874688, 900155136, 901435584,
 902716032, 903996480, 905276928, 906557376, 907837824, 909118272, 910398720, 911679168,
 912959616, 914240064, 915520512, 916800960, 918081408, 919361856, 920642304, 921922752,
 923203200, 924483648, 925764096, 927044544, 928324992, 929605440, 930885888, 932166336,
 933446784, 934727232, 936007680, 937288128, 938568576, 939849024, 941129472, 942409920,
 943690368, 944970816, 946251264, 947531712, 948812160, 950092608, 951373056, 952653504,
 953933952, 955214400, 956494848, 957775296, 959055744, 960336192, 961616640, 962897088,
 964177536, 965457984, 966738432, 968018880, 969299328, 970579776, 971860224, 973140672,
 974421120, 975701568
[root@freebsd /usr/home/hbsd]# mount /dev/ada0 /mnt
 
Back
Top