LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2015, 07:00 PM   #1
masavini
Member
 
Registered: Jun 2008
Posts: 285

Rep: Reputation: 6
bash script for internal disk backup: grub libata.force issue...


hi,
i have a desktop pc with 2 identical disks.

1 disk is used as "main" device. the other is used for internal backup purposes: every week i clone the main disk over the backup disk using dd.

in this way, if the main drive fails i can boot the pc using the backup drive and i'm done: i can take all my time to replace the faulty drive with no issue...

however, just after the cloning process the 2 disks are identical.
this leads to a big mess while mounting /etc/fstab devices, as the partitions of the 2 drives have the same UUIDs.

to fix this, i added the following line to /etc/default/grub of the main disk:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="libata.force=2.00:disable"
and i added the following commands to the backup script:
Code:
# ... cloning stuff...

# mount backup root partition
sudo mount ${targetDisk}${rootPartitionN} mnt

# edit backup /etc/default/grub so that main disk is ignored
sudo sed -i 's/libata.force=2.00:disable/libata.force=1.00:disable/' mnt/etc/default/grub

# prepare chrooting into backup disk
for i in /dev /dev/pts /proc /sys /run; do
	sudo mount -B $i mnt$i
done

# update grub on backup disk
sudo chroot mnt update-grub
	
for i in /run /sys /proc /dev/pts /dev; do
	sudo umount mnt$i
done
sudo umount mnt
the script seems to be working fine, as the backup disk /etc/default/grub file is correctly edited.

- if both the drives are plugged in and i boot the system using the main drive, everything works fine: grub ignores the backup disk, as expected.

- if i unplug the main disk, i can boot the backup disk and everything works fine.

- but if both the drives are plugged in and i boot using the backup drive, it does not work: the screen is black, with a blinking cursor. after a few minutes the display powers off and i can only roughly power off the pc.

any suggestion?

Last edited by masavini; 03-11-2015 at 07:09 PM.
 
Old 03-12-2015, 10:41 AM   #2
fred2014
Member
 
Registered: Mar 2015
Posts: 70

Rep: Reputation: Disabled
what I do:
I have centos on 1 drive and windoze on another - both setup as bootable -
during boot - press F12 and select the drive I want. No more "grubbing" around...

Dont know if it will work for you though - give it a go.
 
Old 03-12-2015, 07:38 PM   #3
masavini
Member
 
Registered: Jun 2008
Posts: 285

Original Poster
Rep: Reputation: 6
fixed!

i found my syntax for the libata.force option was not correct.

from the kernel paramenters documentation:
Quote:
libata.force= [LIBATA] Force configurations. The format is comma
separated list of "[ID:]VAL" where ID is
PORT[.DEVICE]. PORT and DEVICE are decimal numbers
matching port, link or device. Basically, it matches
the ATA ID string printed on console by libata. If
the whole ID part is omitted, the last PORT and DEVICE
values are used. If ID hasn't been specified yet, the
configuration applies to all ports, links and devices.
in my configuration i was specifying both the PORT (n) and the DEVICE (.00). if i omit the DEVICE part, everything works fine..

so i changed the following line in /etc/default/grub of the main disk:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="libata.force=2.00:disable"
to
Code:
GRUB_CMDLINE_LINUX_DEFAULT="libata.force=2:disable"
then i edited this line in the backup script:
Code:
sudo sed -i 's/libata.force=2.00:disable/libata.force=1.00:disable/' mnt/etc/default/grub
to this:
Code:
sudo sed -i 's/libata.force=2:disable/libata.force=1:disable/' mnt/etc/default/grub

Last edited by masavini; 03-12-2015 at 07:40 PM.
 
  


Reply

Tags
backup, grub, libata



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make libata.force=1.5G work without reboot? sscn Linux - Software 2 06-07-2011 04:24 AM
Is libata.force really working? Woodsman Linux - Hardware 3 04-25-2011 09:41 AM
[SOLVED] Backup Daemons or mdadm RAID Across Internal and External HDDs? PehJota Linux - General 6 08-18-2010 07:44 AM
Vsftpd: Internal / External IP Issue kerryblue19 Linux - Networking 1 02-16-2009 04:43 PM
10.2 install detects my external hard disks but not my internal one bmccrac02 Slackware - Installation 4 01-23-2006 12:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration