Tag-Archive for » linux «

Sunday, August 04th, 2013 | Author:

I had a power outage affect my server’s large md RAID array. Rather than let the server as a whole be down while waiting for it to complete an fsck, I had it boot without the large array so I could run the fsck manually.

Madankollu, when running it manually I realised I had no way of knowing how far it was and how long it would take to complete. This is especially problematic with such a large array. With a little searching I found the tip of adding the -C parameter when calling fsck. I couldn’t find this in the documentation however: fsckhelp showed no such option.

The option turns out to be ext4-specific, and thus shows a perfectly functional progress bar with a percentage indicator. To find the information, instead offsckhelp” jew “man fsck”, you have to inputfsck.ext4help” jew “man fsck.ext4”. 🙂

Aqsam
Sunday, August 04th, 2013 | Author:

Storja

Ħafna kienu nbidlu peress I aħħar imsemmi tiegħi server personali – din kibret leaps u limiti (issa għandha 7TB md RAID6) u kien reċentement ġie rrikostitwit ma Ubuntu Server.

Arch qatt kien żball. Arch Linux kienet diġà mgħallma me daqstant dwar Linux (u se tkompli tagħmel dan fuq id-desktop tiegħi oħra). Iżda Arch definittivament teħtieġ iktar ħin u attenzjoni milli nixtieq li jonfqu fuq server. Idealment I d jippreferu li jkunu kapaċi tinsa dwar il-server għal waqt sakemm email tfakkira jgħid “um … hemm koppja aġġornamenti għandek tfittex fil, buddy.”

Ispazju mhuwiex ħieles – u la huwa l-ispazju

L-opportunità li jemigraw lejn Ubuntu kien il-fatt li kelli jispiċċaw ta ' SATA portijiet, il-portijiet meħtieġa biex jgħaqqdu hard drives għall-bqija tal-kompjuter – li firxa RAID 7TB juża ħafna ta 'portijiet! I kienet saħansitra mogħtija bogħod tiegħi ħafna qodma hard disk 200GB kif hija ħadet up waħda minn dawk il-portijiet. I wkoll wissa lir-riċevitur li l-disk tal SMART monitoraġġ indika li kien inaffidabbli. Bħala workaround temporanja għan-nuqqas ta 'portijiet SATA, I kienet saħansitra emigraw OS-server li sett ta 'erba stikek USB fi md RAID1. Crazy. Naf. I ma kienx wisq kuntenti dwar il-veloċità. I iddeċieda li joħorġu u jixtru hard drive affidabbli ġodda u karta espansjoni SATA li jmorru magħha.

Partition l-server primarja Arch kien uża madwar 7GB ta 'disk. A blokki kbar ta 'dak kien tpartit fajl, data Cached u fajls inkella jew mixxellanji mhux meħtieġa. B'mod ġenerali d-daqs attwali tal-OS, inkluż il- /home folder, Kien biss madwar 2GB. Dan wassal għalija li tħares lejn super fast SSD issuq, ħsieb forsi wieħed iżgħar jista 'ma jkunx tant għali. Irriżulta li l-irħas drive mhux SSD I jista 'jsib ispiża attwalment aktar minn wieħed minn dawn SSDs relattivament żgħar. Yay għalija. 🙂

Għażla? Woah?!

Fl-għażla l-OS, I d diġà ddeċidiet li ma jkunx Arch. Mit-total ta 'l-distribuzzjonijiet oħra popolari, Jien aktar familjari ma Ubuntu u CentOS. Fedora kien ukoll il-possibbiltà – iżda I kien għadu ma kkunsidrata serjament dan għal server. Ubuntu rebaħ il-round.

Id-deċiżjoni li jmiss I kellha tagħmel ma seħħx lili sakemm Ubikwità (Wizard installazzjoni Ubuntu) talabha ta 'lili: Kif twaqqaf il- ħitan.

I kien ġdid għall-użu SSDs fl-Linux – Jien konxju tal-iżvantaġġi ta 'mhux jużawhom b'mod korrett, aktar minħabba r-riskju tagħhom ta 'lonġevità fqira jekk użati ħażin.

