Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Friday, February 10, 2017

Formatting SSD as GPT partition table for installing Windows 7

Just a bit of background, scroll down to directly find how to format an SSD drive with GPT partition table.

Recently I created a dual boot system with Windows 7 and Ubuntu 16.04 LTS. This was great since I want to start getting back into FOSS for software development and video editing. The dual boot was not perfect. Windows 7 was installed on my SSD drive first, and then last, I installed the Ubuntu onto a separate HDD. The Ubuntu install altered the SSD partition table (by changing it to MBR I think) so that GRUB could see the Windows partition when loaded. Butttttt when the GRUB menu came up and I tried to load Windows, the system simply reboot.

...so every time I wanted to load Win7 I had to go into the BIOS and change which drive was the primary boot drive.

The issue came when I wanted to clean install Win7 onto my SSD drive which was now setup as MBR partition. Installing Win7 onto SSD with MBR may work, but after the install is complete, you will run into issues. It happened to me...

The drive must be formatted to GPT partition table, and it can be done during the Win7 install!

Load the Win7 CD. When the setup starts press Shift + F10 and the command line will pop up.

Type the following commands:

diskpart
list disk
select disk #
clean
convert gpt
exit

The SSD drive you select should now be ready for a Win7 install. You can also check by typing the "list disk" command again, and the information will show that your disk is now GPT.

Easy as Pi!!!

Ciao!

Sunday, October 2, 2011

md5sum for Ubuntu USB Installer

Hey all! Just a quickie to explain the importance of md5sum checking.

When using the Ubuntu Startup Disk Creator, making bootable USB thumb drives is straight forward. The .iso file which is used to make the thumb-drive however must meet a data integrity test using the md5 algorithm. Essentially, if you decide to download a Linux distro, you should (and up until now, I haven't been) check the md5sum and that it matches the string defined on the Ubuntu Website.

The method is quite simple and will save time in the longrun. A description and method for use of md5 checksum can be read here.

To check the integrity of the data via md5, open terminal, goto the location of the linux-distro.iso, and enter the following:
$ md5sum linux-distro.iso

This may take some time depending on your computer, but I'd say no longer than 2mins. Here is an example showing the output when checking the md5sum for the distro Ubuntu 10.10:
$ md5sum ubuntu-10.10-desktop-i386.iso
59d15a16ce90c8ee97fa7c211b7673a8  ubuntu-10.10-desktop-i386.iso

And if you cross reference with the Hash Site, you will see that there is consistency.

This post was made because I have just tried to boot Ubuntu 11.04 Live on my friends laptop and was getting SQUAHFS read errors.

A seemingly n00bish mistake, but we gotta learn somehow.

Until next time. Ciao!

Wednesday, September 21, 2011

Crontab

When editing crontabs, you must edit the root cron. I found that editing the user cron file, will not run the script which you desire. Today I've read that Crontab is a file/process which acts to automate script files insync with time. The best example of what a Cronjob is, are monthly backups that people perform incase data becomes corrupt or they get a virus. Rather than doing it manually, or downloading some process heavy software to do it for you, you edit the Crontab file, and specify script/s that you want to run.

Below will be the list of code you will use + an example in which you can see if you have set up a Cronjob correctly. Yes, I'm one of those people whom enjoy peace of mind - knowing something works is better than thinking something works.

Here's what you need - but don't execute them yet, keep reading:
$ sudo crontab -e # To access the root cron file
$ sudo touch /etc/cron.d/ # To refresh the cron process with your new settings

The first time you access the crontab file, it will ask you what editor you wish to use - I use nano. I'm puzzled about the location of the crontab file as I originally thought /tmp files were deleted on shutdown. Anywho...the default crontab might look like this:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command

The information you need to know about the Cronfile, and editing, it are in the Cronfile itself. But here's a quick run down.

You add a cronjob by using the following syntax:
* * * * * /path/to/crontest.sh

Notice there are 5 positions. From left to right they specify:
  1. Minute, 0 - 59
  2. Hour, 0 - 23
  3. Day of month, 1 - 31
  4. Month, 1 - 12
  5. Day of week, 0 (Sunday) - 6 (Saturday)
So cronjobs are on an annual cycle. The asterisks example is basically telling the computer that the cronjob is to be run every minute.

Testing Crontab/Cronjobs
Here's a quick way to test crontab.

1) Open terminal and move to a directory of your choice.

2) Make a new file and call it "crontest.sh".

3) Give crontest.sh user executable permissions. Or 755, which also enables write-perms:
$ sudo chmod u+x crontest.sh

4) In crontest.sh, add this script. This is just a script that echos the date, given the format you desire.
#!/bin/bash

date +"%d-%m-%Y" >> /path/to/the/storage/file.txt # Date ID, >> tells terminal to append to end of file

Save and exit.

5) Open up the crontab file:
$ sudo crontab -e

6) Look at the current time and edit the crontab file with a few minutes added to the current time. So, if the time is 17:40, make the crontab entry look like this:
...
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
45 17 * * 1-5 /path/to/crontest.sh

Close nano and save the changes.

7) Now refresh crontab:
sudo touch /etc/cron.d/

Giving your password where required.

8) Sit and wait. When 17:45 comes around, the script will be run. Check the /path/to/the/storage/file.txt file and see if the date is there. If yes, then your method is good. If no, then check that permissions are correct; check that the code and all pathways are right.

Hope you enjoy this HowTo. I'm probably going to make a cronjob to append CPU temps to a file such that I can graph them and see if certain parameters are better/worse for my CPU performance.

Here are two sites which I found helpful:
http://klenwell.com/press/2010/11/cron-d/
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_using_crontab/

Enjoy, Ciao!