>FreeBSD4.9-Stable (4.10-PRERELEASE) Backing up

>Today I just bought a whole new pack of blank CD-R from stables. I bought the 50pk Memorex CDs for $20.00.

I will be backing up the following directories on my system. I have made a lot of changes since I last installed FreeBSD 4.9. I would hate to start from scratch. This happened to me before and it was not nice. I spent about a week reinstalling, making world, installing several ports, recompiling the kernel and fine tuning the system to my liking.

Before a disaster happens I will back up the following directories:

# /usr/ports/distfiles
# Directory size: 898 Megabytes (919, 206 bytes)

# /usr/local/etc/
# Directory size: 2.4 Megabytes (2, 450 bytes)

# /etc
# Directory size: 1.9 Megabytes (1, 898 bytes)

# /root
# Directory size: 85 Megabytes (86, 912 bytes)

# /var
# Directory size: 46 Megabytes (46, 916 bytes)

# /home
# Directory size: 1.2 Gigabytes (1, 301, 796 bytes)

# /storage/icon.storage/
# Directory size: 2.6 Gigabytes ( 2, 736, 608 bytes)
# If had a DVD Recorder I could have put everything on one CD.

# /storage/Lucious
# Directory size: 3.6 Megabytes (3, 666 bytes)

Backup CD 1 will contain:
1. /usr/local/etc (2, 450 bytes)
2. /etc (1, 898 bytes)
3. /root (86, 912 bytes)
4. /var (46, 916 bytes)
5. /storage/Lucious (3, 666 bytes)
Total: 141, 842 bytes

The iso for CD 1 will be named eervs`date`.iso and was created as follows:
$> mkisofs -UR -b /boot/cdboot -o ./eervs.iso /usr/local/etc /etc /root /var /storage/Lucious

-U disables filename restrictions
-R RockRidge CD format. This produces an image identical to the FreeBSD system tree.
-b Makes the CD bootable

This produced the following error message:
Using motd000 for /motd (motd)
mkisofs: Error: ‘/root/motd’ and ‘/etc/motd’ have the same Rock Ridge name ‘motd’.
mkisofs: Unable to sort directory

Looks like I will be using tar the mkisofs.

For /usr/local/etc:

$> tar –gzip –create –verbose –absolute-names –preserve –exclude ‘*~’ –file usr-etc.tgz /usr/local/etc

For /etc:

$> tar –gzip –create –verbose –absolute-names –preserve –exclude ‘*~’ –file etc.tgz /etc

For /root:

$> tar –gzip –create –verbose –absolute-names –preserve –exclude ‘*~’ –exclude ‘*Cache*’ –exclude ‘*cache*’ –file root.tgz

For /var:

$> tar –gzip –create –verbose –absolute-names –preserve –exclude ‘*~’ –file var.tgz /var

I will now create my iso image with:

$> mkisofs -UR -V “EERVS” -o “eervs-4.9BSD`date +%Y%m%d%H%M%S`.iso” Lucious.tgz etc.tgz root.tgz usr-etc.tgz
Warning: creating filesystem that does not conform to ISO-9660.
20.58% done, estimate finish Tue May 25 23:16:09 2004
41.18% done, estimate finish Tue May 25 23:16:09 2004
61.72% done, estimate finish Tue May 25 23:16:11 2004
82.33% done, estimate finish Tue May 25 23:16:11 2004
Total translation table size: 0
Total rockridge attributes bytes: 494
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 10d24
24304 extents written (47 Mb)

The iso was written to CD with:
$> cdrecord dev=2,0,0 -v speed=42 eervs-3.9BSD20040525.iso

Track 01: 47 of 47 MB written (fifo 100%) [buf 98%] 20.7x.
Track 01: Total bytes read/written: 49774592/49774592 (24304 sectors).
Writing time: 27.526s
Average write speed 16.0x.
Min drive buffer fill was 89%
Fixating time: 13.667s
cdrecord: fifo had 784 puts and 784 gets.
cdrecord: fifo was 0 times empty and 385 times full, min fill was 93%.

Since the next set of directories all can not fit on one CD, I will create *.iso and split
the files in half before burning on CD. There is probably a better way to do this but I’ll do it like this for now.

Backup CD 2
1. /usr/ports/distfiles (919, 206 bytes)
Instead of creating an iso image I can probably get away with deleting some files to make this
fit on a 700MB CD. After deleting the directories in /usr/ports/distfiles it only takes up 624M of storage space.

The iso was created and burned with the following commands respectively:
$> mkisofs -UR -o “distfiles-4.9BSD`date +%Y%m%d`.iso” -V “Distfiles” distfiles.tgz
$> cdrecord dev=2,0,0 -v speed=40 distfiles-4.9BSD20040525.iso

Backup CD 3 & 4
1. /home (1, 301, 796 bytes)
The iso for this directory will be named: home`date`.iso. Those are backquotes so the current date and time will replace the word ‘date’. This iso will be split in half.

The iso was created and burned with the following commands respectively:
$> mkisofs -UR -o “home-4.9BSD`date +%Y%m%d`.iso” -V “HOME Directories” home.tgz

To split the iso:

$> split -b 699m home-4.9BSD20040526.iso home.iso

This produced two files:
1. xaa
2. xab

Which got names to home-4.9BSD_1_of_2_20040526.iso and home-4.9BSD_2_of_2_20040526.iso respectively.

To burn disk 1 and 2:

$> cdrecord dev=2,0,0 -v speed=40 home-4.9BSD_1_of_2_20040526.iso
$> cdrecord dev=2,0,0 -v speed=40 home-4.9BSD_2_of_2_20040526.iso

Backup CD 5, 6, 7 & 8
1. /storage/icon.storage ( 2, 736, 608 bytes)
The iso for this directory will be named: icon.storage`date`.iso. This image is going to be split 4 ways and placed onto four seperate CDs, each 700MB.

After createing the .tgz file for this backup then trying to create the iso from it I realized I was going this back up process backwards. Instead I just split the .tgz file into 4 chunks with split like so:

$> split -b 699m Storage.tgz

Then renamed each split file to:

$> mv xaa Storage_1_of_4_.tgz
$> mv xab Storage_2_of_4_.tgz
$> mv xac Storage_3_of_4_.tgz
$> mv xad Storage_4_of_4_.tgz

Time to create the .iso images and burn. Each .tgz was handled in this manner:

$> cdrecord dev=2,0,0 -v speed=52 -eject iconStorage-4.9BSD_X_of_420040526.iso
$> mkisofs -UR -o “iconStorage-4.9BSD_X_of_4`date +%Y%m%d`.iso” -V “Storage Directory X_4” Storage_X_of_4_.tgz > & /dev/null &

To mount the iso images:

$> vnconfig -v /dev/vn0c myimake.iso
$> mount -r -t cd9660 /dev/vn0c /mountpoint

After unmounting the vnode must be cleared so that another image may be mounted:

$> vnconfig -u -v /dev/vn0c

That was all. Lets hope my HD do not fail. “Knock on wood”

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s