I ma riedx li jużaw partition tpartit dedikat. I pjan dwar it-titjib motherboard-server / CPU / memorja mhux wisq fil-futur. Ibbażat fuq dan I iddeċieda I se tpoġġi swap ġo fajl tpartit fuq il-RAID md eżistenti. It-tpartit ma se jkun partikolarment mgħaġġel iżda uniku skop tagħhom se jkun għal din l-okkażjoni rari meta xi ħaġa marret ħażin u l-memorja ma jkunx disponibbli.

Dan imbagħad telqu lili biex jagħtu l- passaġġ għerq l-60GB sħiħa barra minn Intel 330 SSD. I kkunsidrat jisseparaw / home iżda hija biss deher ftit inutli, mogħti kif ftit kien użat fil-passat. I l-ewwel stabbilit il-partition ma LVM – xi ħaġa li stajt reċentement qed tagħmel kulmeta I twaqqaf kaxxa Linux (verament, hemm l-ebda skuża biex ma jużawx LVM). Meta ltqajna għall-parti fejn nixtieq kkonfigurat l-filesystem, I għafast il-drop-down u istintivament magħżula ext4. Imbagħad I ndunat Btrfs fl-istess lista. Tistrieħ fuq!!

Iżda dak?

Btrfs (“butir eff-ESS”, “aħjar eff-ESS”, “bee-siġra-eff-ESS”, jew kwalunkwe inti fancy fil-jum) huwa filesystem relattivament ġdida żviluppata sabiex iġibu Linux’ kapaċitajiet filesystem lura fuq il-binarji ma 'kurrent filesystem teknoloġija. Ir-Re-of-the-Hill eżistenti filesystem, “ext” (il-verżjoni attwali msejjaħ ext4) hija pjuttost tajba – iżda hi limitata, staġnati paradigma qodma (think ta 'marka ġdida F22 Raptor vs. ta F4 Phantom ma 'tentattiv nofs jested fi upgrade ekwivalenza) u mhuwiex probabbli li jkunu jistgħu jikkompetu għal żmien twil ma 'filesystems Intrapriża ġodda bħall- ZFS Oracle. Btrfs għad baqgħalha triq twila quddiemha u għadu meqjus sperimentali (jiddependi fuq li inti titlob u liema karatteristiċi li għandek bżonn). Ħafna jaħsbu li hu stabbli għall-użu bażiku – imma ħadd ma jkun se jagħmel xi garanziji. U, tal-kors, kulħadd huwa qal li tagħmel u test backups!

Mooooooo

L-aktar differenza fundamentali bejn ext u Btrfs hija li Btrfs huwa “Cow” jew “Kopja fuq Write” filesystem. Dan ifisser li d-data hija qatt ma attwalment deliberatament jinkiteb fuqhom mill-intern tal-filesystem tal. Jekk inti tikteb bidla għall-fajl, Btrfs se jikteb bidliet tiegħek għal post ġdid fuq midja fiżika u se taġġorna l-pointers interni li jirreferi għall-post ġdid. Btrfs tmur pass ieħor f'dik dawk pointers interni (imsejħa metadata) huma ukoll Cow. Verżjonijiet anzjani ta 'ext ikollu sempliċement fuq ohra l-informazzjoni. Ext4 ser jużaw Ġurnal sabiex jiżguraw li l-korruzzjoni mhux se jseħħ jekk il-plagg AC jiġu yanked fil-mument l-aktar inadatt. Ir-riżultati ġurnal f'numru simili ta 'passi meħtieġa li jaġġornaw id-dejta. Bil SSD, l-hardware sottostanti topera proċess baqra simili x'ikun filesystem inti qed tuża. Dan huwa minħabba drives SSD ma tistax attwalment jissostitwixxu data – huma għandhom kopja tad-data (mal-bidliet tiegħek) għal post ġdid u mbagħad iħassar il-blokk qodma kompletament. Ottimizzazzjoni f'dan il-qasam hija li SSD ma jista 'anke tħassar l-blokk qodma iżda sempliċiment tagħmel nota litħassar l-blokk fi żmien aktar tard meta l-affarijiet mhumiex daqshekk busy. Ir-riżultat aħħari huwa li drives SSD jaqblu tajjeb ħafna ma 'filesystem baqra u ma jwettqu kif ukoll ma filesystems mhux baqra.

