Home
Install new Harddrive
- Details
Determine Drive Information
We assume that the hard drive is physically installed and detected by the BIOS.
To determine the path that your system has assigned to the new hard drive, open a terminal and run:
sudo lshw -C disk
This should produce output similar to this sample:
-
*-disk description: ATA Disk product: IC25N040ATCS04-0 vendor: Hitachi physical id: 0 bus info: ide@0.0 logical name: /dev/sdb version: CA4OA71A serial: CSH405DCLSHK6B size: 37GB capacity: 37GB
Be sure to note the "logical name" entry, as it will be used several times throughout this guide.
Partition The Disk
If you have already formatted the drive and it contains data, skip this step and move on to "Mount Point." If the drive is still blank and unformatted, then you have two options: formatting the drive using the command line, or installing GParted for a graphical approach. Decide whether you want the drive to contain one single partition, or if you want to divide the space up between two or more partitions.
Partitioning Using GParted
If System > Administration > GNOME Partition Editor (or 'Partition Editor') is not available, install "GParted" using "sudo apt-get install gparted" from the command line, "Add/Remove Software" (or "Add/Remove...") from the Applications menu, or "Synaptic Package Manager" from the System > Administration menu. Open GParted and let's get started.
gksudo gparted
In the top-right corner of the window, choose your new hard drive from the drop-down list, referring back to the "logical name" from earlier. The window should refresh and show you a representation of the new drive. Assuming that the drive has yet to have been used, a white bar will run across the window. Use these steps to partition the drive with a single partition...
1) Right-click on the white bar and choose "New."
2) For "New Size" the number should be the maximum allowable, to fill the entire disk.
3) Choose "Primary Partition"
4) Now decide on a filesystem. Use "ext3" if the drive will only be used with Ubuntu. For file-sharing between Ubuntu and Windows, you should use "fat32." If you are unsure, search around the wiki and forums for advice.
5) Now click Add to compute the partition. The graphical display should update to show a new partition covering the entire disk.
6) To finish, click "Apply," or Edit > Apply. The disk will then be partitioned and formatted. You may now close GParted.
Command Line Partitioning
You'll be using "fdisk" to accomplish this. Refer back to the logical name you noted from earlier. For illustration, I'll use /dev/sdb, and assume that you want a single partition on the disk, occupying all the free space.
If the number of cylinders in the disk is larger than 1024 (and large hard drives always have more), it could, in certain setups, cause problems with:
- software that runs at boot time (e.g., old versions of LILO)
- booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Otherwise, this will not negatively affect you.
1) Initiate fdisk with the following command:
-
sudo fdisk /dev/sdb
2) Fdisk will display the following menu:
-
Command (m for help): m <enter> Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help):
3) We want to add a new partition. Type "n" and press enter.
Command action e extended p primary partition (1-4)
4) We want a primary partition. Enter "p" and enter.
Partition number (1-4):
5) Since this will be the only partition on the drive, number 1. Enter "1" and enter.
Command (m for help):
If it asks about the first cylinder, just type "1" and enter. (We are making 1 partition to use the whole disk, so it should start at the beginning.)
6) Now that the partition is entered, choose option "w" to write the partition table to the disk. Type "w" and enter.
The partition table has been altered!
7) If all went well, you now have a properly partitioned hard drive that's ready to be formatted. Since this is the first partition, Linux will recognize it as /dev/sdb1, while the disk that the partition is on is still /dev/sdb.
Command Line Formatting
To format the new partition as ext3 file system (best for use under Ubuntu):
-
sudo mkfs -t ext3 /dev/sdb1
To format the new partition as fat32 file system (best for use under Ubuntu & Windows):
-
sudo mkfs -t fat32 /dev/sdb1
As always, substitute "/dev/sdb1" with your own partition's path.
Modify Reserved Space (Optional)
When formatting the drive as ext2/ext3, 5% of the drive's total space is reserved for the super-user (root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary.
NOTE: You may run this command on a fat32 file system, but it will do nothing; therefore, I highly recommend not running it.
You can adjust the percentage of reserved space with the "tune2fs" command, like this:
sudo tune2fs -m 1 /dev/sdb1
This example reserves 1% of space - change this number if you wish.
-
Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.
Create A Mount Point
Now that the drive is partitioned and formatted, you need to choose a mount point. This will be the location from which you will access the drive in the future. I would recommend using a mount point with "/media", as it is the default used by Ubuntu. For this example, we'll use the path "/media/mynewdrive"
-
sudo mkdir /media/mynewdrive
Now we are ready to mount the drive to the mount point.
Mount The Drive
You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it.
Automatic Mount At Boot
You'll need to edit /etc/fstab:
-
gksu gedit /etc/fstab
Add this line to the end (for ext3 file system):
-
/dev/sdb1 /media/mynewdrive ext3 defaults 0 2
Add this line to the end (for fat32 file system):
-
/dev/sdb1 /media/mynewdrive vfat defaults 0 2
The defaults part may allow you to read, but not write. To write other partition and FAT specific options must be used. If gnome is being used, use the right-click, mount method. Then launch the mount command from terminal, no options. The last entry should be the FAT drive and and look something like:/dev/sda5 on /media/mynewdrive type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
All of the parts between the parenthesis are the mount options and should replace "defaults" in the fstab file. The "2" at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to "0" will skip this. Run 'man fstab' for more info here.
You can now run "sudo mount -a" (or reboot the computer) to have the changes take effect.
If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username)
-
sudo chown -R USERNAME:USERNAME /media/mynewdrive
or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk:
-
sudo chgrp plugdev /media/mynewdrive sudo chmod g+w /media/mynewdrive sudo chmod +t /media/mynewdrive
The last "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).
Manually Mount
Alternatively, you may want to manually mount the drive every time you need it.
For manual mounting, use the following command:
sudo mount /dev/sdb1 /media/mynewdrive
When you are finished with the drive, you can unmount it using:
sudo umount /media/mynewdrive
Ubuntu Home on own Partition
- Details
Move /home to it’s own partition
Having the “/home†directory tree on it’s own partition has several advantages, the biggest perhaps being that you can reinstall the OS (or even a different distro of Linux) without losing all your data. You can do this by keeping the /home partition unchanged and reinstalling the OS which goes in the “/†(root) directory, which can be on a seperate partition.
But you, like me, did not know this when you first installed Ubuntu, and have not created a new partition for “/home†when you first installed Ubuntu. Despair not, it is really simple to move “/home†to its own partition.
First, create a partition of sufficient size for your “/home†directory. You may have to use that new hard drive, or adjust/resize the existing partition on your current hard-drive to do this. Let me skip those details.
Next, mount the new partition:$mkdir /mnt/newhome
$sudo mount -t ext3 /dev/hda5 /mnt/newhome
(You have to change the “hda5″ in the above to the correct partition label for the new partition. Also, the above assumes that the new partition you created is formatted as an ext3 partition. Change the “ext3″ to whatever filesystem the drive is formatted to.)
Now, Copy files over:
Since the “/home†directory will have hardlinks, softlinks, files and nested directories, a regular copy (cp) may not do the job completely. Therefore, we use something we learn from the Debian archiving guide:$cd /home/
$find . -depth -print0 | cpio --null --sparse -pvd /mnt/newhome/
Make sure everything copied over correctly. You might have to do some tweaking and honing to make sure you get it all right, just in case.
Next, unmount the new partition:$sudo umount /mnt/newhome
Make way for the new “homeâ€$sudo mv /home /old_home
Since we moved /home to /old_home, there is no longer a /home directory. So first we should recreate a new /home by:sudo mkdir /home
Mount the new home:$sudo mount /dev/hda5 /home
(Again, you have to change “hda5″ to whatever the new partition’s label is.)
Cursorily verify that everything works right.
Now, you have to tell Ubuntu to mount your new home when you boot. Add a line to the “/etc/fstab†file that looks like the following:
/dev/hda5 /home ext3 nodev,nosuid 0 2
(Here, change the partition label “hda5″ to the label of the new partition, and you may have to change “ext3″ to whatever filesystem you chose for your new “homeâ€)
Once all this is done, and everything works fine, you can delete the “/old_home†directory by using:$sudo rm -r /old_home
Mysql Resync Master Slave
- Details
1) Prepare the slave
2) Prepare the master, copy databases and restart master
3) Restart Replication Slave
1) Prepare the slave
SSH into the slave server.
Log into MySQL on the slave as root
mysql>STOP SLAVE;
mysql>RESET SLAVE;
mysql> exit;
Now exit and shutdown slave
# service mysql stop
Delete the databases on slave (DANGER ... this deletes ALL databases on slave)
# cd /var/lib/mysql/
2) Prepare the master, copy databases and restart master
SSH into the master as root
log into mysql as root
Check users and kick them all off if more than yourself is connected
mysql> show processlist;
mysql> FLUSH TABLES WITH READ LOCK;
mysql> RESET MASTER;
exit and shutdown immediately
# service mysql stop
Now copy all the data from this master to the slave (may take a while)
# cd /var/lib/mysql/
# scp -r *
Note: If you have a really huge amount of data and you have the drive space, it may be faster to make a local copy of the data directory on the master which can be then copied to the slave after you have restarted the master.
When copying is done, restart the master
#service mysql start
Log into master and make sure it is logging.
mysql> show master status\G
*************************** 1. row ***************************
File: binary-log.002
Position: 280
Binlog_do_db:
Binlog_ignore_db:
1 row in set (0.00 sec)
Make sure Position is increasing if insert and update activity is taking place on master.
Now you can breathe for a while!
3) Restart Replication Slave
Log into slave server and fix privileges on the data folder
# /var/lib/mysql/
# sudo chown -R mysql:mysql *
Restart server
#service mysql start
mysql>start slave;
mysql> SHOW SLAVE STATUS\G;
Verify that it is replicating and you are done.
All Videos Reloaded
- Details
Plugin Parameters
The plugin parameters can be set in two ways: First, in the administration backend of the plugin, you can preset global parameters which affect all videos. Second, you can override these global settings in each tag individually. When overriding parameters, you add them - separated by spaces - inside the first part of the tag like this: {flv width="180" height="150" autostart="true"}party{/flv}
. Overriding always uses a lowercase attribute name, followed by an equal sign, followed by the attribute's value quoted in double quotation marks.
The following table shows the supported parameter names, their attribute counterparts (the name to use when overriding) and their possible values. As described in the Table of supported local formats, there are different players used for various media formats. The only player which supports all of the listed parameters is the JW Media Player. All other players usually support width, height and autoplay only. The YouTube player is an exception. It supports some special attributes which are described in the table at the end of this page.Please note: Some special attributes are not available in the backend parameter page but can be set in the tag only. Those attributes are explained in the remarks.
00000;">Global section | Global parameter name | Attribute name | Values |
---|---|---|---|
Plugin Parameters | Container class | avcss | any class name |
Plugin Parameters | Master video width | width | a pixel value |
Plugin Parameters | Master video height | height | a pixel value |
Plugin Parameters | iFilm video width | iwidth | a pixel value |
Plugin Parameters | iFilm video height | iheight | a pixel value |
Plugin Parameters | Metacafe video width | mwidth | a pixel value |
Plugin Parameters | Metacafe video height | mheight | a pixel value |
Plugin Parameters | Flash display mode | wmode | window, transparent or opaque |
Plugin Parameters | Flash background color | bgcolor | a color value 1) |
Plugin Parameters | Master audio width | awidth | a pixel value |
Plugin Parameters | Master audio height | aheight | a pixel value |
Advanced Parameters | Controls color | pbgcolor | a color value 1) |
Advanced Parameters | Controls text color | pfgcolor | a color value 1) |
Advanced Parameters | Controls highlight color | phicolor | a color value 1) |
Advanced Parameters | Video background | psccolor | a color value 1) |
Advanced Parameters | Autostart | autostart | true or false |
Advanced Parameters | Show control bar | shownav | true or false |
Advanced Parameters | Show digits | showdigits | true or false |
Advanced Parameters | Show icons | showicons | true or false |
Advanced Parameters | Show stop | showstop | true or false |
Advanced Parameters | Show download | showdownload | true or false 7) |
Advanced Parameters | Show fullscreen button | usefullscreen | true or false |
Advanced Parameters | Scriptable | enablejs | true or false 5) |
Advanced Parameters | Logo | logo | URL/relative path 2) |
Advanced Parameters | Video screen mode | screenmode | a mode identifier 3) |
Advanced Parameters | Playlist size | plsize | a pixel value 3) |
Advanced Parameters | Stretch content | stretch | 0, 1, 2 or 3 4) |
Advanced Parameters | Minimum Flash Version | flashver | Three numbers, separated by dots 10) |
Advanced Parameters | Show equalizer | showeq | true or false |
Advanced Parameters | Show search bar | searchbar | true or false |
Advanced Parameters | Search provider | searchlink | URL 12) |
Advanced Parameters | Alternate content | alt | any valid HTML 13) |
- | - | cfg | URL 6) |
- | - | displaywidth | a pixel value 3) |
- | - | displayheight | a pixel value 3) |
- | - | divid | any ID value 5) |
- | - | link | URL 7) |
- | - | linkfromdisplay | true or false 7) |
- | - | linktarget | a window name (e.g. _blank) 7) |
- | - | plthumbs | true or false 8) |
- | - | type | A file type 9) |
- | - | repeat | false, true or list 8) |
- | - | shuffle | true or false 8) |
- | - | autoscroll | true or false 8) |
- | - | recurl | URL 11) |
- | - | img | URL 14) |
- | - | volume | int 15) |
- | - | menu | true or false 16) |
- | - | popup | true or false 17) |
Remarks:
1. Color values can be specified in any of the following formats and are converted to the correct format automatically:
- A 6-digit hexadecimal value, preceeded by a hash sign (e.g.: #223344 like ordinary HTML syntax)
- A 3-digit hexadecimal value, preceeded by a hash sign (e.g.: #234 like CSS short syntax)
- 3 decimal values following the word rgb in parenthesis (e.g.: rgb(99,140,235) - like CSS rgb syntax)
- A 1-6-digit hexadecimal value, preceeded by 0x (e.g.: 0x2345 like in JavaScript)
- One of the 16 standardized color names as specified in HTML 4.0.1 (e.g.: red)
2. Logo images can be specified either by their absolute URL (e.g.: http://host/logo.png) or - if locally stored on the same server - by their local path (e.g.: /images/stories/logo2.png). The logo should be png (preferred) or gif in order to support transparency. The logo is always positioned in the upper right corner of the video screen. If you like a different position you can work around this limitation by creating a larger image where most of the image is transparent.
3. The parameter screenmode is kind of special. It is not an actual parameter for JW mediaplayer but a shortcut which affects how the player's parameters displaywidth and displayheight(those specify the size of the player's video screen) are calculated by the plugin. The following modes are available:
Mode | Description | |
---|---|---|
default | This mode results in the standard display where the player's control bar is located below the screen. Since the control bar has a height of 20 pixels, the available screen size iswidth × height - 20. | |
coverlay | In this mode, displaywidth and displayheight are set equally to width and height. This results in the control bar being shown transparently inside the screen area. Furthermore, the control bar fades out, if the mouse leaves the screen area and reappears if the mouse enters the screen area. The available screen size in this mode is width × height. | |
plbottom | This mode is intended to display a playlist at the bottom below the control bar. The height of this scrollable window is taken from the parameter plsize. The available screen size in this mode is width × height - 20 - plsize. | |
plright | Like plbottom, except the playlist is to be displayed to the right of the screen. The width of the scrollable window is taken from the parameter plsize. The available screen size in this mode is width - plsize × height - 20. | |
floatcplright | A combination of coverlay and plright. In this mode, the available screen size is width - plsize × height. |
Please note: When overriding displaywidth or displayheight within the tag, then the whole automatic calculation described above is disabled.
4. The stretch mode defines how to stretch movies to make them fit the display size. 1 will stretch them proportionally to fill the display, 0 will stretch them to fit. 2 will stretch them disproportionally to fit both height and width. 3 will show all items in their original dimensions.
5. If enabling scripting, the player can be controlled with JavaScript. To do this (and to distinguish multiple players in a page) it has to be addressed by it's ID. For easy scripting, this ID (which otherwise would be assigned automatically by the plugin) can be set manually by using the attribute divid. The resulting ID of the flash object to be used from within JavaScript is the specified value, prefixed by p_.
6. If many parameters have to be specified, you end up with quite lenghly tags. Alternatively, you can put all those parameters in a config file and then simply reference that. The URL, specified in the cfg attribute should point to a configuration XML file. The variable names in that file might differ from the attributes listed above. See the JW Media Player documentation for a reference. An example file can be found here.
7. The URL, specified in the link attribute is normally used for providing a download of the media or related information. This URL is invoked, when the player's download button is activated. Additionally, if the attribute linkfromdisplay is set to true, a click in the players display invokes that URL instead of toggling play/pause. The attribute linktarget (default: _blank) specifies the window in which this URL will be shown.
8. If plthumbs is set to true and a playlist is provided which provides image tags in its entries, those images are displayed as thumbnails in the playlist. If autoscroll is set to true, the playlist is scrolling automatically via mouse movement instead of using a scrollbar. The attribute repeat specifies how to proceed when a media stream is finished: false means stop the player, truemeans repeat the stream from beginning and list means start playing the next item in the playlist. In this context, the next item to be played is selected depending on the parameter shuffle(default: true). If this is set to false, the playlist is iterated sequentially. Using playlists is explained further down.
9. If using the remote variant of a media tag, you can reference any media file, even with a different extension or non extension at all. If this is the case, JW Media Player might not recognize the file type correctly. With this attribute you can forcibly set the media type to one of the supported types.
10. This attribute allows you to set the minimum Flash version, required to use the builtin JW Media Player. The player requires at least Flash version 7, however when running under that version, the features "display of GIF/PNG images", "smoothing of scaled images/video", VP6 and H264 encoded video, javascripting and the digits in the controlbar are not functional. Furthermore, for full screen display, at least Flash version 9.0.28 is required and for playing H264 encoded videos, at least Flash version 9.0.98. For full functionality, it is therefore stronglyrecommended, to specify at least version 9.0.28 (if using the fullscreen feature) or version 8 (without using fullscreen).
11. This attribute provides an URL for a recommendations XML file. A recommendations XML file contains titles, thumbnails and URLs for recommended Items, related to the currently playing video. It's content is shown after the video has finished playing (Similar like on YouTube). A sample recommendations XML file can be found here.
12. The URL provided here defines an alternate search provider which is used, when a user uses the search function of the search bar. The text typed by the user is appended to this URL. Example: If the URL is http://youtube.com/results?search_query= and the user searches for computer, then the resulting query is http://youtube.com/results?search_query=computer.
13. By default, the plugin provides two different warnings if the content can not be displayed: The first warning is displayed, if JavaScript is not available. Another warning is displayed, when JavaScript is working, but the flash plugin is either not available or it's version is below the value of the parameter flashver. With this parameter, the second warning can be replaced by custom content. If custom content is provided, the first warning will be disabled completely. The custom content must not contain any single quote or closing curly brace. To display those characters, they have to be encoded using html entities. The default warnings look like this:
Typical appearance of the default JavaScript warning (uses localized text):
To display this content, you need a JavaScript capable browser.
Typical appearance of the default Flash warning (uses localized text):
14. This attribute allows to specify a preview (thumbnail) image which is shown whenever the player is stopped. If a relative path is specified (i.e. the value does not start with a slash or http://or https://), then it is automatically prefixed by the default image directory (usually images/stories).
15. The initial volume. Unit is percent, which implies a valid range of 0 .. 100.
16. This attribute can be used to manipulate the context menu of the player. For flash based players, setting this to false restricts the menu to the basic entries. For the DivX player, this disables the menu completely.
17. When this attribute is set to true, then the resulting player will be invisible and prepared to be displayed in a popup window or lightbox by using the avrpopup special tag.
Special parameters of the YouTube player
When using the tag {youtube}, the YouTube player supports the following additional attributes (All boolean attributes have a default value of false):
Global section | Global parameter name | Attribute name | YouTube API Name | Values |
---|---|---|---|---|
Advanced Parameters | Autostart | autostart | autoplay | true or false |
Advanced Parameters | Controls color | pbgcolor | color1 | a color value |
Advanced Parameters | Controls highlight color | phicolor | color2 | a color value |
- | - | ytborder | border | true or false |
- | - | ytegm | egm | true or false |
- | - | ytloop | loop | true or false |
- | - | ytrel | rel | true or false |
More information about the meaning of those attributes can be found in the YouTube API specification here.
Page 33 of 40