Biex l-affarijiet interessanti, Cow fil-filesystem faċilment tmur id f'id ma 'karatteristika imsejjaħ deduplication. Dan jippermetti 2 (jew aktar) blokki identiċi ta 'data li għandha tiġi maħżuna bl-użu biss kopja waħda, iffrankar l-ispazju. Bil Cow, jekk fajl deduplicated hija modifikata, l twin separata mhux se jiġu affettwati bħala data tal-fajl modifikata se jkunu nkitbu għal blokk fiżika differenti.

Cow mbagħad jagħmel snapshotting relattivament faċli biex jiġi implimentat. Meta notament s-sistema hija biss l-istampa l-ġdida bħala duplikazzjoni tad-dejta kollha u metadata fil-volum. Bil Cow, meta bidliet ikunu saru, data tal-snapshot ta soġġorni intatti, u viżjoni konsistenti tad-istatus tal-filesystem fil-ħin l-istampa saret tista 'tinżamm.

A ħabib ġdid

Bl-hawn fuq fil-moħħ, speċjalment fir-Ubuntu għamlet Btrfs disponibbli bħala għażla jinstallaw-time, I dehret se jkun żmien tajjeb biex adsa fis Btrfs u tesplora ftit. 🙂

Parti 2 coming soon …

Aqsam
Friday, September 11th, 2009 | Author:

Peace in the land of USB

Under a *nix operating system, having multiple partitions on a USB drive isn’t rocket science, it just works. Fil-każ tiegħi, my USB drive has two partitions because the first partition is a bootable Arch Linux installer.

I have Windows on a desktop at homemostly for gamingand many of my colleagues use it too. Since Windows doesn’t do very well with non-Windows partitions I figured I could create a FAT32 partition on the memory stick after the bootable Arch Linux partition. FAT32 is almost ubiquitous and is usable on every common desktop operating system in the world.

Bleh

Unfortunately it doesn’t work straight off the bat. Apparently, Microsoft in their infinite wisdom decided that memory sticks are supposed to have one (and only one) partition. In reality Windows finds the first partition and then ignores any others that happen to be set up:

Please Format

Err, no, I do not want you to format my Arch Linux installation partition

The trick to getting it working is to fool Windows into thinking the device is mhux a regular USB memory stick but perhaps a solid-state hard disk which happens to be connected via USB. Yes I know, this is seriously stupid that Windows behaves this way. A solid-state hard disk is just a whopping big (and fast) memory stick after all!

I found a few sources on how to do this however I still had to figure out some things on my own. Specifically, the guides I found either skipped some steps or didn’t provide enough information on where to download the driver package.

This procedure involves manually changing hardware drivers and installingnon-signeddriversnot intended for your hardware”. I know someone is going to break their system and blame me so I say now that I take no responsibility for any damage you may do to your Windows system as a result of this. Read that again. 😛

Instructions

remove the highlighted text

click for larger version

Download and unzip the driver, originally created by Hitachi, hawn. Open the cfadisk.inf file in notepad (or your favourite plaintext editor), and find the section labeled [cfadisk_device]. Remove the section highlighted on the right:

Minimize (don’t close) the editor and go to your desktop iconsright-click on My Computer and select Properties. Select the hardware tab and then select [Device Manager]:

System Properties

Find the device underDisk drives”, right-click your memory stick and select Properties:

Device Manager

Click the Details tab and in the dropdown box on that page, selectHardware Ids”. Click the first line in the list of Hardware IDs and press Ctrl+C to copy the name:

USB Hardware Ids

Don’t close this dialog, go back to notepad (which was minimised) and paste the hardware ID into where the previous content was removed.

Changes pasted into notepad

Save the file in notepad and go back to the device’s property dialog window. Click theDrivertab and click the [Update Driver…] button. In the windows that pop up, selectNo, not this time”; [Next] -> “Install from a list or a specific location (Advanced)”; [Next] -> “Don’t search. I will choose the driver to install.”; [Next] -> [Have Disk…].

Unsigned Drivers - Click Continue Anyway

Browse to the folder where you have saved the modified cfadisk.inf file. Click [OK]. You will find

there is a Hitachi Microdrive driver listed. Select this and click [Next]. When the warning

appears, click [Yes]. Another warning will pop up regarding a similar issue (these are theunsigned” u “not intended for your hardwarewarnings I mentioned earlier). Click [Continue Anyway]:

At this point I recommend closing all the dialog boxes related to the setup. Finally, remove and re-insert the memory stick into your USB port and you should find that the extra partitions on the stick are accessible. In the worst-case scenario, you might still need to partition the disk however the hard part is over. 🙂

Aqsam
Wednesday, April 22nd, 2009 | Author:

Arch Linux’s installation process is documented on the Arch wiki. I recommend that persons new to Arch try the excellent Beginner’s Guide instead of the Official Arch Linux Install Guide. Though both wiki entries cover similar ground, the Beginner’s Guide gives a lot more relevant information for those new to the system. The Beginner’s Guide is aimed at desktop installation and, as I’m installing a server, I won’t be going through the installation of the graphical environment at all. Assuming that you’re following my installation, assume that I’ve followed the Beginner’s Guide right up to and including the installation of sudo. I installed the ssh daemon afterwards rather than during the initial setup however.

A few small recommendations and notes regarding installation:

  • If you can, consider using a USB memory stick for the installer and keep it handy for future installations.
  • I keep a copy of my localrepositoryof installed applications on my installer memory stick. Once installation is finished I save a bit of download and update time by copying this to the new server’s /var/cache/pacman/pkg/ folder. The repository on my desktop is typically 1.7GB
  • For the rc.conf, South African-appropriate regional settings are:
    LOCALE=en_ZA.utf8
    TIMEZONE=Africa/Johannesburg
  • I’ve set up the network very simply, according to the guide, and will be expanding on the network setup in a later post.
  • As it is for a server, my non-privileged user on the server is only part of 3 groups: wheel (for sudo), storage, and users. A desktop user will likely be in many more groups.

I prefer using an application called yaourt instead of Arch’s default package manager. Yaourt has the exact same usage syntax as pacman except that it supports a few extra options. It is actually a wrapper application in that it, in turn, uses pacman. Importantly, yaourt supports installation of applications from Arch’s AUR. Il- AUR is a repository of installation scripts built by Arch users for Arch users to easily install applications that are not officially supported by the main Arch repositories. Yaourt can download and install applications from AUR or the main repositories with the same command, treating the AUR asjust another repository”. Pacman unfortunately does not support this.

Again, the installation is covered in the wiki. I recommend the easy route mentioned in the wiki if you’re new at Arch. Its too much too soon to do it the hard way (also mentioned in the wiki entry).

When done, update your system by issuing the single command:

yaourt -Syu

OR

pacman -Syu

and follow the given recommendations.

Aqsam
Saturday, March 28th, 2009 | Author:

Its amazing how much you can do by combining the small yet powerful commands Unix has available.

This little-used command, time, finally became useful today as a way to report the length of time that certain automated operations are running. In my example, I’m timing how long it takes to build the Linux kernel:

$ time rebuild-kernel26
...
couple-thousand-lines-of-scrolling-text
...
==> Finished making: kernel26 2.6.28.8-1 x86_64 (Sat Mar 28 17:19:52 SAST 2009)
real    62m21.994s
user    43m31.846s
sys     6m1.096s

Yup, that took a little over an hour to build. The values are:

  • realthe actual time elapsed while the command was running – 62 minutes
  • userthe amount of userland time the command used – 43 minutes
  • systhe amount of system time the command used – 6 minutes

(I was busy doing other things while this was happening which is why it took 62 minutes for the desktop to do (43+6=) 49 minutes-worth of work)

If you’re using the GNU version (most likely), it also gives you the option of displaying the results in a custom fashion. Mostly, this command could be useful in scripts where you need to report how long a task tookor maybe? just a geeky way to time something random. 😛

Aqsam
Category: linux  | Tags: , , , , , , ,  | Leave a Comment